@bendyline/squisq 2.12.3 → 2.12.5
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/{Doc-BkSiCJnM.d.ts → Doc-CwmJZayl.d.ts} +1 -1
- package/dist/{ImageEditDoc-UjQv8q3j.d.ts → ImageEditDoc-CtRgL0wh.d.ts} +1 -1
- package/dist/{annotationCoercion-TxFucMtA.d.ts → annotationCoercion-hTvELpIN.d.ts} +1 -1
- package/dist/{chunk-MPEGJKFJ.js → chunk-GGZCJ2MS.js} +7 -1
- package/dist/{chunk-VTVBSZXB.js → chunk-I3ENXLAN.js} +2 -16
- package/dist/{chunk-ZKDJHO6Y.js → chunk-ILLLGZCE.js} +4 -3
- package/dist/{chunk-EX75I5HX.js → chunk-PVFDR3XT.js} +233 -11
- package/dist/{chunk-SK5TQSYN.js → chunk-RHLRHRWY.js} +12 -8
- package/dist/{chunk-ZBPWNH4L.js → chunk-UN6S5OID.js} +174 -94
- package/dist/{chunk-J6AGNXFO.js → chunk-XFE6WYDK.js} +1 -1
- package/dist/doc/index.d.ts +7 -7
- package/dist/doc/index.js +5 -5
- package/dist/fence/index.d.ts +2 -2
- package/dist/generate/index.d.ts +2 -2
- package/dist/imageEdit/index.d.ts +4 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.js +14 -8
- package/dist/jsonForm/index.d.ts +2 -2
- package/dist/markdown/index.d.ts +38 -4
- package/dist/markdown/index.js +9 -3
- package/dist/{materializePageSection-DEXohgVt.d.ts → materializePageSection-B5LehyBR.d.ts} +2 -2
- package/dist/mediaEdit/index.d.ts +3 -3
- package/dist/narration/index.d.ts +2 -2
- package/dist/narration/index.js +3 -3
- package/dist/recommend/index.d.ts +1 -1
- package/dist/recommend/index.js +1 -1
- package/dist/schemas/index.d.ts +5 -5
- package/dist/{themeLibrary-BrBc0mrP.d.ts → themeLibrary-jYL3QKTn.d.ts} +1 -1
- package/dist/timing/index.d.ts +2 -2
- package/dist/transform/index.d.ts +3 -3
- package/dist/transform/index.js +4 -4
- package/dist/{types-BmEHcL3l.d.ts → types-Zk8qYuaT.d.ts} +24 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BuildSpec, h as BuildTiming, ac as Transition, ae as TransitionType, g as BuildStep, M as MarkdownBlockNode, z as MarkdownHeading, d as BuildAdvance } from './types-
|
|
1
|
+
import { f as BuildSpec, h as BuildTiming, ac as Transition, ae as TransitionType, g as BuildStep, M as MarkdownBlockNode, z as MarkdownHeading, d as BuildAdvance } from './types-Zk8qYuaT.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Media-edit recipes — the non-destructive edit list a media reference carries.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a2 as ImageLayer, bv as TextLayer, bh as ShapeLayer, aX as PathLayer } from './Doc-
|
|
1
|
+
import { a2 as ImageLayer, bv as TextLayer, bh as ShapeLayer, aX as PathLayer } from './Doc-CwmJZayl.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ImageEditDoc — JSON document describing a layered, editable image.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BuildSpec, aq as BlockConnection, ae as TransitionType, ad as TransitionDirection } from './types-
|
|
1
|
+
import { f as BuildSpec, aq as BlockConnection, ae as TransitionType, ad as TransitionDirection } from './types-Zk8qYuaT.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Registry of known block-meta keys and their coercion strategies.
|
|
@@ -3045,7 +3045,13 @@ function extractImages(contents, limit = Infinity) {
|
|
|
3045
3045
|
const n = node;
|
|
3046
3046
|
if (n.type === "image" && typeof n.url === "string" && n.url) {
|
|
3047
3047
|
if (!mediaKindForUrl(n.url)) {
|
|
3048
|
-
found.push({
|
|
3048
|
+
found.push({
|
|
3049
|
+
src: n.url,
|
|
3050
|
+
alt: typeof n.alt === "string" ? n.alt : "",
|
|
3051
|
+
// A resized image parses with the size it was given in the editor.
|
|
3052
|
+
...typeof n.width === "number" ? { width: n.width } : {},
|
|
3053
|
+
...typeof n.height === "number" ? { height: n.height } : {}
|
|
3054
|
+
});
|
|
3049
3055
|
}
|
|
3050
3056
|
return;
|
|
3051
3057
|
}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
profileBlockContents,
|
|
28
28
|
renderMarkdownBlocksHtml,
|
|
29
29
|
treeToTemplateData
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GGZCJ2MS.js";
|
|
31
31
|
import {
|
|
32
32
|
anchorPoint,
|
|
33
33
|
base64ToUtf8,
|
|
@@ -1436,21 +1436,7 @@ var ESCAPE_RE = /\{\{([^{}]*)\}\}/g;
|
|
|
1436
1436
|
var ESCAPED_OPEN = " ESC_OPEN ";
|
|
1437
1437
|
var ESCAPED_CLOSE = " ESC_CLOSE ";
|
|
1438
1438
|
function collectImages(block) {
|
|
1439
|
-
|
|
1440
|
-
const out = [];
|
|
1441
|
-
const visit = (node) => {
|
|
1442
|
-
if (node.type === "image") {
|
|
1443
|
-
const img = node;
|
|
1444
|
-
out.push({ url: img.url ?? "", alt: img.alt ?? "" });
|
|
1445
|
-
}
|
|
1446
|
-
};
|
|
1447
|
-
for (const node of block.contents) {
|
|
1448
|
-
walkMarkdownTree(node, (n) => {
|
|
1449
|
-
visit(n);
|
|
1450
|
-
return;
|
|
1451
|
-
});
|
|
1452
|
-
}
|
|
1453
|
-
return out;
|
|
1439
|
+
return extractImages(block.contents).map((image) => ({ url: image.src, alt: image.alt }));
|
|
1454
1440
|
}
|
|
1455
1441
|
function collectListItems(block) {
|
|
1456
1442
|
if (!block.contents) return [];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertMarkdownDocumentWithinLimits,
|
|
3
3
|
parseMarkdown,
|
|
4
|
+
remarkWikiLinks,
|
|
4
5
|
toMdast
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PVFDR3XT.js";
|
|
6
7
|
import {
|
|
7
8
|
formatFrontmatterYaml,
|
|
8
9
|
getChildren,
|
|
@@ -171,7 +172,7 @@ function stringifyMarkdown(doc, options) {
|
|
|
171
172
|
let processor;
|
|
172
173
|
if (useDefaults) {
|
|
173
174
|
if (!defaultProcessor) {
|
|
174
|
-
defaultProcessor = unified().use(remarkGfm).use(remarkMath).use(remarkDirective).use(remarkStringify, {
|
|
175
|
+
defaultProcessor = unified().use(remarkWikiLinks).use(remarkGfm).use(remarkMath).use(remarkDirective).use(remarkStringify, {
|
|
175
176
|
bullet: "-",
|
|
176
177
|
bulletOrdered: ".",
|
|
177
178
|
emphasis: "*",
|
|
@@ -184,7 +185,7 @@ function stringifyMarkdown(doc, options) {
|
|
|
184
185
|
}
|
|
185
186
|
processor = defaultProcessor;
|
|
186
187
|
} else {
|
|
187
|
-
processor = unified();
|
|
188
|
+
processor = unified().use(remarkWikiLinks);
|
|
188
189
|
if (options?.gfm !== false) {
|
|
189
190
|
processor = processor.use(remarkGfm);
|
|
190
191
|
}
|
|
@@ -9,12 +9,64 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
coerceAnnotationValues,
|
|
11
11
|
parseFrontmatter,
|
|
12
|
-
parseHtmlToNodes
|
|
12
|
+
parseHtmlToNodes,
|
|
13
|
+
sanitizeUrl
|
|
13
14
|
} from "./chunk-MWSGNEH6.js";
|
|
14
15
|
import {
|
|
15
16
|
resolveIcon
|
|
16
17
|
} from "./chunk-CZ7AUSLI.js";
|
|
17
18
|
|
|
19
|
+
// src/markdown/wikiLinks.ts
|
|
20
|
+
function wikiLinkPath(target, extension = ".md") {
|
|
21
|
+
if (!target || target.length > 2048 || target !== target.trim()) return null;
|
|
22
|
+
if (/[\\%:#?<>"|*[\]]/u.test(target)) return null;
|
|
23
|
+
if ([...target].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127)) return null;
|
|
24
|
+
const parts = target.split("/");
|
|
25
|
+
if (parts.some(
|
|
26
|
+
(part) => !part || part === "." || part === ".." || part !== part.trim() || /[. ]$/.test(part) || part.length > 250 || /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(part)
|
|
27
|
+
))
|
|
28
|
+
return null;
|
|
29
|
+
return /\.(?:md|html?)$/i.test(target) ? target : `${target}${extension}`;
|
|
30
|
+
}
|
|
31
|
+
function parseWikiLink(value) {
|
|
32
|
+
const separator = value.indexOf("|");
|
|
33
|
+
const target = separator < 0 ? value : value.slice(0, separator);
|
|
34
|
+
if (!wikiLinkPath(target)) return null;
|
|
35
|
+
if (separator < 0) return { target };
|
|
36
|
+
const label = value.slice(separator + 1);
|
|
37
|
+
if (!label.trim() || label.length > 2048 || /[[\]|]/u.test(label) || [...label].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127))
|
|
38
|
+
return null;
|
|
39
|
+
return { target, label };
|
|
40
|
+
}
|
|
41
|
+
async function resolveWikiLinks(document, exists) {
|
|
42
|
+
const targets = /* @__PURE__ */ new Map();
|
|
43
|
+
function collect(node) {
|
|
44
|
+
if (node.type === "link" && node.wikiTarget !== void 0) {
|
|
45
|
+
const path = wikiLinkPath(node.wikiTarget);
|
|
46
|
+
if (path && targets.size < 256) targets.set(node.wikiTarget, path);
|
|
47
|
+
}
|
|
48
|
+
if ("children" in node) node.children.forEach(collect);
|
|
49
|
+
}
|
|
50
|
+
collect(document);
|
|
51
|
+
if (!targets.size) return document;
|
|
52
|
+
const urls = /* @__PURE__ */ new Map();
|
|
53
|
+
for (const [target, path] of targets) {
|
|
54
|
+
const result = await exists(target);
|
|
55
|
+
const url = typeof result === "string" ? sanitizeUrl(result, "link") : result ? path.split("/").map(encodeURIComponent).join("/") : null;
|
|
56
|
+
if (url) urls.set(target, url);
|
|
57
|
+
}
|
|
58
|
+
function project(node) {
|
|
59
|
+
if (node.type === "link" && node.wikiTarget !== void 0) {
|
|
60
|
+
const url = urls.get(node.wikiTarget) ?? "";
|
|
61
|
+
return node.url === url ? node : { ...node, url };
|
|
62
|
+
}
|
|
63
|
+
if (!("children" in node)) return node;
|
|
64
|
+
const children = node.children.map(project);
|
|
65
|
+
return children.every((child, index) => child === node.children[index]) ? node : { ...node, children };
|
|
66
|
+
}
|
|
67
|
+
return project(document);
|
|
68
|
+
}
|
|
69
|
+
|
|
18
70
|
// src/markdown/convert.ts
|
|
19
71
|
function convertPosition(pos) {
|
|
20
72
|
if (!pos) return void 0;
|
|
@@ -51,6 +103,46 @@ function posField(pos) {
|
|
|
51
103
|
function mdastPosField(pos) {
|
|
52
104
|
return pos ? { position: toMdastPosition(pos) } : {};
|
|
53
105
|
}
|
|
106
|
+
var PLAIN_IMAGE_ATTRIBUTES = /* @__PURE__ */ new Set(["src", "alt", "title", "width", "height"]);
|
|
107
|
+
function htmlPixels(value) {
|
|
108
|
+
if (value === void 0) return void 0;
|
|
109
|
+
const size = value.trim();
|
|
110
|
+
return /^\d+(?:\.\d+)?$/.test(size) && Number(size) > 0 ? Number(size) : null;
|
|
111
|
+
}
|
|
112
|
+
function imageFromHtml(rawHtml, htmlChildren) {
|
|
113
|
+
const nodes = htmlChildren.filter((node) => node.type !== "htmlText" || node.value.trim());
|
|
114
|
+
const img = nodes.length === 1 ? nodes[0] : void 0;
|
|
115
|
+
if (img?.type !== "htmlElement" || img.tagName !== "img" || img.children.length) return null;
|
|
116
|
+
const { src, alt, title } = img.attributes;
|
|
117
|
+
if (!src || Object.keys(img.attributes).some((name) => !PLAIN_IMAGE_ATTRIBUTES.has(name)))
|
|
118
|
+
return null;
|
|
119
|
+
const width = htmlPixels(img.attributes.width);
|
|
120
|
+
const height = htmlPixels(img.attributes.height);
|
|
121
|
+
if (width === null || height === null) return null;
|
|
122
|
+
return {
|
|
123
|
+
type: "image",
|
|
124
|
+
url: src,
|
|
125
|
+
...alt !== void 0 ? { alt } : {},
|
|
126
|
+
...title !== void 0 ? { title } : {},
|
|
127
|
+
...width !== void 0 ? { width } : {},
|
|
128
|
+
...height !== void 0 ? { height } : {},
|
|
129
|
+
rawHtml
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function sameImage(a, b) {
|
|
133
|
+
return a.url === b.url && (a.alt ?? "") === (b.alt ?? "") && (a.title ?? null) === (b.title ?? null) && a.width === b.width && a.height === b.height;
|
|
134
|
+
}
|
|
135
|
+
function escapeHtmlAttribute(value) {
|
|
136
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
137
|
+
}
|
|
138
|
+
function imageToHtml(node) {
|
|
139
|
+
if (node.rawHtml !== void 0) {
|
|
140
|
+
const written = imageFromHtml(node.rawHtml, parseHtmlToNodes(node.rawHtml));
|
|
141
|
+
if (written && sameImage(written, node)) return node.rawHtml;
|
|
142
|
+
}
|
|
143
|
+
const attribute = (name, value) => value === void 0 || value === null ? "" : ` ${name}="${escapeHtmlAttribute(String(value))}"`;
|
|
144
|
+
return `<img${attribute("alt", node.alt ?? "")}${attribute("src", node.url)}${attribute("width", node.width)}${attribute("height", node.height)}${attribute("title", node.title)}>`;
|
|
145
|
+
}
|
|
54
146
|
function extractText(node) {
|
|
55
147
|
if (node.value != null) return node.value;
|
|
56
148
|
if (node.children) {
|
|
@@ -261,7 +353,42 @@ function convertInlineChildren(children, parseHtml, applyIconSplit = true) {
|
|
|
261
353
|
const mentioned = coalesceMentions(result);
|
|
262
354
|
const repaired = recombineDirectiveTokens(mentioned);
|
|
263
355
|
const split = applyIconSplit ? splitInlineIcons(repaired) : repaired;
|
|
264
|
-
return foldPairedInlineHtml(split);
|
|
356
|
+
return foldPairedInlineHtml(parseHtml ? foldLoneInlineImages(split) : split);
|
|
357
|
+
}
|
|
358
|
+
var VOID_HTML_ELEMENTS = /* @__PURE__ */ new Set([
|
|
359
|
+
"area",
|
|
360
|
+
"base",
|
|
361
|
+
"br",
|
|
362
|
+
"col",
|
|
363
|
+
"embed",
|
|
364
|
+
"hr",
|
|
365
|
+
"img",
|
|
366
|
+
"input",
|
|
367
|
+
"link",
|
|
368
|
+
"meta",
|
|
369
|
+
"source",
|
|
370
|
+
"track",
|
|
371
|
+
"wbr"
|
|
372
|
+
]);
|
|
373
|
+
function foldLoneInlineImages(nodes) {
|
|
374
|
+
if (!nodes.some((n) => n.type === "htmlInline")) return nodes;
|
|
375
|
+
let open = 0;
|
|
376
|
+
return nodes.map((node) => {
|
|
377
|
+
if (node.type !== "htmlInline") return node;
|
|
378
|
+
const tag = /^<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*?(\/?)>$/.exec(node.rawHtml.trim());
|
|
379
|
+
if (!tag) return node;
|
|
380
|
+
const [, closing, name, selfClosing] = tag;
|
|
381
|
+
if (closing) {
|
|
382
|
+
open = Math.max(0, open - 1);
|
|
383
|
+
return node;
|
|
384
|
+
}
|
|
385
|
+
if (!VOID_HTML_ELEMENTS.has(name.toLowerCase()) && !selfClosing) {
|
|
386
|
+
open++;
|
|
387
|
+
return node;
|
|
388
|
+
}
|
|
389
|
+
const image = open === 0 ? imageFromHtml(node.rawHtml, node.htmlChildren) : null;
|
|
390
|
+
return image ? { ...image, ...posField(node.position) } : node;
|
|
391
|
+
});
|
|
265
392
|
}
|
|
266
393
|
var PAIRED_INLINE_HTML = /* @__PURE__ */ new Map([
|
|
267
394
|
["sup", "superscript"],
|
|
@@ -535,13 +662,14 @@ function convertBlockNode(node, parseHtml) {
|
|
|
535
662
|
children: (node.children ?? []).map((row, i) => convertTableRow(row, i === 0, parseHtml)),
|
|
536
663
|
...posField(pos)
|
|
537
664
|
};
|
|
538
|
-
case "html":
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
...posField(pos)
|
|
544
|
-
};
|
|
665
|
+
case "html": {
|
|
666
|
+
const rawHtml = node.value ?? "";
|
|
667
|
+
const htmlChildren = parseHtml ? parseHtmlToNodes(rawHtml) : [];
|
|
668
|
+
const image = parseHtml ? imageFromHtml(rawHtml, htmlChildren) : null;
|
|
669
|
+
if (image)
|
|
670
|
+
return { type: "paragraph", children: [{ ...image, ...posField(pos) }], ...posField(pos) };
|
|
671
|
+
return { type: "htmlBlock", rawHtml, htmlChildren, ...posField(pos) };
|
|
672
|
+
}
|
|
545
673
|
case "math":
|
|
546
674
|
return {
|
|
547
675
|
type: "math",
|
|
@@ -660,6 +788,18 @@ function convertInlineNode(node, parseHtml) {
|
|
|
660
788
|
value: node.value ?? "",
|
|
661
789
|
...posField(pos)
|
|
662
790
|
};
|
|
791
|
+
case "wikiLink": {
|
|
792
|
+
const wiki = parseWikiLink(node.value ?? "");
|
|
793
|
+
if (!wiki) return { type: "text", value: node.value ?? "", ...posField(pos) };
|
|
794
|
+
return {
|
|
795
|
+
type: "link",
|
|
796
|
+
wikiTarget: wiki.target,
|
|
797
|
+
...wiki.label !== void 0 ? { wikiLabel: wiki.label } : {},
|
|
798
|
+
url: "",
|
|
799
|
+
children: [{ type: "text", value: wiki.label ?? wiki.target }],
|
|
800
|
+
...posField(pos)
|
|
801
|
+
};
|
|
802
|
+
}
|
|
663
803
|
case "link":
|
|
664
804
|
return {
|
|
665
805
|
type: "link",
|
|
@@ -956,6 +1096,12 @@ function inlineToMdast(node) {
|
|
|
956
1096
|
...mdastPosField(node.position)
|
|
957
1097
|
};
|
|
958
1098
|
case "link":
|
|
1099
|
+
if (node.wikiTarget !== void 0)
|
|
1100
|
+
return {
|
|
1101
|
+
type: "wikiLink",
|
|
1102
|
+
value: node.wikiTarget + (node.wikiLabel !== void 0 ? `|${node.wikiLabel}` : ""),
|
|
1103
|
+
...mdastPosField(node.position)
|
|
1104
|
+
};
|
|
959
1105
|
return {
|
|
960
1106
|
type: "link",
|
|
961
1107
|
url: node.url,
|
|
@@ -964,6 +1110,8 @@ function inlineToMdast(node) {
|
|
|
964
1110
|
...mdastPosField(node.position)
|
|
965
1111
|
};
|
|
966
1112
|
case "image":
|
|
1113
|
+
if (node.rawHtml !== void 0 || node.width !== void 0 || node.height !== void 0)
|
|
1114
|
+
return { type: "html", value: imageToHtml(node), ...mdastPosField(node.position) };
|
|
967
1115
|
return {
|
|
968
1116
|
type: "image",
|
|
969
1117
|
url: node.url,
|
|
@@ -1176,6 +1324,76 @@ function utf8ByteLength(value, stopAfter) {
|
|
|
1176
1324
|
|
|
1177
1325
|
// src/markdown/parse.ts
|
|
1178
1326
|
import { unified } from "unified";
|
|
1327
|
+
|
|
1328
|
+
// src/markdown/remarkWikiLinks.ts
|
|
1329
|
+
function remarkWikiLinks() {
|
|
1330
|
+
const data = this.data();
|
|
1331
|
+
(data.micromarkExtensions ?? (data.micromarkExtensions = [])).push({
|
|
1332
|
+
text: {
|
|
1333
|
+
91: {
|
|
1334
|
+
name: "wikiLink",
|
|
1335
|
+
tokenize(effects, ok, nok) {
|
|
1336
|
+
let target = "";
|
|
1337
|
+
return start;
|
|
1338
|
+
function start(code) {
|
|
1339
|
+
effects.enter("wikiLink");
|
|
1340
|
+
effects.consume(code);
|
|
1341
|
+
return second;
|
|
1342
|
+
}
|
|
1343
|
+
function second(code) {
|
|
1344
|
+
if (code !== 91) return nok(code);
|
|
1345
|
+
effects.consume(code);
|
|
1346
|
+
return inside;
|
|
1347
|
+
}
|
|
1348
|
+
function inside(code) {
|
|
1349
|
+
if (code === 93) {
|
|
1350
|
+
effects.consume(code);
|
|
1351
|
+
return close;
|
|
1352
|
+
}
|
|
1353
|
+
if (code === null || code < 0 || code === 91 || target.length >= 4097) return nok(code);
|
|
1354
|
+
target += String.fromCodePoint(code);
|
|
1355
|
+
effects.consume(code);
|
|
1356
|
+
return inside;
|
|
1357
|
+
}
|
|
1358
|
+
function close(code) {
|
|
1359
|
+
if (code !== 93 || !parseWikiLink(target.replace(/\\\|/g, "|"))) return nok(code);
|
|
1360
|
+
effects.consume(code);
|
|
1361
|
+
effects.exit("wikiLink");
|
|
1362
|
+
return ok;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
(data.fromMarkdownExtensions ?? (data.fromMarkdownExtensions = [])).push({
|
|
1369
|
+
enter: {
|
|
1370
|
+
wikiLink(token) {
|
|
1371
|
+
this.enter(
|
|
1372
|
+
{
|
|
1373
|
+
type: "wikiLink",
|
|
1374
|
+
value: this.sliceSerialize(token).slice(2, -2).replace(/\\\|/g, "|")
|
|
1375
|
+
},
|
|
1376
|
+
token
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
exit: {
|
|
1381
|
+
wikiLink(token) {
|
|
1382
|
+
this.exit(token);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
(data.toMarkdownExtensions ?? (data.toMarkdownExtensions = [])).push({
|
|
1387
|
+
handlers: {
|
|
1388
|
+
wikiLink(node, _parent, state) {
|
|
1389
|
+
const value = state.stack.includes("tableCell") ? node.value.replace(/\|/g, "\\|") : node.value;
|
|
1390
|
+
return `[[${value}]]`;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
// src/markdown/parse.ts
|
|
1179
1397
|
import remarkParse from "remark-parse";
|
|
1180
1398
|
import remarkGfm from "remark-gfm";
|
|
1181
1399
|
import remarkMath from "remark-math";
|
|
@@ -1278,11 +1496,11 @@ function parseMarkdown(markdown, options) {
|
|
|
1278
1496
|
let processor;
|
|
1279
1497
|
if (useDefaults) {
|
|
1280
1498
|
if (!defaultProcessor) {
|
|
1281
|
-
defaultProcessor = unified().use(remarkParse).use(remarkGfm).use(remarkMath).use(remarkDollarMathRules).use(remarkDirective).use(remarkFrontmatter, ["yaml"]);
|
|
1499
|
+
defaultProcessor = unified().use(remarkWikiLinks).use(remarkParse).use(remarkGfm).use(remarkMath).use(remarkDollarMathRules).use(remarkDirective).use(remarkFrontmatter, ["yaml"]);
|
|
1282
1500
|
}
|
|
1283
1501
|
processor = defaultProcessor;
|
|
1284
1502
|
} else {
|
|
1285
|
-
processor = unified().use(remarkParse);
|
|
1503
|
+
processor = unified().use(remarkWikiLinks).use(remarkParse);
|
|
1286
1504
|
if (options?.gfm !== false) {
|
|
1287
1505
|
processor = processor.use(remarkGfm);
|
|
1288
1506
|
}
|
|
@@ -1314,6 +1532,10 @@ function parseMarkdown(markdown, options) {
|
|
|
1314
1532
|
}
|
|
1315
1533
|
|
|
1316
1534
|
export {
|
|
1535
|
+
wikiLinkPath,
|
|
1536
|
+
parseWikiLink,
|
|
1537
|
+
resolveWikiLinks,
|
|
1538
|
+
remarkWikiLinks,
|
|
1317
1539
|
parsePandocAttrTokens,
|
|
1318
1540
|
serializePandocAttributes,
|
|
1319
1541
|
fromMdast,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-FTN6SGW5.js";
|
|
4
4
|
import {
|
|
5
5
|
applySavedPresentation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UN6S5OID.js";
|
|
7
7
|
import {
|
|
8
8
|
SHAPE_NAMES,
|
|
9
9
|
buildChartData,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
templateRegistry,
|
|
33
33
|
writeCustomTemplatesToFrontmatter,
|
|
34
34
|
writeCustomThemesToFrontmatter
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-I3ENXLAN.js";
|
|
36
36
|
import {
|
|
37
37
|
ASCII_TREE_VOCAB,
|
|
38
38
|
ASCII_VOCAB,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
toCells,
|
|
54
54
|
toGrid,
|
|
55
55
|
traceBoxes
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-GGZCJ2MS.js";
|
|
57
57
|
import {
|
|
58
58
|
iconMarker
|
|
59
59
|
} from "./chunk-7ZAAICW4.js";
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
} from "./chunk-L7QZORLB.js";
|
|
87
87
|
import {
|
|
88
88
|
parseMarkdown
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-PVFDR3XT.js";
|
|
90
90
|
import {
|
|
91
91
|
TABLE_FED_TEMPLATES,
|
|
92
92
|
TEMPLATE_ALIASES,
|
|
@@ -877,10 +877,14 @@ function extractBlockImages(contents) {
|
|
|
877
877
|
}
|
|
878
878
|
}
|
|
879
879
|
function walk(node) {
|
|
880
|
-
if (
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
880
|
+
if (node.type === "image") {
|
|
881
|
+
if (node.url) {
|
|
882
|
+
images.push({
|
|
883
|
+
src: node.url,
|
|
884
|
+
alt: node.alt ?? "",
|
|
885
|
+
...node.width !== void 0 ? { width: node.width } : {},
|
|
886
|
+
...node.height !== void 0 ? { height: node.height } : {}
|
|
887
|
+
});
|
|
884
888
|
}
|
|
885
889
|
}
|
|
886
890
|
if ("type" in node && (node.type === "htmlBlock" || node.type === "htmlInline")) {
|