Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

➕ Add binder icon #6

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions myst/src/names.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{ "name": "arxiv", "componentName": "ArxivIcon" },
{ "name": "binder", "componentName": "BinderIcon" },
{ "name": "cc-by", "componentName": "CcByIcon" },
{ "name": "cc-nc", "componentName": "CcNcIcon" },
{ "name": "cc-nd", "componentName": "CcNdIcon" },
Expand Down
162 changes: 82 additions & 80 deletions scienceicons.mjs
Original file line number Diff line number Diff line change
@@ -1,111 +1,113 @@
// node_modules/nanoid/index.js
import { randomFillSync } from "crypto";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A load of LSP-derived linting. I can remove this if you don't like the changes.

var POOL_SIZE_MULTIPLIER = 128;
var pool;
var poolOffset;
import { randomFillSync } from 'crypto'
var POOL_SIZE_MULTIPLIER = 128
var pool
var poolOffset
var fillPool = (bytes) => {
if (!pool || pool.length < bytes) {
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
randomFillSync(pool);
poolOffset = 0;
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
randomFillSync(pool)
poolOffset = 0
} else if (poolOffset + bytes > pool.length) {
randomFillSync(pool);
poolOffset = 0;
randomFillSync(pool)
poolOffset = 0
}
poolOffset += bytes;
};
poolOffset += bytes
}
var random = (bytes) => {
fillPool(bytes -= 0);
return pool.subarray(poolOffset - bytes, poolOffset);
};
fillPool((bytes -= 0))
return pool.subarray(poolOffset - bytes, poolOffset)
}
var customRandom = (alphabet, defaultSize, getRandom) => {
let mask = (2 << 31 - Math.clz32(alphabet.length - 1 | 1)) - 1;
let step = Math.ceil(1.6 * mask * defaultSize / alphabet.length);
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
return (size = defaultSize) => {
let id = "";
let id = ''
while (true) {
let bytes = getRandom(step);
let i = step;
let bytes = getRandom(step)
let i = step
while (i--) {
id += alphabet[bytes[i] & mask] || "";
if (id.length === size) return id;
id += alphabet[bytes[i] & mask] || ''
if (id.length === size) return id
}
}
};
};
var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size, random);
}
}
var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size, random)

// node_modules/myst-common/dist/utils.js
function addMessageInfo(message, info) {
if (info === null || info === void 0 ? void 0 : info.note)
message.note = info.note;
if (info === null || info === void 0 ? void 0 : info.url)
message.url = info.url;
if (info === null || info === void 0 ? void 0 : info.ruleId)
message.ruleId = info.ruleId;
if (info === null || info === void 0 ? void 0 : info.fatal)
message.fatal = true;
return message;
if (info === null || info === void 0 ? void 0 : info.note) message.note = info.note
if (info === null || info === void 0 ? void 0 : info.url) message.url = info.url
if (info === null || info === void 0 ? void 0 : info.ruleId) message.ruleId = info.ruleId
if (info === null || info === void 0 ? void 0 : info.fatal) message.fatal = true
return message
}
function fileWarn(file, message, opts) {
return addMessageInfo(file.message(message, opts === null || opts === void 0 ? void 0 : opts.node, opts === null || opts === void 0 ? void 0 : opts.source), opts);
return addMessageInfo(
file.message(
message,
opts === null || opts === void 0 ? void 0 : opts.node,
opts === null || opts === void 0 ? void 0 : opts.source,
),
opts,
)
}
var az = "abcdefghijklmnopqrstuvwxyz";
var alpha = az + az.toUpperCase();
var numbers = "0123456789";
var nanoidAZ = customAlphabet(alpha, 1);
var nanoidAZ9 = customAlphabet(alpha + numbers, 9);
var az = 'abcdefghijklmnopqrstuvwxyz'
var alpha = az + az.toUpperCase()
var numbers = '0123456789'
var nanoidAZ = customAlphabet(alpha, 1)
var nanoidAZ9 = customAlphabet(alpha + numbers, 9)

