seemore 1.12.14 → 1.12.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +51 -1
- package/dist/cli/index.js.map +1 -1
- package/package.json +3 -1
package/dist/cli/index.js
CHANGED
|
@@ -1267,6 +1267,8 @@ import {
|
|
|
1267
1267
|
// src/node/vite/remark.ts
|
|
1268
1268
|
import { existsSync as existsSync3 } from "fs";
|
|
1269
1269
|
import { dirname as dirname6, relative, resolve as resolve4 } from "path";
|
|
1270
|
+
import { nameToEmoji } from "gemoji";
|
|
1271
|
+
import { findAndReplace } from "mdast-util-find-and-replace";
|
|
1270
1272
|
import { visit } from "unist-util-visit";
|
|
1271
1273
|
var WIKILINK = /\[\[([^\]\n]+)\]\]/g;
|
|
1272
1274
|
var ALERTS = {
|
|
@@ -1353,6 +1355,29 @@ function remarkSeemoreWikilinks(options) {
|
|
|
1353
1355
|
});
|
|
1354
1356
|
};
|
|
1355
1357
|
}
|
|
1358
|
+
var SHORTCODE = /:(\+1|[-\w]+):/g;
|
|
1359
|
+
var SLACK_SHORTCODES = {
|
|
1360
|
+
large_orange_circle: "\u{1F7E0}",
|
|
1361
|
+
large_yellow_circle: "\u{1F7E1}",
|
|
1362
|
+
large_green_circle: "\u{1F7E2}",
|
|
1363
|
+
large_purple_circle: "\u{1F7E3}",
|
|
1364
|
+
large_brown_circle: "\u{1F7E4}",
|
|
1365
|
+
large_red_square: "\u{1F7E5}",
|
|
1366
|
+
large_orange_square: "\u{1F7E7}",
|
|
1367
|
+
large_yellow_square: "\u{1F7E8}",
|
|
1368
|
+
large_green_square: "\u{1F7E9}",
|
|
1369
|
+
large_blue_square: "\u{1F7E6}",
|
|
1370
|
+
large_purple_square: "\u{1F7EA}",
|
|
1371
|
+
large_brown_square: "\u{1F7EB}"
|
|
1372
|
+
};
|
|
1373
|
+
function remarkSeemoreEmoji() {
|
|
1374
|
+
return (tree) => {
|
|
1375
|
+
findAndReplace(tree, [
|
|
1376
|
+
SHORTCODE,
|
|
1377
|
+
(_, name) => nameToEmoji[name] ?? SLACK_SHORTCODES[name] ?? false
|
|
1378
|
+
]);
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1356
1381
|
function remarkSeemoreD2() {
|
|
1357
1382
|
return (tree) => {
|
|
1358
1383
|
visit(tree, "code", (node, index, parent) => {
|
|
@@ -1641,7 +1666,9 @@ function createRemarkPlugins(options) {
|
|
|
1641
1666
|
// frontmatter strip is the one thing that must come first — its keys are metadata, not
|
|
1642
1667
|
// content. Heading ids stay off: `## Title [#title]` is noise in a paste.
|
|
1643
1668
|
remarkSeemoreMarkdownSource,
|
|
1644
|
-
|
|
1669
|
+
function() {
|
|
1670
|
+
return remarkSeemoreLLMs.call(this, options);
|
|
1671
|
+
},
|
|
1645
1672
|
remarkHeading,
|
|
1646
1673
|
remarkAdmonition,
|
|
1647
1674
|
remarkDirectiveAdmonition,
|
|
@@ -1664,10 +1691,33 @@ function createRemarkPlugins(options) {
|
|
|
1664
1691
|
remarkMdxMermaid,
|
|
1665
1692
|
// Rewrites ```d2 fences to <D2 chart="…" />, mermaid's sibling for D2 diagrams.
|
|
1666
1693
|
remarkSeemoreD2,
|
|
1694
|
+
// After the copy snapshot, so a paste keeps the shortcodes the author typed.
|
|
1695
|
+
remarkSeemoreEmoji,
|
|
1667
1696
|
() => remarkSeemoreWikilinks(options),
|
|
1668
1697
|
() => remarkSeemoreLinks(options)
|
|
1669
1698
|
];
|
|
1670
1699
|
}
|
|
1700
|
+
function remarkSeemoreLLMs(options) {
|
|
1701
|
+
const snapshot = remarkLLMs.call(this, { as: MARKDOWN_EXPORT, headingIds: false });
|
|
1702
|
+
return (tree, file) => {
|
|
1703
|
+
try {
|
|
1704
|
+
snapshot(tree, file);
|
|
1705
|
+
} catch (error) {
|
|
1706
|
+
options.onWarning(
|
|
1707
|
+
`Could not convert ${file.path} back to Markdown for copying (${error.message}); the raw file is copied instead.`
|
|
1708
|
+
);
|
|
1709
|
+
const fallback = { type: "root", children: [{ type: "html", value: sourceOf(tree, file) }] };
|
|
1710
|
+
snapshot(fallback, file);
|
|
1711
|
+
tree.children.unshift(...fallback.children.slice(0, -1));
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
function sourceOf(tree, file) {
|
|
1716
|
+
const source = String(file.value);
|
|
1717
|
+
const yaml = tree.children[0]?.type === "yaml" ? tree.children[0] : void 0;
|
|
1718
|
+
const end = yaml?.position?.end.offset;
|
|
1719
|
+
return end === void 0 ? source : source.slice(end).trimStart();
|
|
1720
|
+
}
|
|
1671
1721
|
function createRehypePlugins(options) {
|
|
1672
1722
|
return [
|
|
1673
1723
|
// A fence in a language Shiki has no grammar for (anything an AI dreamt up) is plain code
|