@bendyline/squisq 0.1.1
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/Types-sh2VRxfo.d.ts +15 -0
- package/dist/chunk-7UDSRZKG.js +103 -0
- package/dist/chunk-7UDSRZKG.js.map +1 -0
- package/dist/chunk-O5HCIUAD.js +577 -0
- package/dist/chunk-O5HCIUAD.js.map +1 -0
- package/dist/chunk-PJ7AODIM.js +3040 -0
- package/dist/chunk-PJ7AODIM.js.map +1 -0
- package/dist/chunk-QWVRN6I4.js +81 -0
- package/dist/chunk-QWVRN6I4.js.map +1 -0
- package/dist/chunk-S4F2RY37.js +92 -0
- package/dist/chunk-S4F2RY37.js.map +1 -0
- package/dist/chunk-URU6QMLY.js +888 -0
- package/dist/chunk-URU6QMLY.js.map +1 -0
- package/dist/chunk-VJN7UB2Z.js +145 -0
- package/dist/chunk-VJN7UB2Z.js.map +1 -0
- package/dist/doc/index.d.ts +3 -0
- package/dist/doc/index.js +126 -0
- package/dist/doc/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +217 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown/index.d.ts +237 -0
- package/dist/markdown/index.js +33 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/schemas/index.d.ts +70 -0
- package/dist/schemas/index.js +61 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/spatial/index.d.ts +111 -0
- package/dist/spatial/index.js +25 -0
- package/dist/spatial/index.js.map +1 -0
- package/dist/storage/index.d.ts +91 -0
- package/dist/storage/index.js +11 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/story/index.d.ts +691 -0
- package/dist/story/index.js +126 -0
- package/dist/story/index.js.map +1 -0
- package/dist/themeLibrary-DySHPcgj.d.ts +1352 -0
- package/dist/types-DHiv_Pnm.d.ts +496 -0
- package/package.json +91 -0
- package/src/__tests__/animationUtils.test.ts +77 -0
- package/src/__tests__/geohash.test.ts +109 -0
- package/src/__tests__/getLayers.test.ts +200 -0
- package/src/__tests__/haversine.test.ts +63 -0
- package/src/__tests__/localForageAdapter.test.ts +155 -0
- package/src/__tests__/markdown.test.ts +806 -0
- package/src/__tests__/markdownToDoc.test.ts +374 -0
- package/src/__tests__/storage.test.ts +60 -0
- package/src/__tests__/templates.test.ts +247 -0
- package/src/doc/docToMarkdown.ts +98 -0
- package/src/doc/getLayers.ts +152 -0
- package/src/doc/index.ts +8 -0
- package/src/doc/markdownToDoc.ts +277 -0
- package/src/doc/templates/accentImage.ts +338 -0
- package/src/doc/templates/captionUtils.ts +33 -0
- package/src/doc/templates/comparisonBar.ts +140 -0
- package/src/doc/templates/coverBlock.ts +156 -0
- package/src/doc/templates/dateEvent.ts +122 -0
- package/src/doc/templates/definitionCard.ts +129 -0
- package/src/doc/templates/factCard.ts +114 -0
- package/src/doc/templates/fullBleedQuote.ts +59 -0
- package/src/doc/templates/imageWithCaption.ts +167 -0
- package/src/doc/templates/index.ts +571 -0
- package/src/doc/templates/listBlock.ts +101 -0
- package/src/doc/templates/mapBlock.ts +132 -0
- package/src/doc/templates/persistentLayers.ts +522 -0
- package/src/doc/templates/photoGrid.ts +199 -0
- package/src/doc/templates/pullQuote.ts +119 -0
- package/src/doc/templates/quoteBlock.ts +112 -0
- package/src/doc/templates/sectionHeader.ts +105 -0
- package/src/doc/templates/statHighlight.ts +113 -0
- package/src/doc/templates/titleBlock.ts +100 -0
- package/src/doc/templates/twoColumn.ts +239 -0
- package/src/doc/templates/videoPullQuote.ts +128 -0
- package/src/doc/templates/videoWithCaption.ts +126 -0
- package/src/doc/utils/animationUtils.ts +135 -0
- package/src/doc/utils/themeUtils.ts +139 -0
- package/src/index.ts +5 -0
- package/src/markdown/convert.ts +897 -0
- package/src/markdown/htmlParse.ts +212 -0
- package/src/markdown/index.ts +110 -0
- package/src/markdown/parse.ts +103 -0
- package/src/markdown/stringify.ts +122 -0
- package/src/markdown/types.ts +605 -0
- package/src/markdown/utils.ts +165 -0
- package/src/ngeohash.d.ts +11 -0
- package/src/schemas/BlockTemplates.ts +706 -0
- package/src/schemas/Doc.ts +565 -0
- package/src/schemas/LayoutStrategy.ts +178 -0
- package/src/schemas/MediaProvider.ts +70 -0
- package/src/schemas/Theme.ts +235 -0
- package/src/schemas/Types.ts +15 -0
- package/src/schemas/Viewport.ts +91 -0
- package/src/schemas/index.ts +14 -0
- package/src/schemas/themeLibrary.ts +492 -0
- package/src/spatial/Geohash.ts +168 -0
- package/src/spatial/Haversine.ts +59 -0
- package/src/spatial/index.ts +2 -0
- package/src/storage/LocalForageAdapter.ts +103 -0
- package/src/storage/LocalStorageAdapter.ts +57 -0
- package/src/storage/MemoryStorageAdapter.ts +37 -0
- package/src/storage/Storage.ts +28 -0
- package/src/storage/index.ts +5 -0
|
@@ -0,0 +1,888 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseFrontmatter
|
|
3
|
+
} from "./chunk-QWVRN6I4.js";
|
|
4
|
+
|
|
5
|
+
// src/markdown/parse.ts
|
|
6
|
+
import { unified } from "unified";
|
|
7
|
+
import remarkParse from "remark-parse";
|
|
8
|
+
import remarkGfm from "remark-gfm";
|
|
9
|
+
import remarkMath from "remark-math";
|
|
10
|
+
import remarkDirective from "remark-directive";
|
|
11
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
12
|
+
|
|
13
|
+
// src/markdown/htmlParse.ts
|
|
14
|
+
import { fromHtml } from "hast-util-from-html";
|
|
15
|
+
var HAST_PROP_TO_ATTR = {
|
|
16
|
+
className: "class",
|
|
17
|
+
htmlFor: "for",
|
|
18
|
+
httpEquiv: "http-equiv",
|
|
19
|
+
acceptCharset: "accept-charset"
|
|
20
|
+
};
|
|
21
|
+
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
22
|
+
"area",
|
|
23
|
+
"base",
|
|
24
|
+
"br",
|
|
25
|
+
"col",
|
|
26
|
+
"embed",
|
|
27
|
+
"hr",
|
|
28
|
+
"img",
|
|
29
|
+
"input",
|
|
30
|
+
"link",
|
|
31
|
+
"meta",
|
|
32
|
+
"param",
|
|
33
|
+
"source",
|
|
34
|
+
"track",
|
|
35
|
+
"wbr"
|
|
36
|
+
]);
|
|
37
|
+
function propertyToAttribute(prop) {
|
|
38
|
+
if (HAST_PROP_TO_ATTR[prop]) return HAST_PROP_TO_ATTR[prop];
|
|
39
|
+
if (prop.length > 4 && prop.startsWith("data") && prop[4] >= "A" && prop[4] <= "Z") {
|
|
40
|
+
return "data-" + prop.slice(4).replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^-/, "");
|
|
41
|
+
}
|
|
42
|
+
if (prop.length > 4 && prop.startsWith("aria") && prop[4] >= "A" && prop[4] <= "Z") {
|
|
43
|
+
return "aria-" + prop.slice(4).replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^-/, "");
|
|
44
|
+
}
|
|
45
|
+
return prop.toLowerCase();
|
|
46
|
+
}
|
|
47
|
+
function convertHastProperties(properties) {
|
|
48
|
+
const attrs = {};
|
|
49
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
50
|
+
if (value === false || value === void 0 || value === null) continue;
|
|
51
|
+
const attrName = propertyToAttribute(key);
|
|
52
|
+
if (value === true) {
|
|
53
|
+
attrs[attrName] = "";
|
|
54
|
+
} else if (Array.isArray(value)) {
|
|
55
|
+
attrs[attrName] = value.join(" ");
|
|
56
|
+
} else {
|
|
57
|
+
attrs[attrName] = String(value);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return attrs;
|
|
61
|
+
}
|
|
62
|
+
function hastChildrenToNodes(children) {
|
|
63
|
+
const result = [];
|
|
64
|
+
for (const child of children) {
|
|
65
|
+
const node = hastNodeToHtmlNode(child);
|
|
66
|
+
if (node) result.push(node);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
function hastNodeToHtmlNode(node) {
|
|
71
|
+
switch (node.type) {
|
|
72
|
+
case "element": {
|
|
73
|
+
const tagName = node.tagName;
|
|
74
|
+
const properties = node.properties ?? {};
|
|
75
|
+
const children = node.children ?? [];
|
|
76
|
+
return {
|
|
77
|
+
type: "htmlElement",
|
|
78
|
+
tagName,
|
|
79
|
+
attributes: convertHastProperties(properties),
|
|
80
|
+
children: hastChildrenToNodes(children),
|
|
81
|
+
selfClosing: VOID_ELEMENTS.has(tagName) && children.length === 0
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
case "text":
|
|
85
|
+
return {
|
|
86
|
+
type: "htmlText",
|
|
87
|
+
value: node.value
|
|
88
|
+
};
|
|
89
|
+
case "comment":
|
|
90
|
+
return {
|
|
91
|
+
type: "htmlComment",
|
|
92
|
+
value: node.value
|
|
93
|
+
};
|
|
94
|
+
case "doctype":
|
|
95
|
+
return null;
|
|
96
|
+
default:
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function parseHtmlToNodes(html) {
|
|
101
|
+
if (!html || !html.trim()) return [];
|
|
102
|
+
try {
|
|
103
|
+
const tree = fromHtml(html, { fragment: true });
|
|
104
|
+
return hastChildrenToNodes(tree.children);
|
|
105
|
+
} catch {
|
|
106
|
+
return [{ type: "htmlText", value: html }];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function escapeHtmlAttr(value) {
|
|
110
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
111
|
+
}
|
|
112
|
+
function stringifyNode(node) {
|
|
113
|
+
switch (node.type) {
|
|
114
|
+
case "htmlElement": {
|
|
115
|
+
const attrs = Object.entries(node.attributes).map(([k, v]) => v === "" ? k : `${k}="${escapeHtmlAttr(v)}"`).join(" ");
|
|
116
|
+
const open = attrs ? `<${node.tagName} ${attrs}>` : `<${node.tagName}>`;
|
|
117
|
+
if (node.selfClosing) return open;
|
|
118
|
+
const inner = node.children.map(stringifyNode).join("");
|
|
119
|
+
return `${open}${inner}</${node.tagName}>`;
|
|
120
|
+
}
|
|
121
|
+
case "htmlText":
|
|
122
|
+
return node.value;
|
|
123
|
+
case "htmlComment":
|
|
124
|
+
return `<!--${node.value}-->`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function stringifyHtmlNodes(nodes) {
|
|
128
|
+
return nodes.map(stringifyNode).join("");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/markdown/convert.ts
|
|
132
|
+
function convertPosition(pos) {
|
|
133
|
+
if (!pos) return void 0;
|
|
134
|
+
return {
|
|
135
|
+
start: {
|
|
136
|
+
line: pos.start.line,
|
|
137
|
+
column: pos.start.column,
|
|
138
|
+
...pos.start.offset != null ? { offset: pos.start.offset } : {}
|
|
139
|
+
},
|
|
140
|
+
end: {
|
|
141
|
+
line: pos.end.line,
|
|
142
|
+
column: pos.end.column,
|
|
143
|
+
...pos.end.offset != null ? { offset: pos.end.offset } : {}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function toMdastPosition(pos) {
|
|
148
|
+
return {
|
|
149
|
+
start: {
|
|
150
|
+
line: pos.start.line,
|
|
151
|
+
column: pos.start.column,
|
|
152
|
+
...pos.start.offset != null ? { offset: pos.start.offset } : {}
|
|
153
|
+
},
|
|
154
|
+
end: {
|
|
155
|
+
line: pos.end.line,
|
|
156
|
+
column: pos.end.column,
|
|
157
|
+
...pos.end.offset != null ? { offset: pos.end.offset } : {}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function posField(pos) {
|
|
162
|
+
return pos ? { position: pos } : {};
|
|
163
|
+
}
|
|
164
|
+
function mdastPosField(pos) {
|
|
165
|
+
return pos ? { position: toMdastPosition(pos) } : {};
|
|
166
|
+
}
|
|
167
|
+
function extractText(node) {
|
|
168
|
+
if (node.value != null) return node.value;
|
|
169
|
+
if (node.children) {
|
|
170
|
+
return node.children.map(extractText).join("");
|
|
171
|
+
}
|
|
172
|
+
return "";
|
|
173
|
+
}
|
|
174
|
+
var TEMPLATE_ANNOTATION_RE = /\s*\{\[([^\]]+)\]\}\s*$/;
|
|
175
|
+
function extractTemplateAnnotation(children) {
|
|
176
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
177
|
+
const child = children[i];
|
|
178
|
+
if (child.type === "text") {
|
|
179
|
+
const match = child.value.match(TEMPLATE_ANNOTATION_RE);
|
|
180
|
+
if (match) {
|
|
181
|
+
const inner = match[1].trim();
|
|
182
|
+
const annotation = parseAnnotationTokens(inner);
|
|
183
|
+
const stripped = child.value.slice(0, match.index).replace(/\s+$/, "");
|
|
184
|
+
if (stripped) {
|
|
185
|
+
child.value = stripped;
|
|
186
|
+
} else {
|
|
187
|
+
children.splice(i, 1);
|
|
188
|
+
}
|
|
189
|
+
return annotation;
|
|
190
|
+
}
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
function parseAnnotationTokens(inner) {
|
|
198
|
+
const tokens = inner.split(/\s+/);
|
|
199
|
+
const template = tokens[0];
|
|
200
|
+
const params = {};
|
|
201
|
+
for (let i = 1; i < tokens.length; i++) {
|
|
202
|
+
const eqIdx = tokens[i].indexOf("=");
|
|
203
|
+
if (eqIdx > 0) {
|
|
204
|
+
params[tokens[i].slice(0, eqIdx)] = tokens[i].slice(eqIdx + 1);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const result = { template };
|
|
208
|
+
if (Object.keys(params).length > 0) {
|
|
209
|
+
result.params = params;
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
function serializeTemplateAnnotation(annotation) {
|
|
214
|
+
let result = `{[${annotation.template}`;
|
|
215
|
+
if (annotation.params) {
|
|
216
|
+
for (const [key, value] of Object.entries(annotation.params)) {
|
|
217
|
+
result += ` ${key}=${value}`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
result += "]}";
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
function fromMdast(root, options) {
|
|
224
|
+
const doParseHtml = options?.parseHtml !== false;
|
|
225
|
+
return {
|
|
226
|
+
type: "document",
|
|
227
|
+
children: convertBlockChildren(root.children ?? [], doParseHtml),
|
|
228
|
+
...posField(convertPosition(root.position))
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function convertBlockChildren(children, parseHtml) {
|
|
232
|
+
const result = [];
|
|
233
|
+
for (const child of children) {
|
|
234
|
+
const node = convertBlockNode(child, parseHtml);
|
|
235
|
+
if (node) result.push(node);
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
function convertInlineChildren(children, parseHtml) {
|
|
240
|
+
const result = [];
|
|
241
|
+
for (const child of children) {
|
|
242
|
+
const node = convertInlineNode(child, parseHtml);
|
|
243
|
+
if (node) result.push(node);
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
function convertBlockNode(node, parseHtml) {
|
|
248
|
+
const pos = convertPosition(node.position);
|
|
249
|
+
switch (node.type) {
|
|
250
|
+
case "heading": {
|
|
251
|
+
const headingChildren = convertInlineChildren(node.children ?? [], parseHtml);
|
|
252
|
+
const annotation = extractTemplateAnnotation(headingChildren);
|
|
253
|
+
const result = {
|
|
254
|
+
type: "heading",
|
|
255
|
+
depth: node.depth ?? 1,
|
|
256
|
+
children: headingChildren,
|
|
257
|
+
...posField(pos)
|
|
258
|
+
};
|
|
259
|
+
if (annotation) {
|
|
260
|
+
result.templateAnnotation = annotation;
|
|
261
|
+
}
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
case "paragraph":
|
|
265
|
+
return {
|
|
266
|
+
type: "paragraph",
|
|
267
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
268
|
+
...posField(pos)
|
|
269
|
+
};
|
|
270
|
+
case "blockquote":
|
|
271
|
+
return {
|
|
272
|
+
type: "blockquote",
|
|
273
|
+
children: convertBlockChildren(node.children ?? [], parseHtml),
|
|
274
|
+
...posField(pos)
|
|
275
|
+
};
|
|
276
|
+
case "list":
|
|
277
|
+
return {
|
|
278
|
+
type: "list",
|
|
279
|
+
ordered: node.ordered ?? false,
|
|
280
|
+
...node.start != null ? { start: node.start } : {},
|
|
281
|
+
...node.spread != null ? { spread: node.spread } : {},
|
|
282
|
+
children: (node.children ?? []).map((item) => convertListItem(item, parseHtml)),
|
|
283
|
+
...posField(pos)
|
|
284
|
+
};
|
|
285
|
+
case "code":
|
|
286
|
+
return {
|
|
287
|
+
type: "code",
|
|
288
|
+
...node.lang != null ? { lang: node.lang } : {},
|
|
289
|
+
...node.meta != null ? { meta: node.meta } : {},
|
|
290
|
+
value: node.value ?? "",
|
|
291
|
+
...posField(pos)
|
|
292
|
+
};
|
|
293
|
+
case "thematicBreak":
|
|
294
|
+
return {
|
|
295
|
+
type: "thematicBreak",
|
|
296
|
+
...posField(pos)
|
|
297
|
+
};
|
|
298
|
+
case "table":
|
|
299
|
+
return {
|
|
300
|
+
type: "table",
|
|
301
|
+
...node.align ? { align: node.align.map((a) => a) } : {},
|
|
302
|
+
children: (node.children ?? []).map((row, i) => convertTableRow(row, i === 0, parseHtml)),
|
|
303
|
+
...posField(pos)
|
|
304
|
+
};
|
|
305
|
+
case "html":
|
|
306
|
+
return {
|
|
307
|
+
type: "htmlBlock",
|
|
308
|
+
rawHtml: node.value ?? "",
|
|
309
|
+
htmlChildren: parseHtml ? parseHtmlToNodes(node.value ?? "") : [],
|
|
310
|
+
...posField(pos)
|
|
311
|
+
};
|
|
312
|
+
case "math":
|
|
313
|
+
return {
|
|
314
|
+
type: "math",
|
|
315
|
+
value: node.value ?? "",
|
|
316
|
+
...node.meta != null ? { meta: node.meta } : {},
|
|
317
|
+
...posField(pos)
|
|
318
|
+
};
|
|
319
|
+
case "definition":
|
|
320
|
+
return {
|
|
321
|
+
type: "definition",
|
|
322
|
+
identifier: node.identifier ?? "",
|
|
323
|
+
...node.label != null ? { label: node.label } : {},
|
|
324
|
+
url: node.url ?? "",
|
|
325
|
+
...node.title != null ? { title: node.title } : {},
|
|
326
|
+
...posField(pos)
|
|
327
|
+
};
|
|
328
|
+
case "footnoteDefinition":
|
|
329
|
+
return {
|
|
330
|
+
type: "footnoteDefinition",
|
|
331
|
+
identifier: node.identifier ?? "",
|
|
332
|
+
...node.label != null ? { label: node.label } : {},
|
|
333
|
+
children: convertBlockChildren(node.children ?? [], parseHtml),
|
|
334
|
+
...posField(pos)
|
|
335
|
+
};
|
|
336
|
+
case "containerDirective": {
|
|
337
|
+
const allChildren = node.children ?? [];
|
|
338
|
+
let label;
|
|
339
|
+
let contentChildren = allChildren;
|
|
340
|
+
if (allChildren.length > 0 && allChildren[0].type === "paragraph" && allChildren[0].data?.directiveLabel === true) {
|
|
341
|
+
label = extractText(allChildren[0]);
|
|
342
|
+
contentChildren = allChildren.slice(1);
|
|
343
|
+
}
|
|
344
|
+
return {
|
|
345
|
+
type: "containerDirective",
|
|
346
|
+
name: node.name ?? "",
|
|
347
|
+
...label ? { label } : {},
|
|
348
|
+
...node.attributes && Object.keys(node.attributes).length > 0 ? { attributes: node.attributes } : {},
|
|
349
|
+
children: convertBlockChildren(contentChildren, parseHtml),
|
|
350
|
+
...posField(pos)
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
case "leafDirective":
|
|
354
|
+
return {
|
|
355
|
+
type: "leafDirective",
|
|
356
|
+
name: node.name ?? "",
|
|
357
|
+
...node.attributes && Object.keys(node.attributes).length > 0 ? { attributes: node.attributes } : {},
|
|
358
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
359
|
+
...posField(pos)
|
|
360
|
+
};
|
|
361
|
+
case "yaml":
|
|
362
|
+
return null;
|
|
363
|
+
default:
|
|
364
|
+
if (typeof console !== "undefined") {
|
|
365
|
+
console.warn(`[squisq/markdown] Unknown mdast block node type: "${node.type}"`);
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
function convertListItem(node, parseHtml) {
|
|
371
|
+
const pos = convertPosition(node.position);
|
|
372
|
+
return {
|
|
373
|
+
type: "listItem",
|
|
374
|
+
...node.checked != null ? { checked: node.checked } : {},
|
|
375
|
+
...node.spread != null ? { spread: node.spread } : {},
|
|
376
|
+
children: convertBlockChildren(node.children ?? [], parseHtml),
|
|
377
|
+
...posField(pos)
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function convertTableRow(node, isHeader, parseHtml) {
|
|
381
|
+
const pos = convertPosition(node.position);
|
|
382
|
+
return {
|
|
383
|
+
type: "tableRow",
|
|
384
|
+
children: (node.children ?? []).map((cell) => convertTableCell(cell, isHeader, parseHtml)),
|
|
385
|
+
...posField(pos)
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function convertTableCell(node, isHeader, parseHtml) {
|
|
389
|
+
const pos = convertPosition(node.position);
|
|
390
|
+
return {
|
|
391
|
+
type: "tableCell",
|
|
392
|
+
...isHeader ? { isHeader: true } : {},
|
|
393
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
394
|
+
...posField(pos)
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function convertInlineNode(node, parseHtml) {
|
|
398
|
+
const pos = convertPosition(node.position);
|
|
399
|
+
switch (node.type) {
|
|
400
|
+
case "text":
|
|
401
|
+
return {
|
|
402
|
+
type: "text",
|
|
403
|
+
value: node.value ?? "",
|
|
404
|
+
...posField(pos)
|
|
405
|
+
};
|
|
406
|
+
case "emphasis":
|
|
407
|
+
return {
|
|
408
|
+
type: "emphasis",
|
|
409
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
410
|
+
...posField(pos)
|
|
411
|
+
};
|
|
412
|
+
case "strong":
|
|
413
|
+
return {
|
|
414
|
+
type: "strong",
|
|
415
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
416
|
+
...posField(pos)
|
|
417
|
+
};
|
|
418
|
+
case "delete":
|
|
419
|
+
return {
|
|
420
|
+
type: "delete",
|
|
421
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
422
|
+
...posField(pos)
|
|
423
|
+
};
|
|
424
|
+
case "inlineCode":
|
|
425
|
+
return {
|
|
426
|
+
type: "inlineCode",
|
|
427
|
+
value: node.value ?? "",
|
|
428
|
+
...posField(pos)
|
|
429
|
+
};
|
|
430
|
+
case "link":
|
|
431
|
+
return {
|
|
432
|
+
type: "link",
|
|
433
|
+
url: node.url ?? "",
|
|
434
|
+
...node.title != null ? { title: node.title } : {},
|
|
435
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
436
|
+
...posField(pos)
|
|
437
|
+
};
|
|
438
|
+
case "image":
|
|
439
|
+
return {
|
|
440
|
+
type: "image",
|
|
441
|
+
url: node.url ?? "",
|
|
442
|
+
...node.alt != null ? { alt: node.alt } : {},
|
|
443
|
+
...node.title != null ? { title: node.title } : {},
|
|
444
|
+
...posField(pos)
|
|
445
|
+
};
|
|
446
|
+
case "break":
|
|
447
|
+
return {
|
|
448
|
+
type: "break",
|
|
449
|
+
...posField(pos)
|
|
450
|
+
};
|
|
451
|
+
case "html":
|
|
452
|
+
return {
|
|
453
|
+
type: "htmlInline",
|
|
454
|
+
rawHtml: node.value ?? "",
|
|
455
|
+
htmlChildren: parseHtml ? parseHtmlToNodes(node.value ?? "") : [],
|
|
456
|
+
...posField(pos)
|
|
457
|
+
};
|
|
458
|
+
case "inlineMath":
|
|
459
|
+
return {
|
|
460
|
+
type: "inlineMath",
|
|
461
|
+
value: node.value ?? "",
|
|
462
|
+
...posField(pos)
|
|
463
|
+
};
|
|
464
|
+
case "footnoteReference":
|
|
465
|
+
return {
|
|
466
|
+
type: "footnoteReference",
|
|
467
|
+
identifier: node.identifier ?? "",
|
|
468
|
+
...node.label != null ? { label: node.label } : {},
|
|
469
|
+
...posField(pos)
|
|
470
|
+
};
|
|
471
|
+
case "linkReference":
|
|
472
|
+
return {
|
|
473
|
+
type: "linkReference",
|
|
474
|
+
identifier: node.identifier ?? "",
|
|
475
|
+
...node.label != null ? { label: node.label } : {},
|
|
476
|
+
referenceType: node.referenceType ?? "full",
|
|
477
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
478
|
+
...posField(pos)
|
|
479
|
+
};
|
|
480
|
+
case "imageReference":
|
|
481
|
+
return {
|
|
482
|
+
type: "imageReference",
|
|
483
|
+
identifier: node.identifier ?? "",
|
|
484
|
+
...node.label != null ? { label: node.label } : {},
|
|
485
|
+
referenceType: node.referenceType ?? "full",
|
|
486
|
+
...node.alt != null ? { alt: node.alt } : {},
|
|
487
|
+
...posField(pos)
|
|
488
|
+
};
|
|
489
|
+
case "textDirective":
|
|
490
|
+
return {
|
|
491
|
+
type: "textDirective",
|
|
492
|
+
name: node.name ?? "",
|
|
493
|
+
...node.attributes && Object.keys(node.attributes).length > 0 ? { attributes: node.attributes } : {},
|
|
494
|
+
children: convertInlineChildren(node.children ?? [], parseHtml),
|
|
495
|
+
...posField(pos)
|
|
496
|
+
};
|
|
497
|
+
default:
|
|
498
|
+
if (typeof console !== "undefined") {
|
|
499
|
+
console.warn(`[squisq/markdown] Unknown mdast inline node type: "${node.type}"`);
|
|
500
|
+
}
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function toMdast(doc) {
|
|
505
|
+
return {
|
|
506
|
+
type: "root",
|
|
507
|
+
children: doc.children.map((n) => blockToMdast(n)),
|
|
508
|
+
...mdastPosField(doc.position)
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
function blockToMdast(node) {
|
|
512
|
+
switch (node.type) {
|
|
513
|
+
case "heading": {
|
|
514
|
+
const mdastChildren = node.children.map(inlineToMdast);
|
|
515
|
+
if (node.templateAnnotation) {
|
|
516
|
+
const suffix = serializeTemplateAnnotation(node.templateAnnotation);
|
|
517
|
+
const lastChild = mdastChildren[mdastChildren.length - 1];
|
|
518
|
+
if (lastChild && lastChild.type === "text") {
|
|
519
|
+
lastChild.value = (lastChild.value ?? "") + " " + suffix;
|
|
520
|
+
} else {
|
|
521
|
+
mdastChildren.push({ type: "text", value: " " + suffix });
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return {
|
|
525
|
+
type: "heading",
|
|
526
|
+
depth: node.depth,
|
|
527
|
+
children: mdastChildren,
|
|
528
|
+
...mdastPosField(node.position)
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
case "paragraph":
|
|
532
|
+
return {
|
|
533
|
+
type: "paragraph",
|
|
534
|
+
children: node.children.map(inlineToMdast),
|
|
535
|
+
...mdastPosField(node.position)
|
|
536
|
+
};
|
|
537
|
+
case "blockquote":
|
|
538
|
+
return {
|
|
539
|
+
type: "blockquote",
|
|
540
|
+
children: node.children.map(blockToMdast),
|
|
541
|
+
...mdastPosField(node.position)
|
|
542
|
+
};
|
|
543
|
+
case "list":
|
|
544
|
+
return {
|
|
545
|
+
type: "list",
|
|
546
|
+
ordered: node.ordered,
|
|
547
|
+
...node.start != null ? { start: node.start } : {},
|
|
548
|
+
...node.spread != null ? { spread: node.spread } : {},
|
|
549
|
+
children: node.children.map(listItemToMdast),
|
|
550
|
+
...mdastPosField(node.position)
|
|
551
|
+
};
|
|
552
|
+
case "code":
|
|
553
|
+
return {
|
|
554
|
+
type: "code",
|
|
555
|
+
...node.lang != null ? { lang: node.lang } : {},
|
|
556
|
+
...node.meta != null ? { meta: node.meta } : {},
|
|
557
|
+
value: node.value,
|
|
558
|
+
...mdastPosField(node.position)
|
|
559
|
+
};
|
|
560
|
+
case "thematicBreak":
|
|
561
|
+
return {
|
|
562
|
+
type: "thematicBreak",
|
|
563
|
+
...mdastPosField(node.position)
|
|
564
|
+
};
|
|
565
|
+
case "table":
|
|
566
|
+
return {
|
|
567
|
+
type: "table",
|
|
568
|
+
...node.align ? { align: node.align } : {},
|
|
569
|
+
children: node.children.map(tableRowToMdast),
|
|
570
|
+
...mdastPosField(node.position)
|
|
571
|
+
};
|
|
572
|
+
case "htmlBlock":
|
|
573
|
+
return {
|
|
574
|
+
type: "html",
|
|
575
|
+
value: node.rawHtml,
|
|
576
|
+
...mdastPosField(node.position)
|
|
577
|
+
};
|
|
578
|
+
case "math":
|
|
579
|
+
return {
|
|
580
|
+
type: "math",
|
|
581
|
+
value: node.value,
|
|
582
|
+
...node.meta != null ? { meta: node.meta } : {},
|
|
583
|
+
...mdastPosField(node.position)
|
|
584
|
+
};
|
|
585
|
+
case "definition":
|
|
586
|
+
return {
|
|
587
|
+
type: "definition",
|
|
588
|
+
identifier: node.identifier,
|
|
589
|
+
...node.label != null ? { label: node.label } : {},
|
|
590
|
+
url: node.url,
|
|
591
|
+
...node.title != null ? { title: node.title } : {},
|
|
592
|
+
...mdastPosField(node.position)
|
|
593
|
+
};
|
|
594
|
+
case "footnoteDefinition":
|
|
595
|
+
return {
|
|
596
|
+
type: "footnoteDefinition",
|
|
597
|
+
identifier: node.identifier,
|
|
598
|
+
...node.label != null ? { label: node.label } : {},
|
|
599
|
+
children: node.children.map(blockToMdast),
|
|
600
|
+
...mdastPosField(node.position)
|
|
601
|
+
};
|
|
602
|
+
case "containerDirective": {
|
|
603
|
+
const children = [];
|
|
604
|
+
if (node.label) {
|
|
605
|
+
children.push({
|
|
606
|
+
type: "paragraph",
|
|
607
|
+
data: { directiveLabel: true },
|
|
608
|
+
children: [{ type: "text", value: node.label }]
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
children.push(...node.children.map(blockToMdast));
|
|
612
|
+
return {
|
|
613
|
+
type: "containerDirective",
|
|
614
|
+
name: node.name,
|
|
615
|
+
...node.attributes ? { attributes: node.attributes } : {},
|
|
616
|
+
children,
|
|
617
|
+
...mdastPosField(node.position)
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
case "leafDirective":
|
|
621
|
+
return {
|
|
622
|
+
type: "leafDirective",
|
|
623
|
+
name: node.name,
|
|
624
|
+
...node.attributes ? { attributes: node.attributes } : {},
|
|
625
|
+
children: node.children.map(inlineToMdast),
|
|
626
|
+
...mdastPosField(node.position)
|
|
627
|
+
};
|
|
628
|
+
case "definitionList":
|
|
629
|
+
return {
|
|
630
|
+
type: "html",
|
|
631
|
+
value: definitionListToHtml(node),
|
|
632
|
+
...mdastPosField(node.position)
|
|
633
|
+
};
|
|
634
|
+
default:
|
|
635
|
+
return { type: "html", value: "" };
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function listItemToMdast(item) {
|
|
639
|
+
return {
|
|
640
|
+
type: "listItem",
|
|
641
|
+
...item.checked != null ? { checked: item.checked } : {},
|
|
642
|
+
...item.spread != null ? { spread: item.spread } : {},
|
|
643
|
+
children: item.children.map(blockToMdast),
|
|
644
|
+
...mdastPosField(item.position)
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function tableRowToMdast(row) {
|
|
648
|
+
return {
|
|
649
|
+
type: "tableRow",
|
|
650
|
+
children: row.children.map(tableCellToMdast),
|
|
651
|
+
...mdastPosField(row.position)
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
function tableCellToMdast(cell) {
|
|
655
|
+
return {
|
|
656
|
+
type: "tableCell",
|
|
657
|
+
children: cell.children.map(inlineToMdast),
|
|
658
|
+
...mdastPosField(cell.position)
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function inlineToMdast(node) {
|
|
662
|
+
switch (node.type) {
|
|
663
|
+
case "text":
|
|
664
|
+
return {
|
|
665
|
+
type: "text",
|
|
666
|
+
value: node.value,
|
|
667
|
+
...mdastPosField(node.position)
|
|
668
|
+
};
|
|
669
|
+
case "emphasis":
|
|
670
|
+
return {
|
|
671
|
+
type: "emphasis",
|
|
672
|
+
children: node.children.map(inlineToMdast),
|
|
673
|
+
...mdastPosField(node.position)
|
|
674
|
+
};
|
|
675
|
+
case "strong":
|
|
676
|
+
return {
|
|
677
|
+
type: "strong",
|
|
678
|
+
children: node.children.map(inlineToMdast),
|
|
679
|
+
...mdastPosField(node.position)
|
|
680
|
+
};
|
|
681
|
+
case "delete":
|
|
682
|
+
return {
|
|
683
|
+
type: "delete",
|
|
684
|
+
children: node.children.map(inlineToMdast),
|
|
685
|
+
...mdastPosField(node.position)
|
|
686
|
+
};
|
|
687
|
+
case "inlineCode":
|
|
688
|
+
return {
|
|
689
|
+
type: "inlineCode",
|
|
690
|
+
value: node.value,
|
|
691
|
+
...mdastPosField(node.position)
|
|
692
|
+
};
|
|
693
|
+
case "link":
|
|
694
|
+
return {
|
|
695
|
+
type: "link",
|
|
696
|
+
url: node.url,
|
|
697
|
+
...node.title != null ? { title: node.title } : {},
|
|
698
|
+
children: node.children.map(inlineToMdast),
|
|
699
|
+
...mdastPosField(node.position)
|
|
700
|
+
};
|
|
701
|
+
case "image":
|
|
702
|
+
return {
|
|
703
|
+
type: "image",
|
|
704
|
+
url: node.url,
|
|
705
|
+
...node.alt != null ? { alt: node.alt } : {},
|
|
706
|
+
...node.title != null ? { title: node.title } : {},
|
|
707
|
+
...mdastPosField(node.position)
|
|
708
|
+
};
|
|
709
|
+
case "break":
|
|
710
|
+
return {
|
|
711
|
+
type: "break",
|
|
712
|
+
...mdastPosField(node.position)
|
|
713
|
+
};
|
|
714
|
+
case "htmlInline":
|
|
715
|
+
return {
|
|
716
|
+
type: "html",
|
|
717
|
+
value: node.rawHtml,
|
|
718
|
+
...mdastPosField(node.position)
|
|
719
|
+
};
|
|
720
|
+
case "inlineMath":
|
|
721
|
+
return {
|
|
722
|
+
type: "inlineMath",
|
|
723
|
+
value: node.value,
|
|
724
|
+
...mdastPosField(node.position)
|
|
725
|
+
};
|
|
726
|
+
case "footnoteReference":
|
|
727
|
+
return {
|
|
728
|
+
type: "footnoteReference",
|
|
729
|
+
identifier: node.identifier,
|
|
730
|
+
...node.label != null ? { label: node.label } : {},
|
|
731
|
+
...mdastPosField(node.position)
|
|
732
|
+
};
|
|
733
|
+
case "linkReference":
|
|
734
|
+
return {
|
|
735
|
+
type: "linkReference",
|
|
736
|
+
identifier: node.identifier,
|
|
737
|
+
...node.label != null ? { label: node.label } : {},
|
|
738
|
+
referenceType: node.referenceType,
|
|
739
|
+
children: node.children.map(inlineToMdast),
|
|
740
|
+
...mdastPosField(node.position)
|
|
741
|
+
};
|
|
742
|
+
case "imageReference":
|
|
743
|
+
return {
|
|
744
|
+
type: "imageReference",
|
|
745
|
+
identifier: node.identifier,
|
|
746
|
+
...node.label != null ? { label: node.label } : {},
|
|
747
|
+
referenceType: node.referenceType,
|
|
748
|
+
...node.alt != null ? { alt: node.alt } : {},
|
|
749
|
+
...mdastPosField(node.position)
|
|
750
|
+
};
|
|
751
|
+
case "textDirective":
|
|
752
|
+
return {
|
|
753
|
+
type: "textDirective",
|
|
754
|
+
name: node.name,
|
|
755
|
+
...node.attributes ? { attributes: node.attributes } : {},
|
|
756
|
+
children: node.children.map(inlineToMdast),
|
|
757
|
+
...mdastPosField(node.position)
|
|
758
|
+
};
|
|
759
|
+
default:
|
|
760
|
+
return { type: "text", value: "" };
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
function definitionListToHtml(list) {
|
|
764
|
+
let html = "<dl>\n";
|
|
765
|
+
for (const child of list.children) {
|
|
766
|
+
if (child.type === "definitionTerm") {
|
|
767
|
+
const text = child.children.map((c) => c.value ?? "").join("");
|
|
768
|
+
html += ` <dt>${text}</dt>
|
|
769
|
+
`;
|
|
770
|
+
} else if (child.type === "definitionDescription") {
|
|
771
|
+
html += ` <dd>...</dd>
|
|
772
|
+
`;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
html += "</dl>";
|
|
776
|
+
return html;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// src/markdown/parse.ts
|
|
780
|
+
var defaultProcessor;
|
|
781
|
+
function parseMarkdown(markdown, options) {
|
|
782
|
+
const useDefaults = !options || options.gfm !== false && options.math !== false && options.directive !== false && options.frontmatter !== false;
|
|
783
|
+
let processor;
|
|
784
|
+
if (useDefaults) {
|
|
785
|
+
if (!defaultProcessor) {
|
|
786
|
+
defaultProcessor = unified().use(remarkParse).use(remarkGfm).use(remarkMath).use(remarkDirective).use(remarkFrontmatter, ["yaml"]);
|
|
787
|
+
}
|
|
788
|
+
processor = defaultProcessor;
|
|
789
|
+
} else {
|
|
790
|
+
processor = unified().use(remarkParse);
|
|
791
|
+
if (options?.gfm !== false) {
|
|
792
|
+
processor = processor.use(remarkGfm);
|
|
793
|
+
}
|
|
794
|
+
if (options?.math !== false) {
|
|
795
|
+
processor = processor.use(remarkMath);
|
|
796
|
+
}
|
|
797
|
+
if (options?.directive !== false) {
|
|
798
|
+
processor = processor.use(remarkDirective);
|
|
799
|
+
}
|
|
800
|
+
if (options?.frontmatter !== false) {
|
|
801
|
+
processor = processor.use(remarkFrontmatter, ["yaml"]);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
const mdastTree = processor.parse(markdown);
|
|
805
|
+
const doc = fromMdast(mdastTree, {
|
|
806
|
+
parseHtml: options?.parseHtml
|
|
807
|
+
});
|
|
808
|
+
if (options?.frontmatter !== false) {
|
|
809
|
+
const yamlNode = mdastTree.children?.find((n) => n.type === "yaml");
|
|
810
|
+
if (yamlNode?.value) {
|
|
811
|
+
const fm = parseFrontmatter(yamlNode.value);
|
|
812
|
+
if (fm && Object.keys(fm).length > 0) {
|
|
813
|
+
doc.frontmatter = fm;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return doc;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// src/markdown/stringify.ts
|
|
821
|
+
import { unified as unified2 } from "unified";
|
|
822
|
+
import remarkStringify from "remark-stringify";
|
|
823
|
+
import remarkGfm2 from "remark-gfm";
|
|
824
|
+
import remarkMath2 from "remark-math";
|
|
825
|
+
import remarkDirective2 from "remark-directive";
|
|
826
|
+
var defaultProcessor2;
|
|
827
|
+
function stringifyMarkdown(doc, options) {
|
|
828
|
+
const mdastTree = toMdast(doc);
|
|
829
|
+
const useDefaults = !options || options.gfm !== false && options.math !== false && options.directive !== false && !options.bullet && !options.bulletOrdered && !options.emphasis && !options.strong && !options.rule && !options.fence && options.setext == null;
|
|
830
|
+
let processor;
|
|
831
|
+
if (useDefaults) {
|
|
832
|
+
if (!defaultProcessor2) {
|
|
833
|
+
defaultProcessor2 = unified2().use(remarkGfm2).use(remarkMath2).use(remarkDirective2).use(remarkStringify, {
|
|
834
|
+
bullet: "-",
|
|
835
|
+
bulletOrdered: ".",
|
|
836
|
+
emphasis: "*",
|
|
837
|
+
strong: "*",
|
|
838
|
+
rule: "-",
|
|
839
|
+
fence: "`",
|
|
840
|
+
setext: false
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
processor = defaultProcessor2;
|
|
844
|
+
} else {
|
|
845
|
+
processor = unified2();
|
|
846
|
+
if (options?.gfm !== false) {
|
|
847
|
+
processor = processor.use(remarkGfm2);
|
|
848
|
+
}
|
|
849
|
+
if (options?.math !== false) {
|
|
850
|
+
processor = processor.use(remarkMath2);
|
|
851
|
+
}
|
|
852
|
+
if (options?.directive !== false) {
|
|
853
|
+
processor = processor.use(remarkDirective2);
|
|
854
|
+
}
|
|
855
|
+
processor = processor.use(remarkStringify, {
|
|
856
|
+
bullet: options?.bullet ?? "-",
|
|
857
|
+
bulletOrdered: options?.bulletOrdered ?? ".",
|
|
858
|
+
emphasis: options?.emphasis ?? "*",
|
|
859
|
+
strong: options?.strong ?? "*",
|
|
860
|
+
rule: options?.rule ?? "-",
|
|
861
|
+
fence: options?.fence ?? "`",
|
|
862
|
+
setext: options?.setext ?? false
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
const result = processor.stringify(mdastTree);
|
|
866
|
+
const cleaned = result.replace(/\{\\\[([^\]]+)\]\}/g, "{[$1]}");
|
|
867
|
+
if (doc.frontmatter && Object.keys(doc.frontmatter).length > 0) {
|
|
868
|
+
const yamlLines = Object.entries(doc.frontmatter).map(
|
|
869
|
+
([k, v]) => `${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`
|
|
870
|
+
);
|
|
871
|
+
return `---
|
|
872
|
+
${yamlLines.join("\n")}
|
|
873
|
+
---
|
|
874
|
+
|
|
875
|
+
${cleaned}`;
|
|
876
|
+
}
|
|
877
|
+
return cleaned;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
export {
|
|
881
|
+
parseHtmlToNodes,
|
|
882
|
+
stringifyHtmlNodes,
|
|
883
|
+
fromMdast,
|
|
884
|
+
toMdast,
|
|
885
|
+
parseMarkdown,
|
|
886
|
+
stringifyMarkdown
|
|
887
|
+
};
|
|
888
|
+
//# sourceMappingURL=chunk-URU6QMLY.js.map
|