// src/names.json
var names_default = [
{ name: "arxiv", componentName: "ArxivIcon" },
{ name: "cc-by", componentName: "CcByIcon" },
{ name: "cc-nc", componentName: "CcNcIcon" },
{ name: "cc-nd", componentName: "CcNdIcon" },
{ name: "cc-sa", componentName: "CcSaIcon" },
{ name: "cc-zero", componentName: "CcZeroIcon" },
{ name: "cc", componentName: "CcIcon" },
{ name: "curvenote", componentName: "CurvenoteIcon" },
{ name: "discord", componentName: "DiscordIcon" },
{ name: "discourse", componentName: "DiscourseIcon" },
{ name: "email", componentName: "EmailIcon" },
{ name: "github", componentName: "GithubIcon" },
{ name: "jupyter-book", componentName: "JupyterBookIcon" },
{ name: "jupyter-text", componentName: "JupyterTextIcon" },
{ name: "jupyter", componentName: "JupyterIcon" },
{ name: "linkedin", componentName: "LinkedinIcon" },
{ name: "mastodon", componentName: "MastodonIcon" },
{ name: "myst", componentName: "MystIcon" },
{ name: "open-access", componentName: "OpenAccessIcon" },
{ name: "orcid", componentName: "OrcidIcon" },
{ name: "osi", componentName: "OsiIcon" },
{ name: "ror", componentName: "RorIcon" },
{ name: "slack", componentName: "SlackIcon" },
{ name: "twitter", componentName: "TwitterIcon" },
{ name: "website", componentName: "WebsiteIcon" },
{ name: "youtube", componentName: "YoutubeIcon" }
];
{ name: 'arxiv', componentName: 'ArxivIcon' },
{ name: 'binder', componentName: 'BinderIcon' },
{ name: 'cc-by', componentName: 'CcByIcon' },
{ name: 'cc-nc', componentName: 'CcNcIcon' },
{ name: 'cc-nd', componentName: 'CcNdIcon' },
{ name: 'cc-sa', componentName: 'CcSaIcon' },
{ name: 'cc-zero', componentName: 'CcZeroIcon' },
{ name: 'cc', componentName: 'CcIcon' },
{ name: 'curvenote', componentName: 'CurvenoteIcon' },
{ name: 'discord', componentName: 'DiscordIcon' },
{ name: 'discourse', componentName: 'DiscourseIcon' },
{ name: 'email', componentName: 'EmailIcon' },
{ name: 'github', componentName: 'GithubIcon' },
{ name: 'jupyter-book', componentName: 'JupyterBookIcon' },
{ name: 'jupyter-text', componentName: 'JupyterTextIcon' },
{ name: 'jupyter', componentName: 'JupyterIcon' },
{ name: 'linkedin', componentName: 'LinkedinIcon' },
{ name: 'mastodon', componentName: 'MastodonIcon' },
{ name: 'myst', componentName: 'MystIcon' },
{ name: 'open-access', componentName: 'OpenAccessIcon' },
{ name: 'orcid', componentName: 'OrcidIcon' },
{ name: 'osi', componentName: 'OsiIcon' },
{ name: 'ror', componentName: 'RorIcon' },
{ name: 'slack', componentName: 'SlackIcon' },
{ name: 'twitter', componentName: 'TwitterIcon' },
{ name: 'website', componentName: 'WebsiteIcon' },
{ name: 'youtube', componentName: 'YoutubeIcon' },
]

// src/scienceicons.ts
var SUPPORTED_ICONS = names_default.map((icon) => icon.name);
var SUPPORTED_ICONS = names_default.map((icon) => icon.name)
var iconRole = {
name: "scienceicon",
alias: ["scicon"],
name: 'scienceicon',
alias: ['scicon'],
body: {
type: String,
required: true,
doc: "The kind of icon to display"
doc: 'The kind of icon to display',
},
run(data, vfile, ctx) {
if (!SUPPORTED_ICONS.includes(data.body)) {
return fileWarn(vfile, `Unknown kind of scienceicon: ${data.body}`);
return fileWarn(vfile, `Unknown kind of scienceicon: ${data.body}`)
}
return [{ type: "scienceicon", value: data.body, kind: data.body }];
}
};
var plugin = { name: "Science Icons by Curvenote", roles: [iconRole] };
var scienceicons_default = plugin;
export {
scienceicons_default as default
};
//# sourceMappingURL=scienceicons.mjs.map
return [{ type: 'scienceicon', value: data.body, kind: data.body }]
},
}
var plugin = { name: 'Science Icons by Curvenote', roles: [iconRole] }
var scienceicons_default = plugin
export { scienceicons_default as default }
//# sourceMappingURL=scienceicons.mjs.map
48 changes: 48 additions & 0 deletions src/24/solid/binder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions typst/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Additionally the raw SVG text for each icon can be found by replacing `Icon` wit
## List of Icons

- arxiv-icon
- binder-icon
- cc-by-icon
- cc-nc-icon
- cc-nd-icon
Expand Down
1 change: 1 addition & 0 deletions typst/docs/scienceicons.typ
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Additionally the raw SVG text for each icon can be found by replacing `Icon` wit
column-gutter: 3em,
// Start Icons
[`arxiv-icon`()], arxiv-icon(),
[`binder-icon`()], binder-icon(),
[`cc-by-icon`()], cc-by-icon(),
[`cc-nc-icon`()], cc-nc-icon(),
[`cc-nd-icon`()], cc-nd-icon(),
Expand Down