seemore 1.12.16 → 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 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) => {
@@ -1666,6 +1691,8 @@ function createRemarkPlugins(options) {
1666
1691
  remarkMdxMermaid,
1667
1692
  // Rewrites ```d2 fences to <D2 chart="…" />, mermaid's sibling for D2 diagrams.
1668
1693
  remarkSeemoreD2,
1694
+ // After the copy snapshot, so a paste keeps the shortcodes the author typed.
1695
+ remarkSeemoreEmoji,
1669
1696
  () => remarkSeemoreWikilinks(options),
1670
1697
  () => remarkSeemoreLinks(options)
1671
1698
  ];