ovellum 0.2.0 → 0.2.2
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/dev/run-build.d.ts.map +1 -1
- package/dist/index.cjs +4088 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4151 -347
- package/dist/index.js.map +1 -1
- package/dist/templates/default/script.js +115 -4
- package/dist/templates/default/style.css +817 -179
- package/package.json +5 -1
package/dist/index.cjs
CHANGED
|
@@ -58,10 +58,12 @@ var DEFAULT_CONFIG = {
|
|
|
58
58
|
search: { enabled: false },
|
|
59
59
|
pageMeta: { readingTime: true, lastModified: true },
|
|
60
60
|
topbarNav: [],
|
|
61
|
+
footerNav: [],
|
|
61
62
|
landing: {
|
|
62
63
|
enabled: false,
|
|
63
64
|
hero: { ctas: [] },
|
|
64
|
-
features: []
|
|
65
|
+
features: [],
|
|
66
|
+
scenes: []
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
};
|
|
@@ -226,6 +228,9 @@ function validateUserConfig(input2) {
|
|
|
226
228
|
if (s.editUrlPattern !== void 0 && typeof s.editUrlPattern !== "string") {
|
|
227
229
|
throw new ConfigError("`site.editUrlPattern` must be a string URL template.");
|
|
228
230
|
}
|
|
231
|
+
if (s.headExtra !== void 0 && typeof s.headExtra !== "string") {
|
|
232
|
+
throw new ConfigError("`site.headExtra` must be a string of raw HTML.");
|
|
233
|
+
}
|
|
229
234
|
if (s.defaultTheme !== void 0 && !THEMES.includes(s.defaultTheme)) {
|
|
230
235
|
throw new ConfigError(`\`site.defaultTheme\` must be one of: ${THEMES.join(", ")}.`);
|
|
231
236
|
}
|
|
@@ -253,6 +258,33 @@ function validateUserConfig(input2) {
|
|
|
253
258
|
if (typeof item.href !== "string") {
|
|
254
259
|
throw new ConfigError(`\`${path23}.href\` must be a string.`);
|
|
255
260
|
}
|
|
261
|
+
if (item.icon !== void 0 && typeof item.icon !== "string") {
|
|
262
|
+
throw new ConfigError(`\`${path23}.icon\` must be a string.`);
|
|
263
|
+
}
|
|
264
|
+
if (item.external !== void 0 && typeof item.external !== "boolean") {
|
|
265
|
+
throw new ConfigError(`\`${path23}.external\` must be a boolean.`);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
if (s.version !== void 0 && typeof s.version !== "string") {
|
|
270
|
+
throw new ConfigError("`site.version` must be a string when set.");
|
|
271
|
+
}
|
|
272
|
+
if (s.footerNav !== void 0) {
|
|
273
|
+
if (!Array.isArray(s.footerNav)) {
|
|
274
|
+
throw new ConfigError("`site.footerNav` must be an array.");
|
|
275
|
+
}
|
|
276
|
+
s.footerNav.forEach((item, i) => {
|
|
277
|
+
const path23 = `site.footerNav[${i}]`;
|
|
278
|
+
if (!isPlainObject(item)) throw new ConfigError(`\`${path23}\` must be an object.`);
|
|
279
|
+
if (typeof item.label !== "string") {
|
|
280
|
+
throw new ConfigError(`\`${path23}.label\` must be a string.`);
|
|
281
|
+
}
|
|
282
|
+
if (typeof item.href !== "string") {
|
|
283
|
+
throw new ConfigError(`\`${path23}.href\` must be a string.`);
|
|
284
|
+
}
|
|
285
|
+
if (item.icon !== void 0 && typeof item.icon !== "string") {
|
|
286
|
+
throw new ConfigError(`\`${path23}.icon\` must be a string.`);
|
|
287
|
+
}
|
|
256
288
|
if (item.external !== void 0 && typeof item.external !== "boolean") {
|
|
257
289
|
throw new ConfigError(`\`${path23}.external\` must be a boolean.`);
|
|
258
290
|
}
|
|
@@ -301,6 +333,7 @@ function validateLanding(value) {
|
|
|
301
333
|
}
|
|
302
334
|
h.ctas.forEach((cta, i) => validateCta(cta, `site.landing.hero.ctas[${i}]`));
|
|
303
335
|
}
|
|
336
|
+
if (h.media !== void 0) validateHeroMedia(h.media);
|
|
304
337
|
}
|
|
305
338
|
if (l.features !== void 0) {
|
|
306
339
|
if (!Array.isArray(l.features)) {
|
|
@@ -308,6 +341,12 @@ function validateLanding(value) {
|
|
|
308
341
|
}
|
|
309
342
|
l.features.forEach((f, i) => validateFeature(f, `site.landing.features[${i}]`));
|
|
310
343
|
}
|
|
344
|
+
if (l.scenes !== void 0) {
|
|
345
|
+
if (!Array.isArray(l.scenes)) {
|
|
346
|
+
throw new ConfigError("`site.landing.scenes` must be an array.");
|
|
347
|
+
}
|
|
348
|
+
l.scenes.forEach((s, i) => validateScene(s, `site.landing.scenes[${i}]`));
|
|
349
|
+
}
|
|
311
350
|
if (l.trustStrip !== void 0) {
|
|
312
351
|
if (!isPlainObject(l.trustStrip)) {
|
|
313
352
|
throw new ConfigError("`site.landing.trustStrip` must be an object.");
|
|
@@ -324,6 +363,21 @@ function validateLanding(value) {
|
|
|
324
363
|
}
|
|
325
364
|
}
|
|
326
365
|
}
|
|
366
|
+
function validateHeroMedia(value) {
|
|
367
|
+
if (!isPlainObject(value)) {
|
|
368
|
+
throw new ConfigError("`site.landing.hero.media` must be an object.");
|
|
369
|
+
}
|
|
370
|
+
const m = value;
|
|
371
|
+
if (typeof m.light !== "string" || m.light.length === 0) {
|
|
372
|
+
throw new ConfigError("`site.landing.hero.media.light` must be a non-empty string path.");
|
|
373
|
+
}
|
|
374
|
+
if (m.dark !== void 0 && typeof m.dark !== "string") {
|
|
375
|
+
throw new ConfigError("`site.landing.hero.media.dark` must be a string path.");
|
|
376
|
+
}
|
|
377
|
+
if (m.alt !== void 0 && typeof m.alt !== "string") {
|
|
378
|
+
throw new ConfigError("`site.landing.hero.media.alt` must be a string.");
|
|
379
|
+
}
|
|
380
|
+
}
|
|
327
381
|
function validateCta(value, path23) {
|
|
328
382
|
if (!isPlainObject(value)) throw new ConfigError(`\`${path23}\` must be an object.`);
|
|
329
383
|
const c = value;
|
|
@@ -344,6 +398,19 @@ function validateFeature(value, path23) {
|
|
|
344
398
|
throw new ConfigError(`\`${path23}.icon\` must be a string.`);
|
|
345
399
|
}
|
|
346
400
|
}
|
|
401
|
+
function validateScene(value, path23) {
|
|
402
|
+
if (!isPlainObject(value)) throw new ConfigError(`\`${path23}\` must be an object.`);
|
|
403
|
+
const s = value;
|
|
404
|
+
if (typeof s.light !== "string" || s.light.length === 0) {
|
|
405
|
+
throw new ConfigError(`\`${path23}.light\` must be a non-empty string path.`);
|
|
406
|
+
}
|
|
407
|
+
if (s.dark !== void 0 && typeof s.dark !== "string") {
|
|
408
|
+
throw new ConfigError(`\`${path23}.dark\` must be a string path.`);
|
|
409
|
+
}
|
|
410
|
+
if (s.alt !== void 0 && typeof s.alt !== "string") {
|
|
411
|
+
throw new ConfigError(`\`${path23}.alt\` must be a string.`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
347
414
|
function validateTrustItem(value, path23) {
|
|
348
415
|
if (!isPlainObject(value)) throw new ConfigError(`\`${path23}\` must be an object.`);
|
|
349
416
|
const t = value;
|
|
@@ -418,8 +485,8 @@ function emptyJsDocInfo() {
|
|
|
418
485
|
tags: {}
|
|
419
486
|
};
|
|
420
487
|
}
|
|
421
|
-
function extractJsDoc(
|
|
422
|
-
const blocks =
|
|
488
|
+
function extractJsDoc(node2) {
|
|
489
|
+
const blocks = node2.getJsDocs();
|
|
423
490
|
if (blocks.length === 0) return emptyJsDocInfo();
|
|
424
491
|
const block = blocks[blocks.length - 1];
|
|
425
492
|
return parseBlock(block);
|
|
@@ -484,11 +551,11 @@ function readComment(tag) {
|
|
|
484
551
|
return (raw ?? "").replace(/^\s*-\s*/, "").trim();
|
|
485
552
|
}
|
|
486
553
|
function readParamName(tag) {
|
|
487
|
-
const
|
|
488
|
-
const named =
|
|
554
|
+
const node2 = tag.compilerNode;
|
|
555
|
+
const named = node2.name?.getText?.();
|
|
489
556
|
if (named) return named;
|
|
490
|
-
const
|
|
491
|
-
const match =
|
|
557
|
+
const text3 = tag.getText();
|
|
558
|
+
const match = text3.match(/@param\s+(?:\{[^}]*\}\s+)?([A-Za-z_$][\w$]*)/);
|
|
492
559
|
return match ? match[1] : void 0;
|
|
493
560
|
}
|
|
494
561
|
function extractFromFile(sf, ctx) {
|
|
@@ -520,7 +587,7 @@ function fromFunction(fn, ctx) {
|
|
|
520
587
|
returnType: returnTypeText,
|
|
521
588
|
isAsync: fn.isAsync()
|
|
522
589
|
});
|
|
523
|
-
const
|
|
590
|
+
const node2 = {
|
|
524
591
|
id: anchorId(ctx.relPath, name),
|
|
525
592
|
kind: "function",
|
|
526
593
|
name,
|
|
@@ -537,8 +604,8 @@ function fromFunction(fn, ctx) {
|
|
|
537
604
|
description: jsdoc.returnsDescription
|
|
538
605
|
}
|
|
539
606
|
};
|
|
540
|
-
attachJsDocFields(
|
|
541
|
-
return [
|
|
607
|
+
attachJsDocFields(node2, jsdoc);
|
|
608
|
+
return [node2];
|
|
542
609
|
}
|
|
543
610
|
function fromClass(cls, ctx) {
|
|
544
611
|
const name = cls.getName();
|
|
@@ -565,7 +632,7 @@ function fromClass(cls, ctx) {
|
|
|
565
632
|
const childNode = fromProperty(prop, ctx, name);
|
|
566
633
|
if (childNode) children.push(childNode);
|
|
567
634
|
}
|
|
568
|
-
const
|
|
635
|
+
const node2 = {
|
|
569
636
|
id: anchorId(ctx.relPath, name),
|
|
570
637
|
kind: "class",
|
|
571
638
|
name,
|
|
@@ -578,8 +645,8 @@ function fromClass(cls, ctx) {
|
|
|
578
645
|
tags: jsdoc.tags,
|
|
579
646
|
children: children.length ? children : void 0
|
|
580
647
|
};
|
|
581
|
-
attachJsDocFields(
|
|
582
|
-
return [
|
|
648
|
+
attachJsDocFields(node2, jsdoc);
|
|
649
|
+
return [node2];
|
|
583
650
|
}
|
|
584
651
|
function fromMethod(method, ctx, className) {
|
|
585
652
|
const name = method.getName();
|
|
@@ -592,7 +659,7 @@ function fromMethod(method, ctx, className) {
|
|
|
592
659
|
const generics = method.getTypeParameters().map((tp) => tp.getText());
|
|
593
660
|
const gen = generics.length ? `<${generics.join(", ")}>` : "";
|
|
594
661
|
const signature = `${name}${gen}(${method.getParameters().map(paramSignaturePart).join(", ")}): ${returnTypeText}`;
|
|
595
|
-
const
|
|
662
|
+
const node2 = {
|
|
596
663
|
id: anchorId(ctx.relPath, `${className}.${name}`),
|
|
597
664
|
kind: "method",
|
|
598
665
|
name,
|
|
@@ -609,8 +676,8 @@ function fromMethod(method, ctx, className) {
|
|
|
609
676
|
description: jsdoc.returnsDescription
|
|
610
677
|
}
|
|
611
678
|
};
|
|
612
|
-
attachJsDocFields(
|
|
613
|
-
return
|
|
679
|
+
attachJsDocFields(node2, jsdoc);
|
|
680
|
+
return node2;
|
|
614
681
|
}
|
|
615
682
|
function fromProperty(prop, ctx, className) {
|
|
616
683
|
const name = prop.getName();
|
|
@@ -619,7 +686,7 @@ function fromProperty(prop, ctx, className) {
|
|
|
619
686
|
if (isPrivate && !ctx.config.includePrivate && !ctx.config.includeInternal) return void 0;
|
|
620
687
|
if (jsdoc.internal && !ctx.config.includeInternal) return void 0;
|
|
621
688
|
const typeText = prop.getTypeNode()?.getText() ?? prop.getType().getText(prop);
|
|
622
|
-
const
|
|
689
|
+
const node2 = {
|
|
623
690
|
id: anchorId(ctx.relPath, `${className}.${name}`),
|
|
624
691
|
kind: "property",
|
|
625
692
|
name,
|
|
@@ -631,8 +698,8 @@ function fromProperty(prop, ctx, className) {
|
|
|
631
698
|
isPreserved: jsdoc.preserved,
|
|
632
699
|
tags: jsdoc.tags
|
|
633
700
|
};
|
|
634
|
-
attachJsDocFields(
|
|
635
|
-
return
|
|
701
|
+
attachJsDocFields(node2, jsdoc);
|
|
702
|
+
return node2;
|
|
636
703
|
}
|
|
637
704
|
function fromInterface(iface, ctx) {
|
|
638
705
|
const name = iface.getName();
|
|
@@ -687,7 +754,7 @@ function fromInterface(iface, ctx) {
|
|
|
687
754
|
attachJsDocFields(methodNode, methodJsdoc);
|
|
688
755
|
children.push(methodNode);
|
|
689
756
|
}
|
|
690
|
-
const
|
|
757
|
+
const node2 = {
|
|
691
758
|
id: anchorId(ctx.relPath, name),
|
|
692
759
|
kind: "interface",
|
|
693
760
|
name,
|
|
@@ -700,8 +767,8 @@ function fromInterface(iface, ctx) {
|
|
|
700
767
|
tags: jsdoc.tags,
|
|
701
768
|
children: children.length ? children : void 0
|
|
702
769
|
};
|
|
703
|
-
attachJsDocFields(
|
|
704
|
-
return [
|
|
770
|
+
attachJsDocFields(node2, jsdoc);
|
|
771
|
+
return [node2];
|
|
705
772
|
}
|
|
706
773
|
function fromTypeAlias(alias, ctx) {
|
|
707
774
|
const name = alias.getName();
|
|
@@ -711,7 +778,7 @@ function fromTypeAlias(alias, ctx) {
|
|
|
711
778
|
const generics = alias.getTypeParameters().map((tp) => tp.getText());
|
|
712
779
|
const gen = generics.length ? `<${generics.join(", ")}>` : "";
|
|
713
780
|
const typeText = alias.getTypeNode()?.getText() ?? alias.getType().getText(alias);
|
|
714
|
-
const
|
|
781
|
+
const node2 = {
|
|
715
782
|
id: anchorId(ctx.relPath, name),
|
|
716
783
|
kind: "type",
|
|
717
784
|
name,
|
|
@@ -723,8 +790,8 @@ function fromTypeAlias(alias, ctx) {
|
|
|
723
790
|
isPreserved: jsdoc.preserved,
|
|
724
791
|
tags: jsdoc.tags
|
|
725
792
|
};
|
|
726
|
-
attachJsDocFields(
|
|
727
|
-
return [
|
|
793
|
+
attachJsDocFields(node2, jsdoc);
|
|
794
|
+
return [node2];
|
|
728
795
|
}
|
|
729
796
|
function fromEnum(en, ctx) {
|
|
730
797
|
const name = en.getName();
|
|
@@ -751,7 +818,7 @@ function fromEnum(en, ctx) {
|
|
|
751
818
|
attachJsDocFields(memberNode, memberJsdoc);
|
|
752
819
|
return memberNode;
|
|
753
820
|
});
|
|
754
|
-
const
|
|
821
|
+
const node2 = {
|
|
755
822
|
id: anchorId(ctx.relPath, name),
|
|
756
823
|
kind: "enum",
|
|
757
824
|
name,
|
|
@@ -764,8 +831,8 @@ function fromEnum(en, ctx) {
|
|
|
764
831
|
tags: jsdoc.tags,
|
|
765
832
|
children
|
|
766
833
|
};
|
|
767
|
-
attachJsDocFields(
|
|
768
|
-
return [
|
|
834
|
+
attachJsDocFields(node2, jsdoc);
|
|
835
|
+
return [node2];
|
|
769
836
|
}
|
|
770
837
|
function paramSignaturePart(p) {
|
|
771
838
|
const name = p.getName();
|
|
@@ -796,12 +863,12 @@ function buildFunctionSignature(opts) {
|
|
|
796
863
|
const asyncKw = opts.isAsync ? "async " : "";
|
|
797
864
|
return `${asyncKw}function ${opts.name}${gen}(${opts.params.join(", ")}): ${opts.returnType}`;
|
|
798
865
|
}
|
|
799
|
-
function attachJsDocFields(
|
|
800
|
-
if (jsdoc.description)
|
|
801
|
-
if (jsdoc.examples.length)
|
|
802
|
-
if (jsdoc.throws.length)
|
|
803
|
-
if (jsdoc.deprecated)
|
|
804
|
-
if (jsdoc.since)
|
|
866
|
+
function attachJsDocFields(node2, jsdoc) {
|
|
867
|
+
if (jsdoc.description) node2.description = jsdoc.description;
|
|
868
|
+
if (jsdoc.examples.length) node2.examples = jsdoc.examples;
|
|
869
|
+
if (jsdoc.throws.length) node2.throws = jsdoc.throws;
|
|
870
|
+
if (jsdoc.deprecated) node2.deprecated = jsdoc.deprecated;
|
|
871
|
+
if (jsdoc.since) node2.since = jsdoc.since;
|
|
805
872
|
}
|
|
806
873
|
function parseProject(options) {
|
|
807
874
|
const { config, cwd } = options;
|
|
@@ -897,38 +964,38 @@ function outputPathFor(sourceRelPath, config) {
|
|
|
897
964
|
function stripLeadingDotSlash(p) {
|
|
898
965
|
return p.replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
899
966
|
}
|
|
900
|
-
function renderNode(
|
|
967
|
+
function renderNode(node2) {
|
|
901
968
|
const parts = [];
|
|
902
|
-
parts.push(headingFor(
|
|
903
|
-
parts.push(anchorComment(
|
|
904
|
-
parts.push(signatureBlock(
|
|
905
|
-
if (
|
|
906
|
-
parts.push(`> **Deprecated.** ${escapeInline(
|
|
969
|
+
parts.push(headingFor(node2));
|
|
970
|
+
parts.push(anchorComment(node2));
|
|
971
|
+
parts.push(signatureBlock(node2));
|
|
972
|
+
if (node2.deprecated) {
|
|
973
|
+
parts.push(`> **Deprecated.** ${escapeInline(node2.deprecated)}`);
|
|
907
974
|
}
|
|
908
|
-
if (
|
|
909
|
-
parts.push(
|
|
975
|
+
if (node2.description) {
|
|
976
|
+
parts.push(node2.description.trim());
|
|
910
977
|
}
|
|
911
|
-
if (
|
|
912
|
-
parts.push(`*Since: ${escapeInline(
|
|
978
|
+
if (node2.since) {
|
|
979
|
+
parts.push(`*Since: ${escapeInline(node2.since)}*`);
|
|
913
980
|
}
|
|
914
|
-
if (
|
|
981
|
+
if (node2.params && node2.params.length > 0) {
|
|
915
982
|
parts.push("**Parameters**");
|
|
916
|
-
parts.push(paramsTable(
|
|
983
|
+
parts.push(paramsTable(node2.params));
|
|
917
984
|
}
|
|
918
|
-
if (
|
|
919
|
-
const desc =
|
|
920
|
-
parts.push(`**Returns** \`${
|
|
985
|
+
if (node2.returns && node2.returns.type && node2.returns.type !== "void") {
|
|
986
|
+
const desc = node2.returns.description ? ` - ${node2.returns.description}` : "";
|
|
987
|
+
parts.push(`**Returns** \`${node2.returns.type}\`${desc}`);
|
|
921
988
|
}
|
|
922
|
-
if (
|
|
989
|
+
if (node2.throws && node2.throws.length > 0) {
|
|
923
990
|
parts.push("**Throws**");
|
|
924
|
-
for (const t of
|
|
991
|
+
for (const t of node2.throws) parts.push(`- ${escapeInline(t)}`);
|
|
925
992
|
}
|
|
926
|
-
if (
|
|
993
|
+
if (node2.examples && node2.examples.length > 0) {
|
|
927
994
|
parts.push("**Example**");
|
|
928
|
-
for (const ex of
|
|
995
|
+
for (const ex of node2.examples) parts.push(fence(ex.trim(), "typescript"));
|
|
929
996
|
}
|
|
930
|
-
if (
|
|
931
|
-
parts.push(renderChildren(
|
|
997
|
+
if (node2.children && node2.children.length > 0) {
|
|
998
|
+
parts.push(renderChildren(node2));
|
|
932
999
|
}
|
|
933
1000
|
return parts.filter(Boolean).join("\n\n");
|
|
934
1001
|
}
|
|
@@ -959,25 +1026,25 @@ ${buckets.method.map(renderMember).join("\n\n")}`);
|
|
|
959
1026
|
}
|
|
960
1027
|
return sections.join("\n\n");
|
|
961
1028
|
}
|
|
962
|
-
function renderMember(
|
|
1029
|
+
function renderMember(node2) {
|
|
963
1030
|
const parts = [];
|
|
964
|
-
parts.push(`##### \`${
|
|
965
|
-
parts.push(anchorComment(
|
|
966
|
-
parts.push(fence(
|
|
967
|
-
if (
|
|
968
|
-
if (
|
|
969
|
-
parts.push(paramsTable(
|
|
1031
|
+
parts.push(`##### \`${node2.name}\``);
|
|
1032
|
+
parts.push(anchorComment(node2));
|
|
1033
|
+
parts.push(fence(node2.signature, "typescript"));
|
|
1034
|
+
if (node2.description) parts.push(node2.description.trim());
|
|
1035
|
+
if (node2.params && node2.params.length > 0) {
|
|
1036
|
+
parts.push(paramsTable(node2.params));
|
|
970
1037
|
}
|
|
971
|
-
if (
|
|
972
|
-
parts.push(`Returns \`${
|
|
1038
|
+
if (node2.returns && node2.returns.type && node2.returns.type !== "void") {
|
|
1039
|
+
parts.push(`Returns \`${node2.returns.type}\``);
|
|
973
1040
|
}
|
|
974
1041
|
return parts.filter(Boolean).join("\n\n");
|
|
975
1042
|
}
|
|
976
|
-
function headingFor(
|
|
977
|
-
return `## \`${
|
|
1043
|
+
function headingFor(node2) {
|
|
1044
|
+
return `## \`${node2.name}\``;
|
|
978
1045
|
}
|
|
979
|
-
function signatureBlock(
|
|
980
|
-
return fence(
|
|
1046
|
+
function signatureBlock(node2) {
|
|
1047
|
+
return fence(node2.signature, "typescript");
|
|
981
1048
|
}
|
|
982
1049
|
function paramsTable(params) {
|
|
983
1050
|
const head = "| Name | Type | Description |\n| --- | --- | --- |";
|
|
@@ -1006,8 +1073,8 @@ function signatureTypeOnly(signature, name) {
|
|
|
1006
1073
|
if (eqMatch) return eqMatch[1].trim();
|
|
1007
1074
|
return signature;
|
|
1008
1075
|
}
|
|
1009
|
-
function anchorComment(
|
|
1010
|
-
return `<!-- ovellum:anchor id="${
|
|
1076
|
+
function anchorComment(node2) {
|
|
1077
|
+
return `<!-- ovellum:anchor id="${node2.id}" generated="${(/* @__PURE__ */ new Date()).toISOString()}" -->`;
|
|
1011
1078
|
}
|
|
1012
1079
|
function fence(content, lang) {
|
|
1013
1080
|
return "```" + lang + "\n" + content + "\n```";
|
|
@@ -1036,8 +1103,8 @@ function renderFile(file, generatedAt) {
|
|
|
1036
1103
|
if (file.description) {
|
|
1037
1104
|
parts.push(file.description.trim());
|
|
1038
1105
|
}
|
|
1039
|
-
for (const
|
|
1040
|
-
parts.push(renderNode(
|
|
1106
|
+
for (const node2 of file.nodes) {
|
|
1107
|
+
parts.push(renderNode(node2));
|
|
1041
1108
|
}
|
|
1042
1109
|
return parts.filter(Boolean).join("\n\n") + "\n";
|
|
1043
1110
|
}
|
|
@@ -1151,7 +1218,15 @@ function parseManualDoc(raw, filePath) {
|
|
|
1151
1218
|
const frontmatter = parsed.data ?? {};
|
|
1152
1219
|
const content = parsed.content;
|
|
1153
1220
|
const protectedBlocks = extractProtectedZones(content);
|
|
1154
|
-
|
|
1221
|
+
const warnings = [];
|
|
1222
|
+
for (const block of protectedBlocks) {
|
|
1223
|
+
if (!block.hasExplicitId) {
|
|
1224
|
+
warnings.push(
|
|
1225
|
+
`${filePath}:${block.startLine}: protected zone "${block.id}" uses a positional fallback id. Add id="..." on the <!-- @manual:start --> tag so the block survives reordering.`
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
return { filePath, frontmatter, content, protectedBlocks, warnings };
|
|
1155
1230
|
}
|
|
1156
1231
|
|
|
1157
1232
|
// ../merger/dist/index.js
|
|
@@ -1167,146 +1242,3588 @@ function findAnchors(content) {
|
|
|
1167
1242
|
if (!id) continue;
|
|
1168
1243
|
out.push({ id, index: m.index, endIndex: m.index + m[0].length });
|
|
1169
1244
|
}
|
|
1170
|
-
return out;
|
|
1245
|
+
return out;
|
|
1246
|
+
}
|
|
1247
|
+
function merge(generated, manual, options = {}) {
|
|
1248
|
+
const orphans = [];
|
|
1249
|
+
const warnings = [];
|
|
1250
|
+
const now = options.now ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1251
|
+
const sourceFile = options.sourceFile ?? manual.filePath;
|
|
1252
|
+
const anchorToBlocks = /* @__PURE__ */ new Map();
|
|
1253
|
+
const anchorless = [];
|
|
1254
|
+
for (const block of manual.protectedBlocks) {
|
|
1255
|
+
if (!block.anchorId) {
|
|
1256
|
+
anchorless.push(block);
|
|
1257
|
+
continue;
|
|
1258
|
+
}
|
|
1259
|
+
let list2 = anchorToBlocks.get(block.anchorId);
|
|
1260
|
+
if (!list2) {
|
|
1261
|
+
list2 = [];
|
|
1262
|
+
anchorToBlocks.set(block.anchorId, list2);
|
|
1263
|
+
}
|
|
1264
|
+
list2.push(block);
|
|
1265
|
+
}
|
|
1266
|
+
for (const block of anchorless) {
|
|
1267
|
+
warnings.push(`Protected block ${block.id} has no associated anchor \u2014 treated as orphan.`);
|
|
1268
|
+
orphans.push(orphanFromBlock(block, void 0, sourceFile, now));
|
|
1269
|
+
}
|
|
1270
|
+
const anchors = findAnchors(generated);
|
|
1271
|
+
if (anchors.length === 0) {
|
|
1272
|
+
for (const [anchorId2, blocks] of anchorToBlocks) {
|
|
1273
|
+
for (const block of blocks) {
|
|
1274
|
+
orphans.push(orphanFromBlock(block, anchorId2, sourceFile, now));
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return { content: generated, orphans, warnings };
|
|
1278
|
+
}
|
|
1279
|
+
const pieces = [];
|
|
1280
|
+
let cursor = 0;
|
|
1281
|
+
for (let i = 0; i < anchors.length; i++) {
|
|
1282
|
+
const anchor = anchors[i];
|
|
1283
|
+
const sectionEnd = findSectionEnd(generated, anchor.endIndex);
|
|
1284
|
+
pieces.push(generated.slice(cursor, sectionEnd));
|
|
1285
|
+
const blocks = anchorToBlocks.get(anchor.id);
|
|
1286
|
+
if (blocks && blocks.length > 0) {
|
|
1287
|
+
pieces.push(renderBlocks(blocks));
|
|
1288
|
+
anchorToBlocks.delete(anchor.id);
|
|
1289
|
+
}
|
|
1290
|
+
cursor = sectionEnd;
|
|
1291
|
+
}
|
|
1292
|
+
if (cursor < generated.length) {
|
|
1293
|
+
pieces.push(generated.slice(cursor));
|
|
1294
|
+
}
|
|
1295
|
+
for (const [anchorId2, blocks] of anchorToBlocks) {
|
|
1296
|
+
for (const block of blocks) {
|
|
1297
|
+
orphans.push(orphanFromBlock(block, anchorId2, sourceFile, now));
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
return { content: pieces.join(""), orphans, warnings };
|
|
1301
|
+
}
|
|
1302
|
+
function findSectionEnd(content, from) {
|
|
1303
|
+
const re = /\n(#{1,6} )/g;
|
|
1304
|
+
re.lastIndex = from;
|
|
1305
|
+
const m = re.exec(content);
|
|
1306
|
+
return m ? m.index + 1 : content.length;
|
|
1307
|
+
}
|
|
1308
|
+
function renderBlocks(blocks) {
|
|
1309
|
+
return blocks.map((b) => renderBlock(b)).join("\n");
|
|
1310
|
+
}
|
|
1311
|
+
function renderBlock(block) {
|
|
1312
|
+
const idAttr = block.hasExplicitId ? ` id="${block.id}"` : "";
|
|
1313
|
+
return `<!-- @manual:start${idAttr} -->
|
|
1314
|
+
${block.content}
|
|
1315
|
+
<!-- @manual:end -->
|
|
1316
|
+
|
|
1317
|
+
`;
|
|
1318
|
+
}
|
|
1319
|
+
function orphanFromBlock(block, anchorId2, sourceFile, orphanedAt) {
|
|
1320
|
+
const out = {
|
|
1321
|
+
orphanedAt,
|
|
1322
|
+
sourceFile,
|
|
1323
|
+
anchorId: anchorId2 ?? "unknown",
|
|
1324
|
+
content: block.content
|
|
1325
|
+
};
|
|
1326
|
+
if (block.hasExplicitId) out.manualBlockId = block.id;
|
|
1327
|
+
return out;
|
|
1328
|
+
}
|
|
1329
|
+
function slugifyAnchor(anchorId2) {
|
|
1330
|
+
return anchorId2.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
1331
|
+
}
|
|
1332
|
+
function formatDateUTC(d) {
|
|
1333
|
+
const y = d.getUTCFullYear();
|
|
1334
|
+
const m = String(d.getUTCMonth() + 1).padStart(2, "0");
|
|
1335
|
+
const day = String(d.getUTCDate()).padStart(2, "0");
|
|
1336
|
+
return `${y}-${m}-${day}`;
|
|
1337
|
+
}
|
|
1338
|
+
function renderOrphanFile(record) {
|
|
1339
|
+
const fields = {
|
|
1340
|
+
orphaned: record.orphanedAt,
|
|
1341
|
+
source_file: record.sourceFile,
|
|
1342
|
+
anchor_id: record.anchorId
|
|
1343
|
+
};
|
|
1344
|
+
if (record.anchorLastSeen) fields.anchor_last_seen = record.anchorLastSeen;
|
|
1345
|
+
if (record.manualBlockId) fields.manual_block_id = record.manualBlockId;
|
|
1346
|
+
const yaml = Object.entries(fields).map(([k, v]) => `${k}: ${formatYamlScalar2(v)}`).join("\n");
|
|
1347
|
+
return `---
|
|
1348
|
+
${yaml}
|
|
1349
|
+
---
|
|
1350
|
+
|
|
1351
|
+
${record.content}
|
|
1352
|
+
`;
|
|
1353
|
+
}
|
|
1354
|
+
async function writeOrphan(record, orphanDir) {
|
|
1355
|
+
const slug = slugifyAnchor(record.anchorId);
|
|
1356
|
+
const dateStamp = formatDateUTC(new Date(record.orphanedAt));
|
|
1357
|
+
const filename = `${dateStamp}_${slug}.md`;
|
|
1358
|
+
const absPath = import_path4.default.resolve(orphanDir, filename);
|
|
1359
|
+
await (0, import_promises2.mkdir)(orphanDir, { recursive: true });
|
|
1360
|
+
await (0, import_promises2.writeFile)(absPath, renderOrphanFile(record), "utf8");
|
|
1361
|
+
return absPath;
|
|
1362
|
+
}
|
|
1363
|
+
function formatYamlScalar2(s) {
|
|
1364
|
+
if (/[:#\-?{}[\],&*!|>'"%@`]/.test(s) || /^\s|\s$/.test(s)) {
|
|
1365
|
+
return `'${s.replace(/'/g, "''")}'`;
|
|
1366
|
+
}
|
|
1367
|
+
return s;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
// ../site/dist/index.js
|
|
1371
|
+
var import_fs2 = require("fs");
|
|
1372
|
+
var import_promises3 = require("fs/promises");
|
|
1373
|
+
var import_path5 = __toESM(require("path"), 1);
|
|
1374
|
+
var import_url = require("url");
|
|
1375
|
+
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
1376
|
+
var import_unified = require("unified");
|
|
1377
|
+
var import_remark_parse = __toESM(require("remark-parse"), 1);
|
|
1378
|
+
|
|
1379
|
+
// ../../node_modules/.pnpm/ccount@2.0.1/node_modules/ccount/index.js
|
|
1380
|
+
function ccount(value, character) {
|
|
1381
|
+
const source = String(value);
|
|
1382
|
+
if (typeof character !== "string") {
|
|
1383
|
+
throw new TypeError("Expected character");
|
|
1384
|
+
}
|
|
1385
|
+
let count = 0;
|
|
1386
|
+
let index = source.indexOf(character);
|
|
1387
|
+
while (index !== -1) {
|
|
1388
|
+
count++;
|
|
1389
|
+
index = source.indexOf(character, index + character.length);
|
|
1390
|
+
}
|
|
1391
|
+
return count;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
// ../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js
|
|
1395
|
+
function ok() {
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
// ../../node_modules/.pnpm/micromark-util-character@2.1.1/node_modules/micromark-util-character/index.js
|
|
1399
|
+
var asciiAlpha = regexCheck(/[A-Za-z]/);
|
|
1400
|
+
var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
|
|
1401
|
+
var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
|
|
1402
|
+
function asciiControl(code3) {
|
|
1403
|
+
return (
|
|
1404
|
+
// Special whitespace codes (which have negative values), C0 and Control
|
|
1405
|
+
// character DEL
|
|
1406
|
+
code3 !== null && (code3 < 32 || code3 === 127)
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1409
|
+
var asciiDigit = regexCheck(/\d/);
|
|
1410
|
+
var asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
|
|
1411
|
+
var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
|
|
1412
|
+
function markdownLineEnding(code3) {
|
|
1413
|
+
return code3 !== null && code3 < -2;
|
|
1414
|
+
}
|
|
1415
|
+
function markdownLineEndingOrSpace(code3) {
|
|
1416
|
+
return code3 !== null && (code3 < 0 || code3 === 32);
|
|
1417
|
+
}
|
|
1418
|
+
function markdownSpace(code3) {
|
|
1419
|
+
return code3 === -2 || code3 === -1 || code3 === 32;
|
|
1420
|
+
}
|
|
1421
|
+
var unicodePunctuation = regexCheck(new RegExp("\\p{P}|\\p{S}", "u"));
|
|
1422
|
+
var unicodeWhitespace = regexCheck(/\s/);
|
|
1423
|
+
function regexCheck(regex) {
|
|
1424
|
+
return check;
|
|
1425
|
+
function check(code3) {
|
|
1426
|
+
return code3 !== null && code3 > -1 && regex.test(String.fromCharCode(code3));
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// ../../node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
|
|
1431
|
+
function escapeStringRegexp(string) {
|
|
1432
|
+
if (typeof string !== "string") {
|
|
1433
|
+
throw new TypeError("Expected a string");
|
|
1434
|
+
}
|
|
1435
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
// ../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js
|
|
1439
|
+
var convert = (
|
|
1440
|
+
// Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
1441
|
+
/**
|
|
1442
|
+
* @type {(
|
|
1443
|
+
* (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
|
|
1444
|
+
* (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
|
|
1445
|
+
* (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
|
|
1446
|
+
* ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
|
|
1447
|
+
* ((test?: Test) => Check)
|
|
1448
|
+
* )}
|
|
1449
|
+
*/
|
|
1450
|
+
/**
|
|
1451
|
+
* @param {Test} [test]
|
|
1452
|
+
* @returns {Check}
|
|
1453
|
+
*/
|
|
1454
|
+
(function(test) {
|
|
1455
|
+
if (test === null || test === void 0) {
|
|
1456
|
+
return ok2;
|
|
1457
|
+
}
|
|
1458
|
+
if (typeof test === "function") {
|
|
1459
|
+
return castFactory(test);
|
|
1460
|
+
}
|
|
1461
|
+
if (typeof test === "object") {
|
|
1462
|
+
return Array.isArray(test) ? anyFactory(test) : (
|
|
1463
|
+
// Cast because `ReadonlyArray` goes into the above but `isArray`
|
|
1464
|
+
// narrows to `Array`.
|
|
1465
|
+
propertiesFactory(
|
|
1466
|
+
/** @type {Props} */
|
|
1467
|
+
test
|
|
1468
|
+
)
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
if (typeof test === "string") {
|
|
1472
|
+
return typeFactory(test);
|
|
1473
|
+
}
|
|
1474
|
+
throw new Error("Expected function, string, or object as test");
|
|
1475
|
+
})
|
|
1476
|
+
);
|
|
1477
|
+
function anyFactory(tests) {
|
|
1478
|
+
const checks = [];
|
|
1479
|
+
let index = -1;
|
|
1480
|
+
while (++index < tests.length) {
|
|
1481
|
+
checks[index] = convert(tests[index]);
|
|
1482
|
+
}
|
|
1483
|
+
return castFactory(any);
|
|
1484
|
+
function any(...parameters) {
|
|
1485
|
+
let index2 = -1;
|
|
1486
|
+
while (++index2 < checks.length) {
|
|
1487
|
+
if (checks[index2].apply(this, parameters)) return true;
|
|
1488
|
+
}
|
|
1489
|
+
return false;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
function propertiesFactory(check) {
|
|
1493
|
+
const checkAsRecord = (
|
|
1494
|
+
/** @type {Record<string, unknown>} */
|
|
1495
|
+
check
|
|
1496
|
+
);
|
|
1497
|
+
return castFactory(all2);
|
|
1498
|
+
function all2(node2) {
|
|
1499
|
+
const nodeAsRecord = (
|
|
1500
|
+
/** @type {Record<string, unknown>} */
|
|
1501
|
+
/** @type {unknown} */
|
|
1502
|
+
node2
|
|
1503
|
+
);
|
|
1504
|
+
let key;
|
|
1505
|
+
for (key in check) {
|
|
1506
|
+
if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
1507
|
+
}
|
|
1508
|
+
return true;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
function typeFactory(check) {
|
|
1512
|
+
return castFactory(type);
|
|
1513
|
+
function type(node2) {
|
|
1514
|
+
return node2 && node2.type === check;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
function castFactory(testFunction) {
|
|
1518
|
+
return check;
|
|
1519
|
+
function check(value, index, parent) {
|
|
1520
|
+
return Boolean(
|
|
1521
|
+
looksLikeANode(value) && testFunction.call(
|
|
1522
|
+
this,
|
|
1523
|
+
value,
|
|
1524
|
+
typeof index === "number" ? index : void 0,
|
|
1525
|
+
parent || void 0
|
|
1526
|
+
)
|
|
1527
|
+
);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
function ok2() {
|
|
1531
|
+
return true;
|
|
1532
|
+
}
|
|
1533
|
+
function looksLikeANode(value) {
|
|
1534
|
+
return value !== null && typeof value === "object" && "type" in value;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
// ../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.node.js
|
|
1538
|
+
function color(d) {
|
|
1539
|
+
return "\x1B[33m" + d + "\x1B[39m";
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// ../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js
|
|
1543
|
+
var empty = [];
|
|
1544
|
+
var CONTINUE = true;
|
|
1545
|
+
var EXIT = false;
|
|
1546
|
+
var SKIP = "skip";
|
|
1547
|
+
function visitParents(tree, test, visitor, reverse) {
|
|
1548
|
+
let check;
|
|
1549
|
+
if (typeof test === "function" && typeof visitor !== "function") {
|
|
1550
|
+
reverse = visitor;
|
|
1551
|
+
visitor = test;
|
|
1552
|
+
} else {
|
|
1553
|
+
check = test;
|
|
1554
|
+
}
|
|
1555
|
+
const is2 = convert(check);
|
|
1556
|
+
const step = reverse ? -1 : 1;
|
|
1557
|
+
factory(tree, void 0, [])();
|
|
1558
|
+
function factory(node2, index, parents) {
|
|
1559
|
+
const value = (
|
|
1560
|
+
/** @type {Record<string, unknown>} */
|
|
1561
|
+
node2 && typeof node2 === "object" ? node2 : {}
|
|
1562
|
+
);
|
|
1563
|
+
if (typeof value.type === "string") {
|
|
1564
|
+
const name = (
|
|
1565
|
+
// `hast`
|
|
1566
|
+
typeof value.tagName === "string" ? value.tagName : (
|
|
1567
|
+
// `xast`
|
|
1568
|
+
typeof value.name === "string" ? value.name : void 0
|
|
1569
|
+
)
|
|
1570
|
+
);
|
|
1571
|
+
Object.defineProperty(visit3, "name", {
|
|
1572
|
+
value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")"
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
return visit3;
|
|
1576
|
+
function visit3() {
|
|
1577
|
+
let result = empty;
|
|
1578
|
+
let subresult;
|
|
1579
|
+
let offset;
|
|
1580
|
+
let grandparents;
|
|
1581
|
+
if (!test || is2(node2, index, parents[parents.length - 1] || void 0)) {
|
|
1582
|
+
result = toResult(visitor(node2, parents));
|
|
1583
|
+
if (result[0] === EXIT) {
|
|
1584
|
+
return result;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
if ("children" in node2 && node2.children) {
|
|
1588
|
+
const nodeAsParent = (
|
|
1589
|
+
/** @type {UnistParent} */
|
|
1590
|
+
node2
|
|
1591
|
+
);
|
|
1592
|
+
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
1593
|
+
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
1594
|
+
grandparents = parents.concat(nodeAsParent);
|
|
1595
|
+
while (offset > -1 && offset < nodeAsParent.children.length) {
|
|
1596
|
+
const child = nodeAsParent.children[offset];
|
|
1597
|
+
subresult = factory(child, offset, grandparents)();
|
|
1598
|
+
if (subresult[0] === EXIT) {
|
|
1599
|
+
return subresult;
|
|
1600
|
+
}
|
|
1601
|
+
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
return result;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
function toResult(value) {
|
|
1610
|
+
if (Array.isArray(value)) {
|
|
1611
|
+
return value;
|
|
1612
|
+
}
|
|
1613
|
+
if (typeof value === "number") {
|
|
1614
|
+
return [CONTINUE, value];
|
|
1615
|
+
}
|
|
1616
|
+
return value === null || value === void 0 ? empty : [value];
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
// ../../node_modules/.pnpm/mdast-util-find-and-replace@3.0.2/node_modules/mdast-util-find-and-replace/lib/index.js
|
|
1620
|
+
function findAndReplace(tree, list2, options) {
|
|
1621
|
+
const settings = options || {};
|
|
1622
|
+
const ignored = convert(settings.ignore || []);
|
|
1623
|
+
const pairs = toPairs(list2);
|
|
1624
|
+
let pairIndex = -1;
|
|
1625
|
+
while (++pairIndex < pairs.length) {
|
|
1626
|
+
visitParents(tree, "text", visitor);
|
|
1627
|
+
}
|
|
1628
|
+
function visitor(node2, parents) {
|
|
1629
|
+
let index = -1;
|
|
1630
|
+
let grandparent;
|
|
1631
|
+
while (++index < parents.length) {
|
|
1632
|
+
const parent = parents[index];
|
|
1633
|
+
const siblings = grandparent ? grandparent.children : void 0;
|
|
1634
|
+
if (ignored(
|
|
1635
|
+
parent,
|
|
1636
|
+
siblings ? siblings.indexOf(parent) : void 0,
|
|
1637
|
+
grandparent
|
|
1638
|
+
)) {
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
grandparent = parent;
|
|
1642
|
+
}
|
|
1643
|
+
if (grandparent) {
|
|
1644
|
+
return handler(node2, parents);
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
function handler(node2, parents) {
|
|
1648
|
+
const parent = parents[parents.length - 1];
|
|
1649
|
+
const find = pairs[pairIndex][0];
|
|
1650
|
+
const replace2 = pairs[pairIndex][1];
|
|
1651
|
+
let start = 0;
|
|
1652
|
+
const siblings = parent.children;
|
|
1653
|
+
const index = siblings.indexOf(node2);
|
|
1654
|
+
let change = false;
|
|
1655
|
+
let nodes = [];
|
|
1656
|
+
find.lastIndex = 0;
|
|
1657
|
+
let match = find.exec(node2.value);
|
|
1658
|
+
while (match) {
|
|
1659
|
+
const position = match.index;
|
|
1660
|
+
const matchObject = {
|
|
1661
|
+
index: match.index,
|
|
1662
|
+
input: match.input,
|
|
1663
|
+
stack: [...parents, node2]
|
|
1664
|
+
};
|
|
1665
|
+
let value = replace2(...match, matchObject);
|
|
1666
|
+
if (typeof value === "string") {
|
|
1667
|
+
value = value.length > 0 ? { type: "text", value } : void 0;
|
|
1668
|
+
}
|
|
1669
|
+
if (value === false) {
|
|
1670
|
+
find.lastIndex = position + 1;
|
|
1671
|
+
} else {
|
|
1672
|
+
if (start !== position) {
|
|
1673
|
+
nodes.push({
|
|
1674
|
+
type: "text",
|
|
1675
|
+
value: node2.value.slice(start, position)
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
if (Array.isArray(value)) {
|
|
1679
|
+
nodes.push(...value);
|
|
1680
|
+
} else if (value) {
|
|
1681
|
+
nodes.push(value);
|
|
1682
|
+
}
|
|
1683
|
+
start = position + match[0].length;
|
|
1684
|
+
change = true;
|
|
1685
|
+
}
|
|
1686
|
+
if (!find.global) {
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
match = find.exec(node2.value);
|
|
1690
|
+
}
|
|
1691
|
+
if (change) {
|
|
1692
|
+
if (start < node2.value.length) {
|
|
1693
|
+
nodes.push({ type: "text", value: node2.value.slice(start) });
|
|
1694
|
+
}
|
|
1695
|
+
parent.children.splice(index, 1, ...nodes);
|
|
1696
|
+
} else {
|
|
1697
|
+
nodes = [node2];
|
|
1698
|
+
}
|
|
1699
|
+
return index + nodes.length;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
function toPairs(tupleOrList) {
|
|
1703
|
+
const result = [];
|
|
1704
|
+
if (!Array.isArray(tupleOrList)) {
|
|
1705
|
+
throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
1706
|
+
}
|
|
1707
|
+
const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
|
|
1708
|
+
let index = -1;
|
|
1709
|
+
while (++index < list2.length) {
|
|
1710
|
+
const tuple = list2[index];
|
|
1711
|
+
result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
|
|
1712
|
+
}
|
|
1713
|
+
return result;
|
|
1714
|
+
}
|
|
1715
|
+
function toExpression(find) {
|
|
1716
|
+
return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
|
|
1717
|
+
}
|
|
1718
|
+
function toFunction(replace2) {
|
|
1719
|
+
return typeof replace2 === "function" ? replace2 : function() {
|
|
1720
|
+
return replace2;
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
// ../../node_modules/.pnpm/mdast-util-gfm-autolink-literal@2.0.1/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
|
|
1725
|
+
var inConstruct = "phrasing";
|
|
1726
|
+
var notInConstruct = ["autolink", "link", "image", "label"];
|
|
1727
|
+
function gfmAutolinkLiteralFromMarkdown() {
|
|
1728
|
+
return {
|
|
1729
|
+
transforms: [transformGfmAutolinkLiterals],
|
|
1730
|
+
enter: {
|
|
1731
|
+
literalAutolink: enterLiteralAutolink,
|
|
1732
|
+
literalAutolinkEmail: enterLiteralAutolinkValue,
|
|
1733
|
+
literalAutolinkHttp: enterLiteralAutolinkValue,
|
|
1734
|
+
literalAutolinkWww: enterLiteralAutolinkValue
|
|
1735
|
+
},
|
|
1736
|
+
exit: {
|
|
1737
|
+
literalAutolink: exitLiteralAutolink,
|
|
1738
|
+
literalAutolinkEmail: exitLiteralAutolinkEmail,
|
|
1739
|
+
literalAutolinkHttp: exitLiteralAutolinkHttp,
|
|
1740
|
+
literalAutolinkWww: exitLiteralAutolinkWww
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
function gfmAutolinkLiteralToMarkdown() {
|
|
1745
|
+
return {
|
|
1746
|
+
unsafe: [
|
|
1747
|
+
{
|
|
1748
|
+
character: "@",
|
|
1749
|
+
before: "[+\\-.\\w]",
|
|
1750
|
+
after: "[\\-.\\w]",
|
|
1751
|
+
inConstruct,
|
|
1752
|
+
notInConstruct
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
character: ".",
|
|
1756
|
+
before: "[Ww]",
|
|
1757
|
+
after: "[\\-.\\w]",
|
|
1758
|
+
inConstruct,
|
|
1759
|
+
notInConstruct
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
character: ":",
|
|
1763
|
+
before: "[ps]",
|
|
1764
|
+
after: "\\/",
|
|
1765
|
+
inConstruct,
|
|
1766
|
+
notInConstruct
|
|
1767
|
+
}
|
|
1768
|
+
]
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
function enterLiteralAutolink(token) {
|
|
1772
|
+
this.enter({ type: "link", title: null, url: "", children: [] }, token);
|
|
1773
|
+
}
|
|
1774
|
+
function enterLiteralAutolinkValue(token) {
|
|
1775
|
+
this.config.enter.autolinkProtocol.call(this, token);
|
|
1776
|
+
}
|
|
1777
|
+
function exitLiteralAutolinkHttp(token) {
|
|
1778
|
+
this.config.exit.autolinkProtocol.call(this, token);
|
|
1779
|
+
}
|
|
1780
|
+
function exitLiteralAutolinkWww(token) {
|
|
1781
|
+
this.config.exit.data.call(this, token);
|
|
1782
|
+
const node2 = this.stack[this.stack.length - 1];
|
|
1783
|
+
ok(node2.type === "link");
|
|
1784
|
+
node2.url = "http://" + this.sliceSerialize(token);
|
|
1785
|
+
}
|
|
1786
|
+
function exitLiteralAutolinkEmail(token) {
|
|
1787
|
+
this.config.exit.autolinkEmail.call(this, token);
|
|
1788
|
+
}
|
|
1789
|
+
function exitLiteralAutolink(token) {
|
|
1790
|
+
this.exit(token);
|
|
1791
|
+
}
|
|
1792
|
+
function transformGfmAutolinkLiterals(tree) {
|
|
1793
|
+
findAndReplace(
|
|
1794
|
+
tree,
|
|
1795
|
+
[
|
|
1796
|
+
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
|
|
1797
|
+
[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)", "gu"), findEmail]
|
|
1798
|
+
],
|
|
1799
|
+
{ ignore: ["link", "linkReference"] }
|
|
1800
|
+
);
|
|
1801
|
+
}
|
|
1802
|
+
function findUrl(_, protocol, domain2, path16, match) {
|
|
1803
|
+
let prefix = "";
|
|
1804
|
+
if (!previous(match)) {
|
|
1805
|
+
return false;
|
|
1806
|
+
}
|
|
1807
|
+
if (/^w/i.test(protocol)) {
|
|
1808
|
+
domain2 = protocol + domain2;
|
|
1809
|
+
protocol = "";
|
|
1810
|
+
prefix = "http://";
|
|
1811
|
+
}
|
|
1812
|
+
if (!isCorrectDomain(domain2)) {
|
|
1813
|
+
return false;
|
|
1814
|
+
}
|
|
1815
|
+
const parts = splitUrl(domain2 + path16);
|
|
1816
|
+
if (!parts[0]) return false;
|
|
1817
|
+
const result = {
|
|
1818
|
+
type: "link",
|
|
1819
|
+
title: null,
|
|
1820
|
+
url: prefix + protocol + parts[0],
|
|
1821
|
+
children: [{ type: "text", value: protocol + parts[0] }]
|
|
1822
|
+
};
|
|
1823
|
+
if (parts[1]) {
|
|
1824
|
+
return [result, { type: "text", value: parts[1] }];
|
|
1825
|
+
}
|
|
1826
|
+
return result;
|
|
1827
|
+
}
|
|
1828
|
+
function findEmail(_, atext, label, match) {
|
|
1829
|
+
if (
|
|
1830
|
+
// Not an expected previous character.
|
|
1831
|
+
!previous(match, true) || // Label ends in not allowed character.
|
|
1832
|
+
/[-\d_]$/.test(label)
|
|
1833
|
+
) {
|
|
1834
|
+
return false;
|
|
1835
|
+
}
|
|
1836
|
+
return {
|
|
1837
|
+
type: "link",
|
|
1838
|
+
title: null,
|
|
1839
|
+
url: "mailto:" + atext + "@" + label,
|
|
1840
|
+
children: [{ type: "text", value: atext + "@" + label }]
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
function isCorrectDomain(domain2) {
|
|
1844
|
+
const parts = domain2.split(".");
|
|
1845
|
+
if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) {
|
|
1846
|
+
return false;
|
|
1847
|
+
}
|
|
1848
|
+
return true;
|
|
1849
|
+
}
|
|
1850
|
+
function splitUrl(url) {
|
|
1851
|
+
const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
|
|
1852
|
+
if (!trailExec) {
|
|
1853
|
+
return [url, void 0];
|
|
1854
|
+
}
|
|
1855
|
+
url = url.slice(0, trailExec.index);
|
|
1856
|
+
let trail2 = trailExec[0];
|
|
1857
|
+
let closingParenIndex = trail2.indexOf(")");
|
|
1858
|
+
const openingParens = ccount(url, "(");
|
|
1859
|
+
let closingParens = ccount(url, ")");
|
|
1860
|
+
while (closingParenIndex !== -1 && openingParens > closingParens) {
|
|
1861
|
+
url += trail2.slice(0, closingParenIndex + 1);
|
|
1862
|
+
trail2 = trail2.slice(closingParenIndex + 1);
|
|
1863
|
+
closingParenIndex = trail2.indexOf(")");
|
|
1864
|
+
closingParens++;
|
|
1865
|
+
}
|
|
1866
|
+
return [url, trail2];
|
|
1867
|
+
}
|
|
1868
|
+
function previous(match, email) {
|
|
1869
|
+
const code3 = match.input.charCodeAt(match.index - 1);
|
|
1870
|
+
return (match.index === 0 || unicodeWhitespace(code3) || unicodePunctuation(code3)) && // If it’s an email, the previous character should not be a slash.
|
|
1871
|
+
(!email || code3 !== 47);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// ../../node_modules/.pnpm/micromark-util-normalize-identifier@2.0.1/node_modules/micromark-util-normalize-identifier/index.js
|
|
1875
|
+
function normalizeIdentifier(value) {
|
|
1876
|
+
return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
// ../../node_modules/.pnpm/mdast-util-gfm-footnote@2.1.0/node_modules/mdast-util-gfm-footnote/lib/index.js
|
|
1880
|
+
footnoteReference.peek = footnoteReferencePeek;
|
|
1881
|
+
function enterFootnoteCallString() {
|
|
1882
|
+
this.buffer();
|
|
1883
|
+
}
|
|
1884
|
+
function enterFootnoteCall(token) {
|
|
1885
|
+
this.enter({ type: "footnoteReference", identifier: "", label: "" }, token);
|
|
1886
|
+
}
|
|
1887
|
+
function enterFootnoteDefinitionLabelString() {
|
|
1888
|
+
this.buffer();
|
|
1889
|
+
}
|
|
1890
|
+
function enterFootnoteDefinition(token) {
|
|
1891
|
+
this.enter(
|
|
1892
|
+
{ type: "footnoteDefinition", identifier: "", label: "", children: [] },
|
|
1893
|
+
token
|
|
1894
|
+
);
|
|
1895
|
+
}
|
|
1896
|
+
function exitFootnoteCallString(token) {
|
|
1897
|
+
const label = this.resume();
|
|
1898
|
+
const node2 = this.stack[this.stack.length - 1];
|
|
1899
|
+
ok(node2.type === "footnoteReference");
|
|
1900
|
+
node2.identifier = normalizeIdentifier(
|
|
1901
|
+
this.sliceSerialize(token)
|
|
1902
|
+
).toLowerCase();
|
|
1903
|
+
node2.label = label;
|
|
1904
|
+
}
|
|
1905
|
+
function exitFootnoteCall(token) {
|
|
1906
|
+
this.exit(token);
|
|
1907
|
+
}
|
|
1908
|
+
function exitFootnoteDefinitionLabelString(token) {
|
|
1909
|
+
const label = this.resume();
|
|
1910
|
+
const node2 = this.stack[this.stack.length - 1];
|
|
1911
|
+
ok(node2.type === "footnoteDefinition");
|
|
1912
|
+
node2.identifier = normalizeIdentifier(
|
|
1913
|
+
this.sliceSerialize(token)
|
|
1914
|
+
).toLowerCase();
|
|
1915
|
+
node2.label = label;
|
|
1916
|
+
}
|
|
1917
|
+
function exitFootnoteDefinition(token) {
|
|
1918
|
+
this.exit(token);
|
|
1919
|
+
}
|
|
1920
|
+
function footnoteReferencePeek() {
|
|
1921
|
+
return "[";
|
|
1922
|
+
}
|
|
1923
|
+
function footnoteReference(node2, _, state, info) {
|
|
1924
|
+
const tracker = state.createTracker(info);
|
|
1925
|
+
let value = tracker.move("[^");
|
|
1926
|
+
const exit2 = state.enter("footnoteReference");
|
|
1927
|
+
const subexit = state.enter("reference");
|
|
1928
|
+
value += tracker.move(
|
|
1929
|
+
state.safe(state.associationId(node2), { after: "]", before: value })
|
|
1930
|
+
);
|
|
1931
|
+
subexit();
|
|
1932
|
+
exit2();
|
|
1933
|
+
value += tracker.move("]");
|
|
1934
|
+
return value;
|
|
1935
|
+
}
|
|
1936
|
+
function gfmFootnoteFromMarkdown() {
|
|
1937
|
+
return {
|
|
1938
|
+
enter: {
|
|
1939
|
+
gfmFootnoteCallString: enterFootnoteCallString,
|
|
1940
|
+
gfmFootnoteCall: enterFootnoteCall,
|
|
1941
|
+
gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
|
|
1942
|
+
gfmFootnoteDefinition: enterFootnoteDefinition
|
|
1943
|
+
},
|
|
1944
|
+
exit: {
|
|
1945
|
+
gfmFootnoteCallString: exitFootnoteCallString,
|
|
1946
|
+
gfmFootnoteCall: exitFootnoteCall,
|
|
1947
|
+
gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
|
|
1948
|
+
gfmFootnoteDefinition: exitFootnoteDefinition
|
|
1949
|
+
}
|
|
1950
|
+
};
|
|
1951
|
+
}
|
|
1952
|
+
function gfmFootnoteToMarkdown(options) {
|
|
1953
|
+
let firstLineBlank = false;
|
|
1954
|
+
if (options && options.firstLineBlank) {
|
|
1955
|
+
firstLineBlank = true;
|
|
1956
|
+
}
|
|
1957
|
+
return {
|
|
1958
|
+
handlers: { footnoteDefinition, footnoteReference },
|
|
1959
|
+
// This is on by default already.
|
|
1960
|
+
unsafe: [{ character: "[", inConstruct: ["label", "phrasing", "reference"] }]
|
|
1961
|
+
};
|
|
1962
|
+
function footnoteDefinition(node2, _, state, info) {
|
|
1963
|
+
const tracker = state.createTracker(info);
|
|
1964
|
+
let value = tracker.move("[^");
|
|
1965
|
+
const exit2 = state.enter("footnoteDefinition");
|
|
1966
|
+
const subexit = state.enter("label");
|
|
1967
|
+
value += tracker.move(
|
|
1968
|
+
state.safe(state.associationId(node2), { before: value, after: "]" })
|
|
1969
|
+
);
|
|
1970
|
+
subexit();
|
|
1971
|
+
value += tracker.move("]:");
|
|
1972
|
+
if (node2.children && node2.children.length > 0) {
|
|
1973
|
+
tracker.shift(4);
|
|
1974
|
+
value += tracker.move(
|
|
1975
|
+
(firstLineBlank ? "\n" : " ") + state.indentLines(
|
|
1976
|
+
state.containerFlow(node2, tracker.current()),
|
|
1977
|
+
firstLineBlank ? mapAll : mapExceptFirst
|
|
1978
|
+
)
|
|
1979
|
+
);
|
|
1980
|
+
}
|
|
1981
|
+
exit2();
|
|
1982
|
+
return value;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
function mapExceptFirst(line, index, blank) {
|
|
1986
|
+
return index === 0 ? line : mapAll(line, index, blank);
|
|
1987
|
+
}
|
|
1988
|
+
function mapAll(line, index, blank) {
|
|
1989
|
+
return (blank ? "" : " ") + line;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
// ../../node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.0/node_modules/mdast-util-gfm-strikethrough/lib/index.js
|
|
1993
|
+
var constructsWithoutStrikethrough = [
|
|
1994
|
+
"autolink",
|
|
1995
|
+
"destinationLiteral",
|
|
1996
|
+
"destinationRaw",
|
|
1997
|
+
"reference",
|
|
1998
|
+
"titleQuote",
|
|
1999
|
+
"titleApostrophe"
|
|
2000
|
+
];
|
|
2001
|
+
handleDelete.peek = peekDelete;
|
|
2002
|
+
function gfmStrikethroughFromMarkdown() {
|
|
2003
|
+
return {
|
|
2004
|
+
canContainEols: ["delete"],
|
|
2005
|
+
enter: { strikethrough: enterStrikethrough },
|
|
2006
|
+
exit: { strikethrough: exitStrikethrough }
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
function gfmStrikethroughToMarkdown() {
|
|
2010
|
+
return {
|
|
2011
|
+
unsafe: [
|
|
2012
|
+
{
|
|
2013
|
+
character: "~",
|
|
2014
|
+
inConstruct: "phrasing",
|
|
2015
|
+
notInConstruct: constructsWithoutStrikethrough
|
|
2016
|
+
}
|
|
2017
|
+
],
|
|
2018
|
+
handlers: { delete: handleDelete }
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
function enterStrikethrough(token) {
|
|
2022
|
+
this.enter({ type: "delete", children: [] }, token);
|
|
2023
|
+
}
|
|
2024
|
+
function exitStrikethrough(token) {
|
|
2025
|
+
this.exit(token);
|
|
2026
|
+
}
|
|
2027
|
+
function handleDelete(node2, _, state, info) {
|
|
2028
|
+
const tracker = state.createTracker(info);
|
|
2029
|
+
const exit2 = state.enter("strikethrough");
|
|
2030
|
+
let value = tracker.move("~~");
|
|
2031
|
+
value += state.containerPhrasing(node2, {
|
|
2032
|
+
...tracker.current(),
|
|
2033
|
+
before: value,
|
|
2034
|
+
after: "~"
|
|
2035
|
+
});
|
|
2036
|
+
value += tracker.move("~~");
|
|
2037
|
+
exit2();
|
|
2038
|
+
return value;
|
|
2039
|
+
}
|
|
2040
|
+
function peekDelete() {
|
|
2041
|
+
return "~";
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
// ../../node_modules/.pnpm/markdown-table@3.0.4/node_modules/markdown-table/index.js
|
|
2045
|
+
function defaultStringLength(value) {
|
|
2046
|
+
return value.length;
|
|
2047
|
+
}
|
|
2048
|
+
function markdownTable(table, options) {
|
|
2049
|
+
const settings = options || {};
|
|
2050
|
+
const align = (settings.align || []).concat();
|
|
2051
|
+
const stringLength = settings.stringLength || defaultStringLength;
|
|
2052
|
+
const alignments = [];
|
|
2053
|
+
const cellMatrix = [];
|
|
2054
|
+
const sizeMatrix = [];
|
|
2055
|
+
const longestCellByColumn = [];
|
|
2056
|
+
let mostCellsPerRow = 0;
|
|
2057
|
+
let rowIndex = -1;
|
|
2058
|
+
while (++rowIndex < table.length) {
|
|
2059
|
+
const row2 = [];
|
|
2060
|
+
const sizes2 = [];
|
|
2061
|
+
let columnIndex2 = -1;
|
|
2062
|
+
if (table[rowIndex].length > mostCellsPerRow) {
|
|
2063
|
+
mostCellsPerRow = table[rowIndex].length;
|
|
2064
|
+
}
|
|
2065
|
+
while (++columnIndex2 < table[rowIndex].length) {
|
|
2066
|
+
const cell = serialize(table[rowIndex][columnIndex2]);
|
|
2067
|
+
if (settings.alignDelimiters !== false) {
|
|
2068
|
+
const size = stringLength(cell);
|
|
2069
|
+
sizes2[columnIndex2] = size;
|
|
2070
|
+
if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
|
|
2071
|
+
longestCellByColumn[columnIndex2] = size;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
row2.push(cell);
|
|
2075
|
+
}
|
|
2076
|
+
cellMatrix[rowIndex] = row2;
|
|
2077
|
+
sizeMatrix[rowIndex] = sizes2;
|
|
2078
|
+
}
|
|
2079
|
+
let columnIndex = -1;
|
|
2080
|
+
if (typeof align === "object" && "length" in align) {
|
|
2081
|
+
while (++columnIndex < mostCellsPerRow) {
|
|
2082
|
+
alignments[columnIndex] = toAlignment(align[columnIndex]);
|
|
2083
|
+
}
|
|
2084
|
+
} else {
|
|
2085
|
+
const code3 = toAlignment(align);
|
|
2086
|
+
while (++columnIndex < mostCellsPerRow) {
|
|
2087
|
+
alignments[columnIndex] = code3;
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
columnIndex = -1;
|
|
2091
|
+
const row = [];
|
|
2092
|
+
const sizes = [];
|
|
2093
|
+
while (++columnIndex < mostCellsPerRow) {
|
|
2094
|
+
const code3 = alignments[columnIndex];
|
|
2095
|
+
let before = "";
|
|
2096
|
+
let after = "";
|
|
2097
|
+
if (code3 === 99) {
|
|
2098
|
+
before = ":";
|
|
2099
|
+
after = ":";
|
|
2100
|
+
} else if (code3 === 108) {
|
|
2101
|
+
before = ":";
|
|
2102
|
+
} else if (code3 === 114) {
|
|
2103
|
+
after = ":";
|
|
2104
|
+
}
|
|
2105
|
+
let size = settings.alignDelimiters === false ? 1 : Math.max(
|
|
2106
|
+
1,
|
|
2107
|
+
longestCellByColumn[columnIndex] - before.length - after.length
|
|
2108
|
+
);
|
|
2109
|
+
const cell = before + "-".repeat(size) + after;
|
|
2110
|
+
if (settings.alignDelimiters !== false) {
|
|
2111
|
+
size = before.length + size + after.length;
|
|
2112
|
+
if (size > longestCellByColumn[columnIndex]) {
|
|
2113
|
+
longestCellByColumn[columnIndex] = size;
|
|
2114
|
+
}
|
|
2115
|
+
sizes[columnIndex] = size;
|
|
2116
|
+
}
|
|
2117
|
+
row[columnIndex] = cell;
|
|
2118
|
+
}
|
|
2119
|
+
cellMatrix.splice(1, 0, row);
|
|
2120
|
+
sizeMatrix.splice(1, 0, sizes);
|
|
2121
|
+
rowIndex = -1;
|
|
2122
|
+
const lines = [];
|
|
2123
|
+
while (++rowIndex < cellMatrix.length) {
|
|
2124
|
+
const row2 = cellMatrix[rowIndex];
|
|
2125
|
+
const sizes2 = sizeMatrix[rowIndex];
|
|
2126
|
+
columnIndex = -1;
|
|
2127
|
+
const line = [];
|
|
2128
|
+
while (++columnIndex < mostCellsPerRow) {
|
|
2129
|
+
const cell = row2[columnIndex] || "";
|
|
2130
|
+
let before = "";
|
|
2131
|
+
let after = "";
|
|
2132
|
+
if (settings.alignDelimiters !== false) {
|
|
2133
|
+
const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
|
|
2134
|
+
const code3 = alignments[columnIndex];
|
|
2135
|
+
if (code3 === 114) {
|
|
2136
|
+
before = " ".repeat(size);
|
|
2137
|
+
} else if (code3 === 99) {
|
|
2138
|
+
if (size % 2) {
|
|
2139
|
+
before = " ".repeat(size / 2 + 0.5);
|
|
2140
|
+
after = " ".repeat(size / 2 - 0.5);
|
|
2141
|
+
} else {
|
|
2142
|
+
before = " ".repeat(size / 2);
|
|
2143
|
+
after = before;
|
|
2144
|
+
}
|
|
2145
|
+
} else {
|
|
2146
|
+
after = " ".repeat(size);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
if (settings.delimiterStart !== false && !columnIndex) {
|
|
2150
|
+
line.push("|");
|
|
2151
|
+
}
|
|
2152
|
+
if (settings.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is
|
|
2153
|
+
// empty: there will be a closing space.
|
|
2154
|
+
!(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
|
|
2155
|
+
line.push(" ");
|
|
2156
|
+
}
|
|
2157
|
+
if (settings.alignDelimiters !== false) {
|
|
2158
|
+
line.push(before);
|
|
2159
|
+
}
|
|
2160
|
+
line.push(cell);
|
|
2161
|
+
if (settings.alignDelimiters !== false) {
|
|
2162
|
+
line.push(after);
|
|
2163
|
+
}
|
|
2164
|
+
if (settings.padding !== false) {
|
|
2165
|
+
line.push(" ");
|
|
2166
|
+
}
|
|
2167
|
+
if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
|
|
2168
|
+
line.push("|");
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
lines.push(
|
|
2172
|
+
settings.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("")
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2175
|
+
return lines.join("\n");
|
|
2176
|
+
}
|
|
2177
|
+
function serialize(value) {
|
|
2178
|
+
return value === null || value === void 0 ? "" : String(value);
|
|
2179
|
+
}
|
|
2180
|
+
function toAlignment(value) {
|
|
2181
|
+
const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
|
|
2182
|
+
return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
|
|
2186
|
+
function blockquote(node2, _, state, info) {
|
|
2187
|
+
const exit2 = state.enter("blockquote");
|
|
2188
|
+
const tracker = state.createTracker(info);
|
|
2189
|
+
tracker.move("> ");
|
|
2190
|
+
tracker.shift(2);
|
|
2191
|
+
const value = state.indentLines(
|
|
2192
|
+
state.containerFlow(node2, tracker.current()),
|
|
2193
|
+
map
|
|
2194
|
+
);
|
|
2195
|
+
exit2();
|
|
2196
|
+
return value;
|
|
2197
|
+
}
|
|
2198
|
+
function map(line, _, blank) {
|
|
2199
|
+
return ">" + (blank ? "" : " ") + line;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
|
2203
|
+
function patternInScope(stack, pattern) {
|
|
2204
|
+
return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
|
|
2205
|
+
}
|
|
2206
|
+
function listInScope(stack, list2, none) {
|
|
2207
|
+
if (typeof list2 === "string") {
|
|
2208
|
+
list2 = [list2];
|
|
2209
|
+
}
|
|
2210
|
+
if (!list2 || list2.length === 0) {
|
|
2211
|
+
return none;
|
|
2212
|
+
}
|
|
2213
|
+
let index = -1;
|
|
2214
|
+
while (++index < list2.length) {
|
|
2215
|
+
if (stack.includes(list2[index])) {
|
|
2216
|
+
return true;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
return false;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/break.js
|
|
2223
|
+
function hardBreak(_, _1, state, info) {
|
|
2224
|
+
let index = -1;
|
|
2225
|
+
while (++index < state.unsafe.length) {
|
|
2226
|
+
if (state.unsafe[index].character === "\n" && patternInScope(state.stack, state.unsafe[index])) {
|
|
2227
|
+
return /[ \t]/.test(info.before) ? "" : " ";
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
return "\\\n";
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
// ../../node_modules/.pnpm/longest-streak@3.1.0/node_modules/longest-streak/index.js
|
|
2234
|
+
function longestStreak(value, substring) {
|
|
2235
|
+
const source = String(value);
|
|
2236
|
+
let index = source.indexOf(substring);
|
|
2237
|
+
let expected = index;
|
|
2238
|
+
let count = 0;
|
|
2239
|
+
let max = 0;
|
|
2240
|
+
if (typeof substring !== "string") {
|
|
2241
|
+
throw new TypeError("Expected substring");
|
|
2242
|
+
}
|
|
2243
|
+
while (index !== -1) {
|
|
2244
|
+
if (index === expected) {
|
|
2245
|
+
if (++count > max) {
|
|
2246
|
+
max = count;
|
|
2247
|
+
}
|
|
2248
|
+
} else {
|
|
2249
|
+
count = 1;
|
|
2250
|
+
}
|
|
2251
|
+
expected = index + substring.length;
|
|
2252
|
+
index = source.indexOf(substring, expected);
|
|
2253
|
+
}
|
|
2254
|
+
return max;
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
|
|
2258
|
+
function formatCodeAsIndented(node2, state) {
|
|
2259
|
+
return Boolean(
|
|
2260
|
+
state.options.fences === false && node2.value && // If there’s no info…
|
|
2261
|
+
!node2.lang && // And there’s a non-whitespace character…
|
|
2262
|
+
/[^ \r\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…
|
|
2263
|
+
!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
|
|
2264
|
+
);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-fence.js
|
|
2268
|
+
function checkFence(state) {
|
|
2269
|
+
const marker = state.options.fence || "`";
|
|
2270
|
+
if (marker !== "`" && marker !== "~") {
|
|
2271
|
+
throw new Error(
|
|
2272
|
+
"Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
|
|
2273
|
+
);
|
|
2274
|
+
}
|
|
2275
|
+
return marker;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/code.js
|
|
2279
|
+
function code(node2, _, state, info) {
|
|
2280
|
+
const marker = checkFence(state);
|
|
2281
|
+
const raw = node2.value || "";
|
|
2282
|
+
const suffix = marker === "`" ? "GraveAccent" : "Tilde";
|
|
2283
|
+
if (formatCodeAsIndented(node2, state)) {
|
|
2284
|
+
const exit3 = state.enter("codeIndented");
|
|
2285
|
+
const value2 = state.indentLines(raw, map2);
|
|
2286
|
+
exit3();
|
|
2287
|
+
return value2;
|
|
2288
|
+
}
|
|
2289
|
+
const tracker = state.createTracker(info);
|
|
2290
|
+
const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
|
|
2291
|
+
const exit2 = state.enter("codeFenced");
|
|
2292
|
+
let value = tracker.move(sequence);
|
|
2293
|
+
if (node2.lang) {
|
|
2294
|
+
const subexit = state.enter(`codeFencedLang${suffix}`);
|
|
2295
|
+
value += tracker.move(
|
|
2296
|
+
state.safe(node2.lang, {
|
|
2297
|
+
before: value,
|
|
2298
|
+
after: " ",
|
|
2299
|
+
encode: ["`"],
|
|
2300
|
+
...tracker.current()
|
|
2301
|
+
})
|
|
2302
|
+
);
|
|
2303
|
+
subexit();
|
|
2304
|
+
}
|
|
2305
|
+
if (node2.lang && node2.meta) {
|
|
2306
|
+
const subexit = state.enter(`codeFencedMeta${suffix}`);
|
|
2307
|
+
value += tracker.move(" ");
|
|
2308
|
+
value += tracker.move(
|
|
2309
|
+
state.safe(node2.meta, {
|
|
2310
|
+
before: value,
|
|
2311
|
+
after: "\n",
|
|
2312
|
+
encode: ["`"],
|
|
2313
|
+
...tracker.current()
|
|
2314
|
+
})
|
|
2315
|
+
);
|
|
2316
|
+
subexit();
|
|
2317
|
+
}
|
|
2318
|
+
value += tracker.move("\n");
|
|
2319
|
+
if (raw) {
|
|
2320
|
+
value += tracker.move(raw + "\n");
|
|
2321
|
+
}
|
|
2322
|
+
value += tracker.move(sequence);
|
|
2323
|
+
exit2();
|
|
2324
|
+
return value;
|
|
2325
|
+
}
|
|
2326
|
+
function map2(line, _, blank) {
|
|
2327
|
+
return (blank ? "" : " ") + line;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-quote.js
|
|
2331
|
+
function checkQuote(state) {
|
|
2332
|
+
const marker = state.options.quote || '"';
|
|
2333
|
+
if (marker !== '"' && marker !== "'") {
|
|
2334
|
+
throw new Error(
|
|
2335
|
+
"Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
return marker;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/definition.js
|
|
2342
|
+
function definition(node2, _, state, info) {
|
|
2343
|
+
const quote = checkQuote(state);
|
|
2344
|
+
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
|
2345
|
+
const exit2 = state.enter("definition");
|
|
2346
|
+
let subexit = state.enter("label");
|
|
2347
|
+
const tracker = state.createTracker(info);
|
|
2348
|
+
let value = tracker.move("[");
|
|
2349
|
+
value += tracker.move(
|
|
2350
|
+
state.safe(state.associationId(node2), {
|
|
2351
|
+
before: value,
|
|
2352
|
+
after: "]",
|
|
2353
|
+
...tracker.current()
|
|
2354
|
+
})
|
|
2355
|
+
);
|
|
2356
|
+
value += tracker.move("]: ");
|
|
2357
|
+
subexit();
|
|
2358
|
+
if (
|
|
2359
|
+
// If there’s no url, or…
|
|
2360
|
+
!node2.url || // If there are control characters or whitespace.
|
|
2361
|
+
/[\0- \u007F]/.test(node2.url)
|
|
2362
|
+
) {
|
|
2363
|
+
subexit = state.enter("destinationLiteral");
|
|
2364
|
+
value += tracker.move("<");
|
|
2365
|
+
value += tracker.move(
|
|
2366
|
+
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
|
|
2367
|
+
);
|
|
2368
|
+
value += tracker.move(">");
|
|
2369
|
+
} else {
|
|
2370
|
+
subexit = state.enter("destinationRaw");
|
|
2371
|
+
value += tracker.move(
|
|
2372
|
+
state.safe(node2.url, {
|
|
2373
|
+
before: value,
|
|
2374
|
+
after: node2.title ? " " : "\n",
|
|
2375
|
+
...tracker.current()
|
|
2376
|
+
})
|
|
2377
|
+
);
|
|
2378
|
+
}
|
|
2379
|
+
subexit();
|
|
2380
|
+
if (node2.title) {
|
|
2381
|
+
subexit = state.enter(`title${suffix}`);
|
|
2382
|
+
value += tracker.move(" " + quote);
|
|
2383
|
+
value += tracker.move(
|
|
2384
|
+
state.safe(node2.title, {
|
|
2385
|
+
before: value,
|
|
2386
|
+
after: quote,
|
|
2387
|
+
...tracker.current()
|
|
2388
|
+
})
|
|
2389
|
+
);
|
|
2390
|
+
value += tracker.move(quote);
|
|
2391
|
+
subexit();
|
|
2392
|
+
}
|
|
2393
|
+
exit2();
|
|
2394
|
+
return value;
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
|
|
2398
|
+
function checkEmphasis(state) {
|
|
2399
|
+
const marker = state.options.emphasis || "*";
|
|
2400
|
+
if (marker !== "*" && marker !== "_") {
|
|
2401
|
+
throw new Error(
|
|
2402
|
+
"Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
|
|
2403
|
+
);
|
|
2404
|
+
}
|
|
2405
|
+
return marker;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
|
|
2409
|
+
function encodeCharacterReference(code3) {
|
|
2410
|
+
return "&#x" + code3.toString(16).toUpperCase() + ";";
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
// ../../node_modules/.pnpm/micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.js
|
|
2414
|
+
function classifyCharacter(code3) {
|
|
2415
|
+
if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
|
|
2416
|
+
return 1;
|
|
2417
|
+
}
|
|
2418
|
+
if (unicodePunctuation(code3)) {
|
|
2419
|
+
return 2;
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/encode-info.js
|
|
2424
|
+
function encodeInfo(outside, inside, marker) {
|
|
2425
|
+
const outsideKind = classifyCharacter(outside);
|
|
2426
|
+
const insideKind = classifyCharacter(inside);
|
|
2427
|
+
if (outsideKind === void 0) {
|
|
2428
|
+
return insideKind === void 0 ? (
|
|
2429
|
+
// Letter inside:
|
|
2430
|
+
// we have to encode *both* letters for `_` as it is looser.
|
|
2431
|
+
// it already forms for `*` (and GFMs `~`).
|
|
2432
|
+
marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false }
|
|
2433
|
+
) : insideKind === 1 ? (
|
|
2434
|
+
// Whitespace inside: encode both (letter, whitespace).
|
|
2435
|
+
{ inside: true, outside: true }
|
|
2436
|
+
) : (
|
|
2437
|
+
// Punctuation inside: encode outer (letter)
|
|
2438
|
+
{ inside: false, outside: true }
|
|
2439
|
+
);
|
|
2440
|
+
}
|
|
2441
|
+
if (outsideKind === 1) {
|
|
2442
|
+
return insideKind === void 0 ? (
|
|
2443
|
+
// Letter inside: already forms.
|
|
2444
|
+
{ inside: false, outside: false }
|
|
2445
|
+
) : insideKind === 1 ? (
|
|
2446
|
+
// Whitespace inside: encode both (whitespace).
|
|
2447
|
+
{ inside: true, outside: true }
|
|
2448
|
+
) : (
|
|
2449
|
+
// Punctuation inside: already forms.
|
|
2450
|
+
{ inside: false, outside: false }
|
|
2451
|
+
);
|
|
2452
|
+
}
|
|
2453
|
+
return insideKind === void 0 ? (
|
|
2454
|
+
// Letter inside: already forms.
|
|
2455
|
+
{ inside: false, outside: false }
|
|
2456
|
+
) : insideKind === 1 ? (
|
|
2457
|
+
// Whitespace inside: encode inner (whitespace).
|
|
2458
|
+
{ inside: true, outside: false }
|
|
2459
|
+
) : (
|
|
2460
|
+
// Punctuation inside: already forms.
|
|
2461
|
+
{ inside: false, outside: false }
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
|
|
2466
|
+
emphasis.peek = emphasisPeek;
|
|
2467
|
+
function emphasis(node2, _, state, info) {
|
|
2468
|
+
const marker = checkEmphasis(state);
|
|
2469
|
+
const exit2 = state.enter("emphasis");
|
|
2470
|
+
const tracker = state.createTracker(info);
|
|
2471
|
+
const before = tracker.move(marker);
|
|
2472
|
+
let between = tracker.move(
|
|
2473
|
+
state.containerPhrasing(node2, {
|
|
2474
|
+
after: marker,
|
|
2475
|
+
before,
|
|
2476
|
+
...tracker.current()
|
|
2477
|
+
})
|
|
2478
|
+
);
|
|
2479
|
+
const betweenHead = between.charCodeAt(0);
|
|
2480
|
+
const open = encodeInfo(
|
|
2481
|
+
info.before.charCodeAt(info.before.length - 1),
|
|
2482
|
+
betweenHead,
|
|
2483
|
+
marker
|
|
2484
|
+
);
|
|
2485
|
+
if (open.inside) {
|
|
2486
|
+
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
2487
|
+
}
|
|
2488
|
+
const betweenTail = between.charCodeAt(between.length - 1);
|
|
2489
|
+
const close2 = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
|
2490
|
+
if (close2.inside) {
|
|
2491
|
+
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
|
2492
|
+
}
|
|
2493
|
+
const after = tracker.move(marker);
|
|
2494
|
+
exit2();
|
|
2495
|
+
state.attentionEncodeSurroundingInfo = {
|
|
2496
|
+
after: close2.outside,
|
|
2497
|
+
before: open.outside
|
|
2498
|
+
};
|
|
2499
|
+
return before + between + after;
|
|
2500
|
+
}
|
|
2501
|
+
function emphasisPeek(_, _1, state) {
|
|
2502
|
+
return state.options.emphasis || "*";
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
|
|
2506
|
+
var import_unist_util_visit = require("unist-util-visit");
|
|
2507
|
+
|
|
2508
|
+
// ../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
|
|
2509
|
+
var emptyOptions = {};
|
|
2510
|
+
function toString(value, options) {
|
|
2511
|
+
const settings = options || emptyOptions;
|
|
2512
|
+
const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
|
|
2513
|
+
const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
|
|
2514
|
+
return one(value, includeImageAlt, includeHtml);
|
|
2515
|
+
}
|
|
2516
|
+
function one(value, includeImageAlt, includeHtml) {
|
|
2517
|
+
if (node(value)) {
|
|
2518
|
+
if ("value" in value) {
|
|
2519
|
+
return value.type === "html" && !includeHtml ? "" : value.value;
|
|
2520
|
+
}
|
|
2521
|
+
if (includeImageAlt && "alt" in value && value.alt) {
|
|
2522
|
+
return value.alt;
|
|
2523
|
+
}
|
|
2524
|
+
if ("children" in value) {
|
|
2525
|
+
return all(value.children, includeImageAlt, includeHtml);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
if (Array.isArray(value)) {
|
|
2529
|
+
return all(value, includeImageAlt, includeHtml);
|
|
2530
|
+
}
|
|
2531
|
+
return "";
|
|
2532
|
+
}
|
|
2533
|
+
function all(values, includeImageAlt, includeHtml) {
|
|
2534
|
+
const result = [];
|
|
2535
|
+
let index = -1;
|
|
2536
|
+
while (++index < values.length) {
|
|
2537
|
+
result[index] = one(values[index], includeImageAlt, includeHtml);
|
|
2538
|
+
}
|
|
2539
|
+
return result.join("");
|
|
2540
|
+
}
|
|
2541
|
+
function node(value) {
|
|
2542
|
+
return Boolean(value && typeof value === "object");
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
|
|
2546
|
+
function formatHeadingAsSetext(node2, state) {
|
|
2547
|
+
let literalWithBreak = false;
|
|
2548
|
+
(0, import_unist_util_visit.visit)(node2, function(node3) {
|
|
2549
|
+
if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
|
|
2550
|
+
literalWithBreak = true;
|
|
2551
|
+
return import_unist_util_visit.EXIT;
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
return Boolean(
|
|
2555
|
+
(!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
|
|
2556
|
+
);
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/heading.js
|
|
2560
|
+
function heading(node2, _, state, info) {
|
|
2561
|
+
const rank = Math.max(Math.min(6, node2.depth || 1), 1);
|
|
2562
|
+
const tracker = state.createTracker(info);
|
|
2563
|
+
if (formatHeadingAsSetext(node2, state)) {
|
|
2564
|
+
const exit3 = state.enter("headingSetext");
|
|
2565
|
+
const subexit2 = state.enter("phrasing");
|
|
2566
|
+
const value2 = state.containerPhrasing(node2, {
|
|
2567
|
+
...tracker.current(),
|
|
2568
|
+
before: "\n",
|
|
2569
|
+
after: "\n"
|
|
2570
|
+
});
|
|
2571
|
+
subexit2();
|
|
2572
|
+
exit3();
|
|
2573
|
+
return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
|
|
2574
|
+
// The whole size…
|
|
2575
|
+
value2.length - // Minus the position of the character after the last EOL (or
|
|
2576
|
+
// 0 if there is none)…
|
|
2577
|
+
(Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
|
|
2578
|
+
);
|
|
2579
|
+
}
|
|
2580
|
+
const sequence = "#".repeat(rank);
|
|
2581
|
+
const exit2 = state.enter("headingAtx");
|
|
2582
|
+
const subexit = state.enter("phrasing");
|
|
2583
|
+
tracker.move(sequence + " ");
|
|
2584
|
+
let value = state.containerPhrasing(node2, {
|
|
2585
|
+
before: "# ",
|
|
2586
|
+
after: "\n",
|
|
2587
|
+
...tracker.current()
|
|
2588
|
+
});
|
|
2589
|
+
if (/^[\t ]/.test(value)) {
|
|
2590
|
+
value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
|
|
2591
|
+
}
|
|
2592
|
+
value = value ? sequence + " " + value : sequence;
|
|
2593
|
+
if (state.options.closeAtx) {
|
|
2594
|
+
value += " " + sequence;
|
|
2595
|
+
}
|
|
2596
|
+
subexit();
|
|
2597
|
+
exit2();
|
|
2598
|
+
return value;
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/html.js
|
|
2602
|
+
html.peek = htmlPeek;
|
|
2603
|
+
function html(node2) {
|
|
2604
|
+
return node2.value || "";
|
|
2605
|
+
}
|
|
2606
|
+
function htmlPeek() {
|
|
2607
|
+
return "<";
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image.js
|
|
2611
|
+
image.peek = imagePeek;
|
|
2612
|
+
function image(node2, _, state, info) {
|
|
2613
|
+
const quote = checkQuote(state);
|
|
2614
|
+
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
|
2615
|
+
const exit2 = state.enter("image");
|
|
2616
|
+
let subexit = state.enter("label");
|
|
2617
|
+
const tracker = state.createTracker(info);
|
|
2618
|
+
let value = tracker.move("![");
|
|
2619
|
+
value += tracker.move(
|
|
2620
|
+
state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
|
|
2621
|
+
);
|
|
2622
|
+
value += tracker.move("](");
|
|
2623
|
+
subexit();
|
|
2624
|
+
if (
|
|
2625
|
+
// If there’s no url but there is a title…
|
|
2626
|
+
!node2.url && node2.title || // If there are control characters or whitespace.
|
|
2627
|
+
/[\0- \u007F]/.test(node2.url)
|
|
2628
|
+
) {
|
|
2629
|
+
subexit = state.enter("destinationLiteral");
|
|
2630
|
+
value += tracker.move("<");
|
|
2631
|
+
value += tracker.move(
|
|
2632
|
+
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
|
|
2633
|
+
);
|
|
2634
|
+
value += tracker.move(">");
|
|
2635
|
+
} else {
|
|
2636
|
+
subexit = state.enter("destinationRaw");
|
|
2637
|
+
value += tracker.move(
|
|
2638
|
+
state.safe(node2.url, {
|
|
2639
|
+
before: value,
|
|
2640
|
+
after: node2.title ? " " : ")",
|
|
2641
|
+
...tracker.current()
|
|
2642
|
+
})
|
|
2643
|
+
);
|
|
2644
|
+
}
|
|
2645
|
+
subexit();
|
|
2646
|
+
if (node2.title) {
|
|
2647
|
+
subexit = state.enter(`title${suffix}`);
|
|
2648
|
+
value += tracker.move(" " + quote);
|
|
2649
|
+
value += tracker.move(
|
|
2650
|
+
state.safe(node2.title, {
|
|
2651
|
+
before: value,
|
|
2652
|
+
after: quote,
|
|
2653
|
+
...tracker.current()
|
|
2654
|
+
})
|
|
2655
|
+
);
|
|
2656
|
+
value += tracker.move(quote);
|
|
2657
|
+
subexit();
|
|
2658
|
+
}
|
|
2659
|
+
value += tracker.move(")");
|
|
2660
|
+
exit2();
|
|
2661
|
+
return value;
|
|
2662
|
+
}
|
|
2663
|
+
function imagePeek() {
|
|
2664
|
+
return "!";
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
|
|
2668
|
+
imageReference.peek = imageReferencePeek;
|
|
2669
|
+
function imageReference(node2, _, state, info) {
|
|
2670
|
+
const type = node2.referenceType;
|
|
2671
|
+
const exit2 = state.enter("imageReference");
|
|
2672
|
+
let subexit = state.enter("label");
|
|
2673
|
+
const tracker = state.createTracker(info);
|
|
2674
|
+
let value = tracker.move("![");
|
|
2675
|
+
const alt = state.safe(node2.alt, {
|
|
2676
|
+
before: value,
|
|
2677
|
+
after: "]",
|
|
2678
|
+
...tracker.current()
|
|
2679
|
+
});
|
|
2680
|
+
value += tracker.move(alt + "][");
|
|
2681
|
+
subexit();
|
|
2682
|
+
const stack = state.stack;
|
|
2683
|
+
state.stack = [];
|
|
2684
|
+
subexit = state.enter("reference");
|
|
2685
|
+
const reference = state.safe(state.associationId(node2), {
|
|
2686
|
+
before: value,
|
|
2687
|
+
after: "]",
|
|
2688
|
+
...tracker.current()
|
|
2689
|
+
});
|
|
2690
|
+
subexit();
|
|
2691
|
+
state.stack = stack;
|
|
2692
|
+
exit2();
|
|
2693
|
+
if (type === "full" || !alt || alt !== reference) {
|
|
2694
|
+
value += tracker.move(reference + "]");
|
|
2695
|
+
} else if (type === "shortcut") {
|
|
2696
|
+
value = value.slice(0, -1);
|
|
2697
|
+
} else {
|
|
2698
|
+
value += tracker.move("]");
|
|
2699
|
+
}
|
|
2700
|
+
return value;
|
|
2701
|
+
}
|
|
2702
|
+
function imageReferencePeek() {
|
|
2703
|
+
return "!";
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
|
|
2707
|
+
inlineCode.peek = inlineCodePeek;
|
|
2708
|
+
function inlineCode(node2, _, state) {
|
|
2709
|
+
let value = node2.value || "";
|
|
2710
|
+
let sequence = "`";
|
|
2711
|
+
let index = -1;
|
|
2712
|
+
while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
|
|
2713
|
+
sequence += "`";
|
|
2714
|
+
}
|
|
2715
|
+
if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
|
|
2716
|
+
value = " " + value + " ";
|
|
2717
|
+
}
|
|
2718
|
+
while (++index < state.unsafe.length) {
|
|
2719
|
+
const pattern = state.unsafe[index];
|
|
2720
|
+
const expression = state.compilePattern(pattern);
|
|
2721
|
+
let match;
|
|
2722
|
+
if (!pattern.atBreak) continue;
|
|
2723
|
+
while (match = expression.exec(value)) {
|
|
2724
|
+
let position = match.index;
|
|
2725
|
+
if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
|
|
2726
|
+
position--;
|
|
2727
|
+
}
|
|
2728
|
+
value = value.slice(0, position) + " " + value.slice(match.index + 1);
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
return sequence + value + sequence;
|
|
2732
|
+
}
|
|
2733
|
+
function inlineCodePeek() {
|
|
2734
|
+
return "`";
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
|
|
2738
|
+
function formatLinkAsAutolink(node2, state) {
|
|
2739
|
+
const raw = toString(node2);
|
|
2740
|
+
return Boolean(
|
|
2741
|
+
!state.options.resourceLink && // If there’s a url…
|
|
2742
|
+
node2.url && // And there’s a no title…
|
|
2743
|
+
!node2.title && // And the content of `node` is a single text node…
|
|
2744
|
+
node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
|
|
2745
|
+
(raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
|
|
2746
|
+
/^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and
|
|
2747
|
+
// references don’t work), space, or angle brackets…
|
|
2748
|
+
!/[\0- <>\u007F]/.test(node2.url)
|
|
2749
|
+
);
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link.js
|
|
2753
|
+
link.peek = linkPeek;
|
|
2754
|
+
function link(node2, _, state, info) {
|
|
2755
|
+
const quote = checkQuote(state);
|
|
2756
|
+
const suffix = quote === '"' ? "Quote" : "Apostrophe";
|
|
2757
|
+
const tracker = state.createTracker(info);
|
|
2758
|
+
let exit2;
|
|
2759
|
+
let subexit;
|
|
2760
|
+
if (formatLinkAsAutolink(node2, state)) {
|
|
2761
|
+
const stack = state.stack;
|
|
2762
|
+
state.stack = [];
|
|
2763
|
+
exit2 = state.enter("autolink");
|
|
2764
|
+
let value2 = tracker.move("<");
|
|
2765
|
+
value2 += tracker.move(
|
|
2766
|
+
state.containerPhrasing(node2, {
|
|
2767
|
+
before: value2,
|
|
2768
|
+
after: ">",
|
|
2769
|
+
...tracker.current()
|
|
2770
|
+
})
|
|
2771
|
+
);
|
|
2772
|
+
value2 += tracker.move(">");
|
|
2773
|
+
exit2();
|
|
2774
|
+
state.stack = stack;
|
|
2775
|
+
return value2;
|
|
2776
|
+
}
|
|
2777
|
+
exit2 = state.enter("link");
|
|
2778
|
+
subexit = state.enter("label");
|
|
2779
|
+
let value = tracker.move("[");
|
|
2780
|
+
value += tracker.move(
|
|
2781
|
+
state.containerPhrasing(node2, {
|
|
2782
|
+
before: value,
|
|
2783
|
+
after: "](",
|
|
2784
|
+
...tracker.current()
|
|
2785
|
+
})
|
|
2786
|
+
);
|
|
2787
|
+
value += tracker.move("](");
|
|
2788
|
+
subexit();
|
|
2789
|
+
if (
|
|
2790
|
+
// If there’s no url but there is a title…
|
|
2791
|
+
!node2.url && node2.title || // If there are control characters or whitespace.
|
|
2792
|
+
/[\0- \u007F]/.test(node2.url)
|
|
2793
|
+
) {
|
|
2794
|
+
subexit = state.enter("destinationLiteral");
|
|
2795
|
+
value += tracker.move("<");
|
|
2796
|
+
value += tracker.move(
|
|
2797
|
+
state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
|
|
2798
|
+
);
|
|
2799
|
+
value += tracker.move(">");
|
|
2800
|
+
} else {
|
|
2801
|
+
subexit = state.enter("destinationRaw");
|
|
2802
|
+
value += tracker.move(
|
|
2803
|
+
state.safe(node2.url, {
|
|
2804
|
+
before: value,
|
|
2805
|
+
after: node2.title ? " " : ")",
|
|
2806
|
+
...tracker.current()
|
|
2807
|
+
})
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
subexit();
|
|
2811
|
+
if (node2.title) {
|
|
2812
|
+
subexit = state.enter(`title${suffix}`);
|
|
2813
|
+
value += tracker.move(" " + quote);
|
|
2814
|
+
value += tracker.move(
|
|
2815
|
+
state.safe(node2.title, {
|
|
2816
|
+
before: value,
|
|
2817
|
+
after: quote,
|
|
2818
|
+
...tracker.current()
|
|
2819
|
+
})
|
|
2820
|
+
);
|
|
2821
|
+
value += tracker.move(quote);
|
|
2822
|
+
subexit();
|
|
2823
|
+
}
|
|
2824
|
+
value += tracker.move(")");
|
|
2825
|
+
exit2();
|
|
2826
|
+
return value;
|
|
2827
|
+
}
|
|
2828
|
+
function linkPeek(node2, _, state) {
|
|
2829
|
+
return formatLinkAsAutolink(node2, state) ? "<" : "[";
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
|
|
2833
|
+
linkReference.peek = linkReferencePeek;
|
|
2834
|
+
function linkReference(node2, _, state, info) {
|
|
2835
|
+
const type = node2.referenceType;
|
|
2836
|
+
const exit2 = state.enter("linkReference");
|
|
2837
|
+
let subexit = state.enter("label");
|
|
2838
|
+
const tracker = state.createTracker(info);
|
|
2839
|
+
let value = tracker.move("[");
|
|
2840
|
+
const text3 = state.containerPhrasing(node2, {
|
|
2841
|
+
before: value,
|
|
2842
|
+
after: "]",
|
|
2843
|
+
...tracker.current()
|
|
2844
|
+
});
|
|
2845
|
+
value += tracker.move(text3 + "][");
|
|
2846
|
+
subexit();
|
|
2847
|
+
const stack = state.stack;
|
|
2848
|
+
state.stack = [];
|
|
2849
|
+
subexit = state.enter("reference");
|
|
2850
|
+
const reference = state.safe(state.associationId(node2), {
|
|
2851
|
+
before: value,
|
|
2852
|
+
after: "]",
|
|
2853
|
+
...tracker.current()
|
|
2854
|
+
});
|
|
2855
|
+
subexit();
|
|
2856
|
+
state.stack = stack;
|
|
2857
|
+
exit2();
|
|
2858
|
+
if (type === "full" || !text3 || text3 !== reference) {
|
|
2859
|
+
value += tracker.move(reference + "]");
|
|
2860
|
+
} else if (type === "shortcut") {
|
|
2861
|
+
value = value.slice(0, -1);
|
|
2862
|
+
} else {
|
|
2863
|
+
value += tracker.move("]");
|
|
2864
|
+
}
|
|
2865
|
+
return value;
|
|
2866
|
+
}
|
|
2867
|
+
function linkReferencePeek() {
|
|
2868
|
+
return "[";
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
|
2872
|
+
function checkBullet(state) {
|
|
2873
|
+
const marker = state.options.bullet || "*";
|
|
2874
|
+
if (marker !== "*" && marker !== "+" && marker !== "-") {
|
|
2875
|
+
throw new Error(
|
|
2876
|
+
"Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
|
|
2877
|
+
);
|
|
2878
|
+
}
|
|
2879
|
+
return marker;
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
|
|
2883
|
+
function checkBulletOther(state) {
|
|
2884
|
+
const bullet = checkBullet(state);
|
|
2885
|
+
const bulletOther = state.options.bulletOther;
|
|
2886
|
+
if (!bulletOther) {
|
|
2887
|
+
return bullet === "*" ? "-" : "*";
|
|
2888
|
+
}
|
|
2889
|
+
if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
|
|
2890
|
+
throw new Error(
|
|
2891
|
+
"Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
|
|
2892
|
+
);
|
|
2893
|
+
}
|
|
2894
|
+
if (bulletOther === bullet) {
|
|
2895
|
+
throw new Error(
|
|
2896
|
+
"Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
|
|
2897
|
+
);
|
|
2898
|
+
}
|
|
2899
|
+
return bulletOther;
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
|
|
2903
|
+
function checkBulletOrdered(state) {
|
|
2904
|
+
const marker = state.options.bulletOrdered || ".";
|
|
2905
|
+
if (marker !== "." && marker !== ")") {
|
|
2906
|
+
throw new Error(
|
|
2907
|
+
"Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
|
|
2908
|
+
);
|
|
2909
|
+
}
|
|
2910
|
+
return marker;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule.js
|
|
2914
|
+
function checkRule(state) {
|
|
2915
|
+
const marker = state.options.rule || "*";
|
|
2916
|
+
if (marker !== "*" && marker !== "-" && marker !== "_") {
|
|
2917
|
+
throw new Error(
|
|
2918
|
+
"Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
|
|
2919
|
+
);
|
|
2920
|
+
}
|
|
2921
|
+
return marker;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list.js
|
|
2925
|
+
function list(node2, parent, state, info) {
|
|
2926
|
+
const exit2 = state.enter("list");
|
|
2927
|
+
const bulletCurrent = state.bulletCurrent;
|
|
2928
|
+
let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
|
|
2929
|
+
const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
|
|
2930
|
+
let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
|
|
2931
|
+
if (!node2.ordered) {
|
|
2932
|
+
const firstListItem = node2.children ? node2.children[0] : void 0;
|
|
2933
|
+
if (
|
|
2934
|
+
// Bullet could be used as a thematic break marker:
|
|
2935
|
+
(bullet === "*" || bullet === "-") && // Empty first list item:
|
|
2936
|
+
firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
|
|
2937
|
+
state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
|
|
2938
|
+
state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
|
|
2939
|
+
) {
|
|
2940
|
+
useDifferentMarker = true;
|
|
2941
|
+
}
|
|
2942
|
+
if (checkRule(state) === bullet && firstListItem) {
|
|
2943
|
+
let index = -1;
|
|
2944
|
+
while (++index < node2.children.length) {
|
|
2945
|
+
const item = node2.children[index];
|
|
2946
|
+
if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
|
|
2947
|
+
useDifferentMarker = true;
|
|
2948
|
+
break;
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
if (useDifferentMarker) {
|
|
2954
|
+
bullet = bulletOther;
|
|
2955
|
+
}
|
|
2956
|
+
state.bulletCurrent = bullet;
|
|
2957
|
+
const value = state.containerFlow(node2, info);
|
|
2958
|
+
state.bulletLastUsed = bullet;
|
|
2959
|
+
state.bulletCurrent = bulletCurrent;
|
|
2960
|
+
exit2();
|
|
2961
|
+
return value;
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
|
2965
|
+
function checkListItemIndent(state) {
|
|
2966
|
+
const style = state.options.listItemIndent || "one";
|
|
2967
|
+
if (style !== "tab" && style !== "one" && style !== "mixed") {
|
|
2968
|
+
throw new Error(
|
|
2969
|
+
"Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
|
|
2970
|
+
);
|
|
2971
|
+
}
|
|
2972
|
+
return style;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/list-item.js
|
|
2976
|
+
function listItem(node2, parent, state, info) {
|
|
2977
|
+
const listItemIndent = checkListItemIndent(state);
|
|
2978
|
+
let bullet = state.bulletCurrent || checkBullet(state);
|
|
2979
|
+
if (parent && parent.type === "list" && parent.ordered) {
|
|
2980
|
+
bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
|
|
2981
|
+
}
|
|
2982
|
+
let size = bullet.length + 1;
|
|
2983
|
+
if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
|
|
2984
|
+
size = Math.ceil(size / 4) * 4;
|
|
2985
|
+
}
|
|
2986
|
+
const tracker = state.createTracker(info);
|
|
2987
|
+
tracker.move(bullet + " ".repeat(size - bullet.length));
|
|
2988
|
+
tracker.shift(size);
|
|
2989
|
+
const exit2 = state.enter("listItem");
|
|
2990
|
+
const value = state.indentLines(
|
|
2991
|
+
state.containerFlow(node2, tracker.current()),
|
|
2992
|
+
map3
|
|
2993
|
+
);
|
|
2994
|
+
exit2();
|
|
2995
|
+
return value;
|
|
2996
|
+
function map3(line, index, blank) {
|
|
2997
|
+
if (index) {
|
|
2998
|
+
return (blank ? "" : " ".repeat(size)) + line;
|
|
2999
|
+
}
|
|
3000
|
+
return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
|
|
3005
|
+
function paragraph(node2, _, state, info) {
|
|
3006
|
+
const exit2 = state.enter("paragraph");
|
|
3007
|
+
const subexit = state.enter("phrasing");
|
|
3008
|
+
const value = state.containerPhrasing(node2, info);
|
|
3009
|
+
subexit();
|
|
3010
|
+
exit2();
|
|
3011
|
+
return value;
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
// ../../node_modules/.pnpm/mdast-util-phrasing@4.1.0/node_modules/mdast-util-phrasing/lib/index.js
|
|
3015
|
+
var phrasing = (
|
|
3016
|
+
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
3017
|
+
convert([
|
|
3018
|
+
"break",
|
|
3019
|
+
"delete",
|
|
3020
|
+
"emphasis",
|
|
3021
|
+
// To do: next major: removed since footnotes were added to GFM.
|
|
3022
|
+
"footnote",
|
|
3023
|
+
"footnoteReference",
|
|
3024
|
+
"image",
|
|
3025
|
+
"imageReference",
|
|
3026
|
+
"inlineCode",
|
|
3027
|
+
// Enabled by `mdast-util-math`:
|
|
3028
|
+
"inlineMath",
|
|
3029
|
+
"link",
|
|
3030
|
+
"linkReference",
|
|
3031
|
+
// Enabled by `mdast-util-mdx`:
|
|
3032
|
+
"mdxJsxTextElement",
|
|
3033
|
+
// Enabled by `mdast-util-mdx`:
|
|
3034
|
+
"mdxTextExpression",
|
|
3035
|
+
"strong",
|
|
3036
|
+
"text",
|
|
3037
|
+
// Enabled by `mdast-util-directive`:
|
|
3038
|
+
"textDirective"
|
|
3039
|
+
])
|
|
3040
|
+
);
|
|
3041
|
+
|
|
3042
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/root.js
|
|
3043
|
+
function root(node2, _, state, info) {
|
|
3044
|
+
const hasPhrasing = node2.children.some(function(d) {
|
|
3045
|
+
return phrasing(d);
|
|
3046
|
+
});
|
|
3047
|
+
const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
|
|
3048
|
+
return container.call(state, node2, info);
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3051
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-strong.js
|
|
3052
|
+
function checkStrong(state) {
|
|
3053
|
+
const marker = state.options.strong || "*";
|
|
3054
|
+
if (marker !== "*" && marker !== "_") {
|
|
3055
|
+
throw new Error(
|
|
3056
|
+
"Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
|
|
3057
|
+
);
|
|
3058
|
+
}
|
|
3059
|
+
return marker;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/strong.js
|
|
3063
|
+
strong.peek = strongPeek;
|
|
3064
|
+
function strong(node2, _, state, info) {
|
|
3065
|
+
const marker = checkStrong(state);
|
|
3066
|
+
const exit2 = state.enter("strong");
|
|
3067
|
+
const tracker = state.createTracker(info);
|
|
3068
|
+
const before = tracker.move(marker + marker);
|
|
3069
|
+
let between = tracker.move(
|
|
3070
|
+
state.containerPhrasing(node2, {
|
|
3071
|
+
after: marker,
|
|
3072
|
+
before,
|
|
3073
|
+
...tracker.current()
|
|
3074
|
+
})
|
|
3075
|
+
);
|
|
3076
|
+
const betweenHead = between.charCodeAt(0);
|
|
3077
|
+
const open = encodeInfo(
|
|
3078
|
+
info.before.charCodeAt(info.before.length - 1),
|
|
3079
|
+
betweenHead,
|
|
3080
|
+
marker
|
|
3081
|
+
);
|
|
3082
|
+
if (open.inside) {
|
|
3083
|
+
between = encodeCharacterReference(betweenHead) + between.slice(1);
|
|
3084
|
+
}
|
|
3085
|
+
const betweenTail = between.charCodeAt(between.length - 1);
|
|
3086
|
+
const close2 = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
|
|
3087
|
+
if (close2.inside) {
|
|
3088
|
+
between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
|
|
3089
|
+
}
|
|
3090
|
+
const after = tracker.move(marker + marker);
|
|
3091
|
+
exit2();
|
|
3092
|
+
state.attentionEncodeSurroundingInfo = {
|
|
3093
|
+
after: close2.outside,
|
|
3094
|
+
before: open.outside
|
|
3095
|
+
};
|
|
3096
|
+
return before + between + after;
|
|
3097
|
+
}
|
|
3098
|
+
function strongPeek(_, _1, state) {
|
|
3099
|
+
return state.options.strong || "*";
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/text.js
|
|
3103
|
+
function text(node2, _, state, info) {
|
|
3104
|
+
return state.safe(node2.value, info);
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
|
|
3108
|
+
function checkRuleRepetition(state) {
|
|
3109
|
+
const repetition = state.options.ruleRepetition || 3;
|
|
3110
|
+
if (repetition < 3) {
|
|
3111
|
+
throw new Error(
|
|
3112
|
+
"Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
|
|
3113
|
+
);
|
|
3114
|
+
}
|
|
3115
|
+
return repetition;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
|
|
3119
|
+
function thematicBreak(_, _1, state) {
|
|
3120
|
+
const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
|
|
3121
|
+
return state.options.ruleSpaces ? value.slice(0, -1) : value;
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
// ../../node_modules/.pnpm/mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.js
|
|
3125
|
+
var handle = {
|
|
3126
|
+
blockquote,
|
|
3127
|
+
break: hardBreak,
|
|
3128
|
+
code,
|
|
3129
|
+
definition,
|
|
3130
|
+
emphasis,
|
|
3131
|
+
hardBreak,
|
|
3132
|
+
heading,
|
|
3133
|
+
html,
|
|
3134
|
+
image,
|
|
3135
|
+
imageReference,
|
|
3136
|
+
inlineCode,
|
|
3137
|
+
link,
|
|
3138
|
+
linkReference,
|
|
3139
|
+
list,
|
|
3140
|
+
listItem,
|
|
3141
|
+
paragraph,
|
|
3142
|
+
root,
|
|
3143
|
+
strong,
|
|
3144
|
+
text,
|
|
3145
|
+
thematicBreak
|
|
3146
|
+
};
|
|
3147
|
+
|
|
3148
|
+
// ../../node_modules/.pnpm/mdast-util-gfm-table@2.0.0/node_modules/mdast-util-gfm-table/lib/index.js
|
|
3149
|
+
function gfmTableFromMarkdown() {
|
|
3150
|
+
return {
|
|
3151
|
+
enter: {
|
|
3152
|
+
table: enterTable,
|
|
3153
|
+
tableData: enterCell,
|
|
3154
|
+
tableHeader: enterCell,
|
|
3155
|
+
tableRow: enterRow
|
|
3156
|
+
},
|
|
3157
|
+
exit: {
|
|
3158
|
+
codeText: exitCodeText,
|
|
3159
|
+
table: exitTable,
|
|
3160
|
+
tableData: exit,
|
|
3161
|
+
tableHeader: exit,
|
|
3162
|
+
tableRow: exit
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
function enterTable(token) {
|
|
3167
|
+
const align = token._align;
|
|
3168
|
+
ok(align, "expected `_align` on table");
|
|
3169
|
+
this.enter(
|
|
3170
|
+
{
|
|
3171
|
+
type: "table",
|
|
3172
|
+
align: align.map(function(d) {
|
|
3173
|
+
return d === "none" ? null : d;
|
|
3174
|
+
}),
|
|
3175
|
+
children: []
|
|
3176
|
+
},
|
|
3177
|
+
token
|
|
3178
|
+
);
|
|
3179
|
+
this.data.inTable = true;
|
|
3180
|
+
}
|
|
3181
|
+
function exitTable(token) {
|
|
3182
|
+
this.exit(token);
|
|
3183
|
+
this.data.inTable = void 0;
|
|
3184
|
+
}
|
|
3185
|
+
function enterRow(token) {
|
|
3186
|
+
this.enter({ type: "tableRow", children: [] }, token);
|
|
3187
|
+
}
|
|
3188
|
+
function exit(token) {
|
|
3189
|
+
this.exit(token);
|
|
3190
|
+
}
|
|
3191
|
+
function enterCell(token) {
|
|
3192
|
+
this.enter({ type: "tableCell", children: [] }, token);
|
|
3193
|
+
}
|
|
3194
|
+
function exitCodeText(token) {
|
|
3195
|
+
let value = this.resume();
|
|
3196
|
+
if (this.data.inTable) {
|
|
3197
|
+
value = value.replace(/\\([\\|])/g, replace);
|
|
3198
|
+
}
|
|
3199
|
+
const node2 = this.stack[this.stack.length - 1];
|
|
3200
|
+
ok(node2.type === "inlineCode");
|
|
3201
|
+
node2.value = value;
|
|
3202
|
+
this.exit(token);
|
|
3203
|
+
}
|
|
3204
|
+
function replace($0, $1) {
|
|
3205
|
+
return $1 === "|" ? $1 : $0;
|
|
3206
|
+
}
|
|
3207
|
+
function gfmTableToMarkdown(options) {
|
|
3208
|
+
const settings = options || {};
|
|
3209
|
+
const padding = settings.tableCellPadding;
|
|
3210
|
+
const alignDelimiters = settings.tablePipeAlign;
|
|
3211
|
+
const stringLength = settings.stringLength;
|
|
3212
|
+
const around = padding ? " " : "|";
|
|
3213
|
+
return {
|
|
3214
|
+
unsafe: [
|
|
3215
|
+
{ character: "\r", inConstruct: "tableCell" },
|
|
3216
|
+
{ character: "\n", inConstruct: "tableCell" },
|
|
3217
|
+
// A pipe, when followed by a tab or space (padding), or a dash or colon
|
|
3218
|
+
// (unpadded delimiter row), could result in a table.
|
|
3219
|
+
{ atBreak: true, character: "|", after: "[ :-]" },
|
|
3220
|
+
// A pipe in a cell must be encoded.
|
|
3221
|
+
{ character: "|", inConstruct: "tableCell" },
|
|
3222
|
+
// A colon must be followed by a dash, in which case it could start a
|
|
3223
|
+
// delimiter row.
|
|
3224
|
+
{ atBreak: true, character: ":", after: "-" },
|
|
3225
|
+
// A delimiter row can also start with a dash, when followed by more
|
|
3226
|
+
// dashes, a colon, or a pipe.
|
|
3227
|
+
// This is a stricter version than the built in check for lists, thematic
|
|
3228
|
+
// breaks, and setex heading underlines though:
|
|
3229
|
+
// <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
|
|
3230
|
+
{ atBreak: true, character: "-", after: "[:|-]" }
|
|
3231
|
+
],
|
|
3232
|
+
handlers: {
|
|
3233
|
+
inlineCode: inlineCodeWithTable,
|
|
3234
|
+
table: handleTable,
|
|
3235
|
+
tableCell: handleTableCell,
|
|
3236
|
+
tableRow: handleTableRow
|
|
3237
|
+
}
|
|
3238
|
+
};
|
|
3239
|
+
function handleTable(node2, _, state, info) {
|
|
3240
|
+
return serializeData(handleTableAsData(node2, state, info), node2.align);
|
|
3241
|
+
}
|
|
3242
|
+
function handleTableRow(node2, _, state, info) {
|
|
3243
|
+
const row = handleTableRowAsData(node2, state, info);
|
|
3244
|
+
const value = serializeData([row]);
|
|
3245
|
+
return value.slice(0, value.indexOf("\n"));
|
|
3246
|
+
}
|
|
3247
|
+
function handleTableCell(node2, _, state, info) {
|
|
3248
|
+
const exit2 = state.enter("tableCell");
|
|
3249
|
+
const subexit = state.enter("phrasing");
|
|
3250
|
+
const value = state.containerPhrasing(node2, {
|
|
3251
|
+
...info,
|
|
3252
|
+
before: around,
|
|
3253
|
+
after: around
|
|
3254
|
+
});
|
|
3255
|
+
subexit();
|
|
3256
|
+
exit2();
|
|
3257
|
+
return value;
|
|
3258
|
+
}
|
|
3259
|
+
function serializeData(matrix, align) {
|
|
3260
|
+
return markdownTable(matrix, {
|
|
3261
|
+
align,
|
|
3262
|
+
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
3263
|
+
alignDelimiters,
|
|
3264
|
+
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
3265
|
+
padding,
|
|
3266
|
+
// @ts-expect-error: `markdown-table` types should support `null`.
|
|
3267
|
+
stringLength
|
|
3268
|
+
});
|
|
3269
|
+
}
|
|
3270
|
+
function handleTableAsData(node2, state, info) {
|
|
3271
|
+
const children = node2.children;
|
|
3272
|
+
let index = -1;
|
|
3273
|
+
const result = [];
|
|
3274
|
+
const subexit = state.enter("table");
|
|
3275
|
+
while (++index < children.length) {
|
|
3276
|
+
result[index] = handleTableRowAsData(children[index], state, info);
|
|
3277
|
+
}
|
|
3278
|
+
subexit();
|
|
3279
|
+
return result;
|
|
3280
|
+
}
|
|
3281
|
+
function handleTableRowAsData(node2, state, info) {
|
|
3282
|
+
const children = node2.children;
|
|
3283
|
+
let index = -1;
|
|
3284
|
+
const result = [];
|
|
3285
|
+
const subexit = state.enter("tableRow");
|
|
3286
|
+
while (++index < children.length) {
|
|
3287
|
+
result[index] = handleTableCell(children[index], node2, state, info);
|
|
3288
|
+
}
|
|
3289
|
+
subexit();
|
|
3290
|
+
return result;
|
|
3291
|
+
}
|
|
3292
|
+
function inlineCodeWithTable(node2, parent, state) {
|
|
3293
|
+
let value = handle.inlineCode(node2, parent, state);
|
|
3294
|
+
if (state.stack.includes("tableCell")) {
|
|
3295
|
+
value = value.replace(/\|/g, "\\$&");
|
|
3296
|
+
}
|
|
3297
|
+
return value;
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
// ../../node_modules/.pnpm/mdast-util-gfm-task-list-item@2.0.0/node_modules/mdast-util-gfm-task-list-item/lib/index.js
|
|
3302
|
+
function gfmTaskListItemFromMarkdown() {
|
|
3303
|
+
return {
|
|
3304
|
+
exit: {
|
|
3305
|
+
taskListCheckValueChecked: exitCheck,
|
|
3306
|
+
taskListCheckValueUnchecked: exitCheck,
|
|
3307
|
+
paragraph: exitParagraphWithTaskListItem
|
|
3308
|
+
}
|
|
3309
|
+
};
|
|
3310
|
+
}
|
|
3311
|
+
function gfmTaskListItemToMarkdown() {
|
|
3312
|
+
return {
|
|
3313
|
+
unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
|
|
3314
|
+
handlers: { listItem: listItemWithTaskListItem }
|
|
3315
|
+
};
|
|
3316
|
+
}
|
|
3317
|
+
function exitCheck(token) {
|
|
3318
|
+
const node2 = this.stack[this.stack.length - 2];
|
|
3319
|
+
ok(node2.type === "listItem");
|
|
3320
|
+
node2.checked = token.type === "taskListCheckValueChecked";
|
|
3321
|
+
}
|
|
3322
|
+
function exitParagraphWithTaskListItem(token) {
|
|
3323
|
+
const parent = this.stack[this.stack.length - 2];
|
|
3324
|
+
if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
|
|
3325
|
+
const node2 = this.stack[this.stack.length - 1];
|
|
3326
|
+
ok(node2.type === "paragraph");
|
|
3327
|
+
const head = node2.children[0];
|
|
3328
|
+
if (head && head.type === "text") {
|
|
3329
|
+
const siblings = parent.children;
|
|
3330
|
+
let index = -1;
|
|
3331
|
+
let firstParaghraph;
|
|
3332
|
+
while (++index < siblings.length) {
|
|
3333
|
+
const sibling = siblings[index];
|
|
3334
|
+
if (sibling.type === "paragraph") {
|
|
3335
|
+
firstParaghraph = sibling;
|
|
3336
|
+
break;
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
if (firstParaghraph === node2) {
|
|
3340
|
+
head.value = head.value.slice(1);
|
|
3341
|
+
if (head.value.length === 0) {
|
|
3342
|
+
node2.children.shift();
|
|
3343
|
+
} else if (node2.position && head.position && typeof head.position.start.offset === "number") {
|
|
3344
|
+
head.position.start.column++;
|
|
3345
|
+
head.position.start.offset++;
|
|
3346
|
+
node2.position.start = Object.assign({}, head.position.start);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
this.exit(token);
|
|
3352
|
+
}
|
|
3353
|
+
function listItemWithTaskListItem(node2, parent, state, info) {
|
|
3354
|
+
const head = node2.children[0];
|
|
3355
|
+
const checkable = typeof node2.checked === "boolean" && head && head.type === "paragraph";
|
|
3356
|
+
const checkbox = "[" + (node2.checked ? "x" : " ") + "] ";
|
|
3357
|
+
const tracker = state.createTracker(info);
|
|
3358
|
+
if (checkable) {
|
|
3359
|
+
tracker.move(checkbox);
|
|
3360
|
+
}
|
|
3361
|
+
let value = handle.listItem(node2, parent, state, {
|
|
3362
|
+
...info,
|
|
3363
|
+
...tracker.current()
|
|
3364
|
+
});
|
|
3365
|
+
if (checkable) {
|
|
3366
|
+
value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check);
|
|
3367
|
+
}
|
|
3368
|
+
return value;
|
|
3369
|
+
function check($0) {
|
|
3370
|
+
return $0 + checkbox;
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3374
|
+
// ../../node_modules/.pnpm/mdast-util-gfm@3.1.0/node_modules/mdast-util-gfm/lib/index.js
|
|
3375
|
+
function gfmFromMarkdown() {
|
|
3376
|
+
return [
|
|
3377
|
+
gfmAutolinkLiteralFromMarkdown(),
|
|
3378
|
+
gfmFootnoteFromMarkdown(),
|
|
3379
|
+
gfmStrikethroughFromMarkdown(),
|
|
3380
|
+
gfmTableFromMarkdown(),
|
|
3381
|
+
gfmTaskListItemFromMarkdown()
|
|
3382
|
+
];
|
|
3383
|
+
}
|
|
3384
|
+
function gfmToMarkdown(options) {
|
|
3385
|
+
return {
|
|
3386
|
+
extensions: [
|
|
3387
|
+
gfmAutolinkLiteralToMarkdown(),
|
|
3388
|
+
gfmFootnoteToMarkdown(options),
|
|
3389
|
+
gfmStrikethroughToMarkdown(),
|
|
3390
|
+
gfmTableToMarkdown(options),
|
|
3391
|
+
gfmTaskListItemToMarkdown()
|
|
3392
|
+
]
|
|
3393
|
+
};
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
// ../../node_modules/.pnpm/micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.js
|
|
3397
|
+
function splice(list2, start, remove, items) {
|
|
3398
|
+
const end = list2.length;
|
|
3399
|
+
let chunkStart = 0;
|
|
3400
|
+
let parameters;
|
|
3401
|
+
if (start < 0) {
|
|
3402
|
+
start = -start > end ? 0 : end + start;
|
|
3403
|
+
} else {
|
|
3404
|
+
start = start > end ? end : start;
|
|
3405
|
+
}
|
|
3406
|
+
remove = remove > 0 ? remove : 0;
|
|
3407
|
+
if (items.length < 1e4) {
|
|
3408
|
+
parameters = Array.from(items);
|
|
3409
|
+
parameters.unshift(start, remove);
|
|
3410
|
+
list2.splice(...parameters);
|
|
3411
|
+
} else {
|
|
3412
|
+
if (remove) list2.splice(start, remove);
|
|
3413
|
+
while (chunkStart < items.length) {
|
|
3414
|
+
parameters = items.slice(chunkStart, chunkStart + 1e4);
|
|
3415
|
+
parameters.unshift(start, 0);
|
|
3416
|
+
list2.splice(...parameters);
|
|
3417
|
+
chunkStart += 1e4;
|
|
3418
|
+
start += 1e4;
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
|
|
3423
|
+
// ../../node_modules/.pnpm/micromark-util-combine-extensions@2.0.1/node_modules/micromark-util-combine-extensions/index.js
|
|
3424
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
3425
|
+
function combineExtensions(extensions) {
|
|
3426
|
+
const all2 = {};
|
|
3427
|
+
let index = -1;
|
|
3428
|
+
while (++index < extensions.length) {
|
|
3429
|
+
syntaxExtension(all2, extensions[index]);
|
|
3430
|
+
}
|
|
3431
|
+
return all2;
|
|
3432
|
+
}
|
|
3433
|
+
function syntaxExtension(all2, extension) {
|
|
3434
|
+
let hook;
|
|
3435
|
+
for (hook in extension) {
|
|
3436
|
+
const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;
|
|
3437
|
+
const left = maybe || (all2[hook] = {});
|
|
3438
|
+
const right = extension[hook];
|
|
3439
|
+
let code3;
|
|
3440
|
+
if (right) {
|
|
3441
|
+
for (code3 in right) {
|
|
3442
|
+
if (!hasOwnProperty.call(left, code3)) left[code3] = [];
|
|
3443
|
+
const value = right[code3];
|
|
3444
|
+
constructs(
|
|
3445
|
+
// @ts-expect-error Looks like a list.
|
|
3446
|
+
left[code3],
|
|
3447
|
+
Array.isArray(value) ? value : value ? [value] : []
|
|
3448
|
+
);
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
function constructs(existing, list2) {
|
|
3454
|
+
let index = -1;
|
|
3455
|
+
const before = [];
|
|
3456
|
+
while (++index < list2.length) {
|
|
3457
|
+
;
|
|
3458
|
+
(list2[index].add === "after" ? existing : before).push(list2[index]);
|
|
3459
|
+
}
|
|
3460
|
+
splice(existing, 0, 0, before);
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-autolink-literal@2.1.0/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
|
|
3464
|
+
var wwwPrefix = {
|
|
3465
|
+
tokenize: tokenizeWwwPrefix,
|
|
3466
|
+
partial: true
|
|
3467
|
+
};
|
|
3468
|
+
var domain = {
|
|
3469
|
+
tokenize: tokenizeDomain,
|
|
3470
|
+
partial: true
|
|
3471
|
+
};
|
|
3472
|
+
var path5 = {
|
|
3473
|
+
tokenize: tokenizePath,
|
|
3474
|
+
partial: true
|
|
3475
|
+
};
|
|
3476
|
+
var trail = {
|
|
3477
|
+
tokenize: tokenizeTrail,
|
|
3478
|
+
partial: true
|
|
3479
|
+
};
|
|
3480
|
+
var emailDomainDotTrail = {
|
|
3481
|
+
tokenize: tokenizeEmailDomainDotTrail,
|
|
3482
|
+
partial: true
|
|
3483
|
+
};
|
|
3484
|
+
var wwwAutolink = {
|
|
3485
|
+
name: "wwwAutolink",
|
|
3486
|
+
tokenize: tokenizeWwwAutolink,
|
|
3487
|
+
previous: previousWww
|
|
3488
|
+
};
|
|
3489
|
+
var protocolAutolink = {
|
|
3490
|
+
name: "protocolAutolink",
|
|
3491
|
+
tokenize: tokenizeProtocolAutolink,
|
|
3492
|
+
previous: previousProtocol
|
|
3493
|
+
};
|
|
3494
|
+
var emailAutolink = {
|
|
3495
|
+
name: "emailAutolink",
|
|
3496
|
+
tokenize: tokenizeEmailAutolink,
|
|
3497
|
+
previous: previousEmail
|
|
3498
|
+
};
|
|
3499
|
+
var text2 = {};
|
|
3500
|
+
function gfmAutolinkLiteral() {
|
|
3501
|
+
return {
|
|
3502
|
+
text: text2
|
|
3503
|
+
};
|
|
3504
|
+
}
|
|
3505
|
+
var code2 = 48;
|
|
3506
|
+
while (code2 < 123) {
|
|
3507
|
+
text2[code2] = emailAutolink;
|
|
3508
|
+
code2++;
|
|
3509
|
+
if (code2 === 58) code2 = 65;
|
|
3510
|
+
else if (code2 === 91) code2 = 97;
|
|
3511
|
+
}
|
|
3512
|
+
text2[43] = emailAutolink;
|
|
3513
|
+
text2[45] = emailAutolink;
|
|
3514
|
+
text2[46] = emailAutolink;
|
|
3515
|
+
text2[95] = emailAutolink;
|
|
3516
|
+
text2[72] = [emailAutolink, protocolAutolink];
|
|
3517
|
+
text2[104] = [emailAutolink, protocolAutolink];
|
|
3518
|
+
text2[87] = [emailAutolink, wwwAutolink];
|
|
3519
|
+
text2[119] = [emailAutolink, wwwAutolink];
|
|
3520
|
+
function tokenizeEmailAutolink(effects, ok3, nok) {
|
|
3521
|
+
const self = this;
|
|
3522
|
+
let dot;
|
|
3523
|
+
let data;
|
|
3524
|
+
return start;
|
|
3525
|
+
function start(code3) {
|
|
3526
|
+
if (!gfmAtext(code3) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {
|
|
3527
|
+
return nok(code3);
|
|
3528
|
+
}
|
|
3529
|
+
effects.enter("literalAutolink");
|
|
3530
|
+
effects.enter("literalAutolinkEmail");
|
|
3531
|
+
return atext(code3);
|
|
3532
|
+
}
|
|
3533
|
+
function atext(code3) {
|
|
3534
|
+
if (gfmAtext(code3)) {
|
|
3535
|
+
effects.consume(code3);
|
|
3536
|
+
return atext;
|
|
3537
|
+
}
|
|
3538
|
+
if (code3 === 64) {
|
|
3539
|
+
effects.consume(code3);
|
|
3540
|
+
return emailDomain;
|
|
3541
|
+
}
|
|
3542
|
+
return nok(code3);
|
|
3543
|
+
}
|
|
3544
|
+
function emailDomain(code3) {
|
|
3545
|
+
if (code3 === 46) {
|
|
3546
|
+
return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code3);
|
|
3547
|
+
}
|
|
3548
|
+
if (code3 === 45 || code3 === 95 || asciiAlphanumeric(code3)) {
|
|
3549
|
+
data = true;
|
|
3550
|
+
effects.consume(code3);
|
|
3551
|
+
return emailDomain;
|
|
3552
|
+
}
|
|
3553
|
+
return emailDomainAfter(code3);
|
|
3554
|
+
}
|
|
3555
|
+
function emailDomainDot(code3) {
|
|
3556
|
+
effects.consume(code3);
|
|
3557
|
+
dot = true;
|
|
3558
|
+
return emailDomain;
|
|
3559
|
+
}
|
|
3560
|
+
function emailDomainAfter(code3) {
|
|
3561
|
+
if (data && dot && asciiAlpha(self.previous)) {
|
|
3562
|
+
effects.exit("literalAutolinkEmail");
|
|
3563
|
+
effects.exit("literalAutolink");
|
|
3564
|
+
return ok3(code3);
|
|
3565
|
+
}
|
|
3566
|
+
return nok(code3);
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
function tokenizeWwwAutolink(effects, ok3, nok) {
|
|
3570
|
+
const self = this;
|
|
3571
|
+
return wwwStart;
|
|
3572
|
+
function wwwStart(code3) {
|
|
3573
|
+
if (code3 !== 87 && code3 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {
|
|
3574
|
+
return nok(code3);
|
|
3575
|
+
}
|
|
3576
|
+
effects.enter("literalAutolink");
|
|
3577
|
+
effects.enter("literalAutolinkWww");
|
|
3578
|
+
return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path5, wwwAfter), nok), nok)(code3);
|
|
3579
|
+
}
|
|
3580
|
+
function wwwAfter(code3) {
|
|
3581
|
+
effects.exit("literalAutolinkWww");
|
|
3582
|
+
effects.exit("literalAutolink");
|
|
3583
|
+
return ok3(code3);
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
function tokenizeProtocolAutolink(effects, ok3, nok) {
|
|
3587
|
+
const self = this;
|
|
3588
|
+
let buffer = "";
|
|
3589
|
+
let seen = false;
|
|
3590
|
+
return protocolStart;
|
|
3591
|
+
function protocolStart(code3) {
|
|
3592
|
+
if ((code3 === 72 || code3 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {
|
|
3593
|
+
effects.enter("literalAutolink");
|
|
3594
|
+
effects.enter("literalAutolinkHttp");
|
|
3595
|
+
buffer += String.fromCodePoint(code3);
|
|
3596
|
+
effects.consume(code3);
|
|
3597
|
+
return protocolPrefixInside;
|
|
3598
|
+
}
|
|
3599
|
+
return nok(code3);
|
|
3600
|
+
}
|
|
3601
|
+
function protocolPrefixInside(code3) {
|
|
3602
|
+
if (asciiAlpha(code3) && buffer.length < 5) {
|
|
3603
|
+
buffer += String.fromCodePoint(code3);
|
|
3604
|
+
effects.consume(code3);
|
|
3605
|
+
return protocolPrefixInside;
|
|
3606
|
+
}
|
|
3607
|
+
if (code3 === 58) {
|
|
3608
|
+
const protocol = buffer.toLowerCase();
|
|
3609
|
+
if (protocol === "http" || protocol === "https") {
|
|
3610
|
+
effects.consume(code3);
|
|
3611
|
+
return protocolSlashesInside;
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
return nok(code3);
|
|
3615
|
+
}
|
|
3616
|
+
function protocolSlashesInside(code3) {
|
|
3617
|
+
if (code3 === 47) {
|
|
3618
|
+
effects.consume(code3);
|
|
3619
|
+
if (seen) {
|
|
3620
|
+
return afterProtocol;
|
|
3621
|
+
}
|
|
3622
|
+
seen = true;
|
|
3623
|
+
return protocolSlashesInside;
|
|
3624
|
+
}
|
|
3625
|
+
return nok(code3);
|
|
3626
|
+
}
|
|
3627
|
+
function afterProtocol(code3) {
|
|
3628
|
+
return code3 === null || asciiControl(code3) || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || unicodePunctuation(code3) ? nok(code3) : effects.attempt(domain, effects.attempt(path5, protocolAfter), nok)(code3);
|
|
3629
|
+
}
|
|
3630
|
+
function protocolAfter(code3) {
|
|
3631
|
+
effects.exit("literalAutolinkHttp");
|
|
3632
|
+
effects.exit("literalAutolink");
|
|
3633
|
+
return ok3(code3);
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
function tokenizeWwwPrefix(effects, ok3, nok) {
|
|
3637
|
+
let size = 0;
|
|
3638
|
+
return wwwPrefixInside;
|
|
3639
|
+
function wwwPrefixInside(code3) {
|
|
3640
|
+
if ((code3 === 87 || code3 === 119) && size < 3) {
|
|
3641
|
+
size++;
|
|
3642
|
+
effects.consume(code3);
|
|
3643
|
+
return wwwPrefixInside;
|
|
3644
|
+
}
|
|
3645
|
+
if (code3 === 46 && size === 3) {
|
|
3646
|
+
effects.consume(code3);
|
|
3647
|
+
return wwwPrefixAfter;
|
|
3648
|
+
}
|
|
3649
|
+
return nok(code3);
|
|
3650
|
+
}
|
|
3651
|
+
function wwwPrefixAfter(code3) {
|
|
3652
|
+
return code3 === null ? nok(code3) : ok3(code3);
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
function tokenizeDomain(effects, ok3, nok) {
|
|
3656
|
+
let underscoreInLastSegment;
|
|
3657
|
+
let underscoreInLastLastSegment;
|
|
3658
|
+
let seen;
|
|
3659
|
+
return domainInside;
|
|
3660
|
+
function domainInside(code3) {
|
|
3661
|
+
if (code3 === 46 || code3 === 95) {
|
|
3662
|
+
return effects.check(trail, domainAfter, domainAtPunctuation)(code3);
|
|
3663
|
+
}
|
|
3664
|
+
if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3) || code3 !== 45 && unicodePunctuation(code3)) {
|
|
3665
|
+
return domainAfter(code3);
|
|
3666
|
+
}
|
|
3667
|
+
seen = true;
|
|
3668
|
+
effects.consume(code3);
|
|
3669
|
+
return domainInside;
|
|
3670
|
+
}
|
|
3671
|
+
function domainAtPunctuation(code3) {
|
|
3672
|
+
if (code3 === 95) {
|
|
3673
|
+
underscoreInLastSegment = true;
|
|
3674
|
+
} else {
|
|
3675
|
+
underscoreInLastLastSegment = underscoreInLastSegment;
|
|
3676
|
+
underscoreInLastSegment = void 0;
|
|
3677
|
+
}
|
|
3678
|
+
effects.consume(code3);
|
|
3679
|
+
return domainInside;
|
|
3680
|
+
}
|
|
3681
|
+
function domainAfter(code3) {
|
|
3682
|
+
if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
|
|
3683
|
+
return nok(code3);
|
|
3684
|
+
}
|
|
3685
|
+
return ok3(code3);
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3688
|
+
function tokenizePath(effects, ok3) {
|
|
3689
|
+
let sizeOpen = 0;
|
|
3690
|
+
let sizeClose = 0;
|
|
3691
|
+
return pathInside;
|
|
3692
|
+
function pathInside(code3) {
|
|
3693
|
+
if (code3 === 40) {
|
|
3694
|
+
sizeOpen++;
|
|
3695
|
+
effects.consume(code3);
|
|
3696
|
+
return pathInside;
|
|
3697
|
+
}
|
|
3698
|
+
if (code3 === 41 && sizeClose < sizeOpen) {
|
|
3699
|
+
return pathAtPunctuation(code3);
|
|
3700
|
+
}
|
|
3701
|
+
if (code3 === 33 || code3 === 34 || code3 === 38 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 60 || code3 === 63 || code3 === 93 || code3 === 95 || code3 === 126) {
|
|
3702
|
+
return effects.check(trail, ok3, pathAtPunctuation)(code3);
|
|
3703
|
+
}
|
|
3704
|
+
if (code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
|
|
3705
|
+
return ok3(code3);
|
|
3706
|
+
}
|
|
3707
|
+
effects.consume(code3);
|
|
3708
|
+
return pathInside;
|
|
3709
|
+
}
|
|
3710
|
+
function pathAtPunctuation(code3) {
|
|
3711
|
+
if (code3 === 41) {
|
|
3712
|
+
sizeClose++;
|
|
3713
|
+
}
|
|
3714
|
+
effects.consume(code3);
|
|
3715
|
+
return pathInside;
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
function tokenizeTrail(effects, ok3, nok) {
|
|
3719
|
+
return trail2;
|
|
3720
|
+
function trail2(code3) {
|
|
3721
|
+
if (code3 === 33 || code3 === 34 || code3 === 39 || code3 === 41 || code3 === 42 || code3 === 44 || code3 === 46 || code3 === 58 || code3 === 59 || code3 === 63 || code3 === 95 || code3 === 126) {
|
|
3722
|
+
effects.consume(code3);
|
|
3723
|
+
return trail2;
|
|
3724
|
+
}
|
|
3725
|
+
if (code3 === 38) {
|
|
3726
|
+
effects.consume(code3);
|
|
3727
|
+
return trailCharacterReferenceStart;
|
|
3728
|
+
}
|
|
3729
|
+
if (code3 === 93) {
|
|
3730
|
+
effects.consume(code3);
|
|
3731
|
+
return trailBracketAfter;
|
|
3732
|
+
}
|
|
3733
|
+
if (
|
|
3734
|
+
// `<` is an end.
|
|
3735
|
+
code3 === 60 || // So is whitespace.
|
|
3736
|
+
code3 === null || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)
|
|
3737
|
+
) {
|
|
3738
|
+
return ok3(code3);
|
|
3739
|
+
}
|
|
3740
|
+
return nok(code3);
|
|
3741
|
+
}
|
|
3742
|
+
function trailBracketAfter(code3) {
|
|
3743
|
+
if (code3 === null || code3 === 40 || code3 === 91 || markdownLineEndingOrSpace(code3) || unicodeWhitespace(code3)) {
|
|
3744
|
+
return ok3(code3);
|
|
3745
|
+
}
|
|
3746
|
+
return trail2(code3);
|
|
3747
|
+
}
|
|
3748
|
+
function trailCharacterReferenceStart(code3) {
|
|
3749
|
+
return asciiAlpha(code3) ? trailCharacterReferenceInside(code3) : nok(code3);
|
|
3750
|
+
}
|
|
3751
|
+
function trailCharacterReferenceInside(code3) {
|
|
3752
|
+
if (code3 === 59) {
|
|
3753
|
+
effects.consume(code3);
|
|
3754
|
+
return trail2;
|
|
3755
|
+
}
|
|
3756
|
+
if (asciiAlpha(code3)) {
|
|
3757
|
+
effects.consume(code3);
|
|
3758
|
+
return trailCharacterReferenceInside;
|
|
3759
|
+
}
|
|
3760
|
+
return nok(code3);
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
function tokenizeEmailDomainDotTrail(effects, ok3, nok) {
|
|
3764
|
+
return start;
|
|
3765
|
+
function start(code3) {
|
|
3766
|
+
effects.consume(code3);
|
|
3767
|
+
return after;
|
|
3768
|
+
}
|
|
3769
|
+
function after(code3) {
|
|
3770
|
+
return asciiAlphanumeric(code3) ? nok(code3) : ok3(code3);
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
function previousWww(code3) {
|
|
3774
|
+
return code3 === null || code3 === 40 || code3 === 42 || code3 === 95 || code3 === 91 || code3 === 93 || code3 === 126 || markdownLineEndingOrSpace(code3);
|
|
3775
|
+
}
|
|
3776
|
+
function previousProtocol(code3) {
|
|
3777
|
+
return !asciiAlpha(code3);
|
|
3778
|
+
}
|
|
3779
|
+
function previousEmail(code3) {
|
|
3780
|
+
return !(code3 === 47 || gfmAtext(code3));
|
|
3781
|
+
}
|
|
3782
|
+
function gfmAtext(code3) {
|
|
3783
|
+
return code3 === 43 || code3 === 45 || code3 === 46 || code3 === 95 || asciiAlphanumeric(code3);
|
|
3784
|
+
}
|
|
3785
|
+
function previousUnbalanced(events) {
|
|
3786
|
+
let index = events.length;
|
|
3787
|
+
let result = false;
|
|
3788
|
+
while (index--) {
|
|
3789
|
+
const token = events[index][1];
|
|
3790
|
+
if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) {
|
|
3791
|
+
result = true;
|
|
3792
|
+
break;
|
|
3793
|
+
}
|
|
3794
|
+
if (token._gfmAutolinkLiteralWalkedInto) {
|
|
3795
|
+
result = false;
|
|
3796
|
+
break;
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
if (events.length > 0 && !result) {
|
|
3800
|
+
events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;
|
|
3801
|
+
}
|
|
3802
|
+
return result;
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
// ../../node_modules/.pnpm/micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.js
|
|
3806
|
+
function resolveAll(constructs2, events, context) {
|
|
3807
|
+
const called = [];
|
|
3808
|
+
let index = -1;
|
|
3809
|
+
while (++index < constructs2.length) {
|
|
3810
|
+
const resolve = constructs2[index].resolveAll;
|
|
3811
|
+
if (resolve && !called.includes(resolve)) {
|
|
3812
|
+
events = resolve(events, context);
|
|
3813
|
+
called.push(resolve);
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
return events;
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3819
|
+
// ../../node_modules/.pnpm/micromark-factory-space@2.0.1/node_modules/micromark-factory-space/index.js
|
|
3820
|
+
function factorySpace(effects, ok3, type, max) {
|
|
3821
|
+
const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
|
|
3822
|
+
let size = 0;
|
|
3823
|
+
return start;
|
|
3824
|
+
function start(code3) {
|
|
3825
|
+
if (markdownSpace(code3)) {
|
|
3826
|
+
effects.enter(type);
|
|
3827
|
+
return prefix(code3);
|
|
3828
|
+
}
|
|
3829
|
+
return ok3(code3);
|
|
3830
|
+
}
|
|
3831
|
+
function prefix(code3) {
|
|
3832
|
+
if (markdownSpace(code3) && size++ < limit) {
|
|
3833
|
+
effects.consume(code3);
|
|
3834
|
+
return prefix;
|
|
3835
|
+
}
|
|
3836
|
+
effects.exit(type);
|
|
3837
|
+
return ok3(code3);
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
// ../../node_modules/.pnpm/micromark-core-commonmark@2.0.3/node_modules/micromark-core-commonmark/lib/blank-line.js
|
|
3842
|
+
var blankLine = {
|
|
3843
|
+
partial: true,
|
|
3844
|
+
tokenize: tokenizeBlankLine
|
|
3845
|
+
};
|
|
3846
|
+
function tokenizeBlankLine(effects, ok3, nok) {
|
|
3847
|
+
return start;
|
|
3848
|
+
function start(code3) {
|
|
3849
|
+
return markdownSpace(code3) ? factorySpace(effects, after, "linePrefix")(code3) : after(code3);
|
|
3850
|
+
}
|
|
3851
|
+
function after(code3) {
|
|
3852
|
+
return code3 === null || markdownLineEnding(code3) ? ok3(code3) : nok(code3);
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-footnote@2.1.0/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
|
|
3857
|
+
var indent = {
|
|
3858
|
+
tokenize: tokenizeIndent,
|
|
3859
|
+
partial: true
|
|
3860
|
+
};
|
|
3861
|
+
function gfmFootnote() {
|
|
3862
|
+
return {
|
|
3863
|
+
document: {
|
|
3864
|
+
[91]: {
|
|
3865
|
+
name: "gfmFootnoteDefinition",
|
|
3866
|
+
tokenize: tokenizeDefinitionStart,
|
|
3867
|
+
continuation: {
|
|
3868
|
+
tokenize: tokenizeDefinitionContinuation
|
|
3869
|
+
},
|
|
3870
|
+
exit: gfmFootnoteDefinitionEnd
|
|
3871
|
+
}
|
|
3872
|
+
},
|
|
3873
|
+
text: {
|
|
3874
|
+
[91]: {
|
|
3875
|
+
name: "gfmFootnoteCall",
|
|
3876
|
+
tokenize: tokenizeGfmFootnoteCall
|
|
3877
|
+
},
|
|
3878
|
+
[93]: {
|
|
3879
|
+
name: "gfmPotentialFootnoteCall",
|
|
3880
|
+
add: "after",
|
|
3881
|
+
tokenize: tokenizePotentialGfmFootnoteCall,
|
|
3882
|
+
resolveTo: resolveToPotentialGfmFootnoteCall
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
};
|
|
3886
|
+
}
|
|
3887
|
+
function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) {
|
|
3888
|
+
const self = this;
|
|
3889
|
+
let index = self.events.length;
|
|
3890
|
+
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
3891
|
+
let labelStart;
|
|
3892
|
+
while (index--) {
|
|
3893
|
+
const token = self.events[index][1];
|
|
3894
|
+
if (token.type === "labelImage") {
|
|
3895
|
+
labelStart = token;
|
|
3896
|
+
break;
|
|
3897
|
+
}
|
|
3898
|
+
if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") {
|
|
3899
|
+
break;
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
return start;
|
|
3903
|
+
function start(code3) {
|
|
3904
|
+
if (!labelStart || !labelStart._balanced) {
|
|
3905
|
+
return nok(code3);
|
|
3906
|
+
}
|
|
3907
|
+
const id = normalizeIdentifier(self.sliceSerialize({
|
|
3908
|
+
start: labelStart.end,
|
|
3909
|
+
end: self.now()
|
|
3910
|
+
}));
|
|
3911
|
+
if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
|
|
3912
|
+
return nok(code3);
|
|
3913
|
+
}
|
|
3914
|
+
effects.enter("gfmFootnoteCallLabelMarker");
|
|
3915
|
+
effects.consume(code3);
|
|
3916
|
+
effects.exit("gfmFootnoteCallLabelMarker");
|
|
3917
|
+
return ok3(code3);
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
function resolveToPotentialGfmFootnoteCall(events, context) {
|
|
3921
|
+
let index = events.length;
|
|
3922
|
+
let labelStart;
|
|
3923
|
+
while (index--) {
|
|
3924
|
+
if (events[index][1].type === "labelImage" && events[index][0] === "enter") {
|
|
3925
|
+
labelStart = events[index][1];
|
|
3926
|
+
break;
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
events[index + 1][1].type = "data";
|
|
3930
|
+
events[index + 3][1].type = "gfmFootnoteCallLabelMarker";
|
|
3931
|
+
const call = {
|
|
3932
|
+
type: "gfmFootnoteCall",
|
|
3933
|
+
start: Object.assign({}, events[index + 3][1].start),
|
|
3934
|
+
end: Object.assign({}, events[events.length - 1][1].end)
|
|
3935
|
+
};
|
|
3936
|
+
const marker = {
|
|
3937
|
+
type: "gfmFootnoteCallMarker",
|
|
3938
|
+
start: Object.assign({}, events[index + 3][1].end),
|
|
3939
|
+
end: Object.assign({}, events[index + 3][1].end)
|
|
3940
|
+
};
|
|
3941
|
+
marker.end.column++;
|
|
3942
|
+
marker.end.offset++;
|
|
3943
|
+
marker.end._bufferIndex++;
|
|
3944
|
+
const string = {
|
|
3945
|
+
type: "gfmFootnoteCallString",
|
|
3946
|
+
start: Object.assign({}, marker.end),
|
|
3947
|
+
end: Object.assign({}, events[events.length - 1][1].start)
|
|
3948
|
+
};
|
|
3949
|
+
const chunk = {
|
|
3950
|
+
type: "chunkString",
|
|
3951
|
+
contentType: "string",
|
|
3952
|
+
start: Object.assign({}, string.start),
|
|
3953
|
+
end: Object.assign({}, string.end)
|
|
3954
|
+
};
|
|
3955
|
+
const replacement = [
|
|
3956
|
+
// Take the `labelImageMarker` (now `data`, the `!`)
|
|
3957
|
+
events[index + 1],
|
|
3958
|
+
events[index + 2],
|
|
3959
|
+
["enter", call, context],
|
|
3960
|
+
// The `[`
|
|
3961
|
+
events[index + 3],
|
|
3962
|
+
events[index + 4],
|
|
3963
|
+
// The `^`.
|
|
3964
|
+
["enter", marker, context],
|
|
3965
|
+
["exit", marker, context],
|
|
3966
|
+
// Everything in between.
|
|
3967
|
+
["enter", string, context],
|
|
3968
|
+
["enter", chunk, context],
|
|
3969
|
+
["exit", chunk, context],
|
|
3970
|
+
["exit", string, context],
|
|
3971
|
+
// The ending (`]`, properly parsed and labelled).
|
|
3972
|
+
events[events.length - 2],
|
|
3973
|
+
events[events.length - 1],
|
|
3974
|
+
["exit", call, context]
|
|
3975
|
+
];
|
|
3976
|
+
events.splice(index, events.length - index + 1, ...replacement);
|
|
3977
|
+
return events;
|
|
3978
|
+
}
|
|
3979
|
+
function tokenizeGfmFootnoteCall(effects, ok3, nok) {
|
|
3980
|
+
const self = this;
|
|
3981
|
+
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
3982
|
+
let size = 0;
|
|
3983
|
+
let data;
|
|
3984
|
+
return start;
|
|
3985
|
+
function start(code3) {
|
|
3986
|
+
effects.enter("gfmFootnoteCall");
|
|
3987
|
+
effects.enter("gfmFootnoteCallLabelMarker");
|
|
3988
|
+
effects.consume(code3);
|
|
3989
|
+
effects.exit("gfmFootnoteCallLabelMarker");
|
|
3990
|
+
return callStart;
|
|
3991
|
+
}
|
|
3992
|
+
function callStart(code3) {
|
|
3993
|
+
if (code3 !== 94) return nok(code3);
|
|
3994
|
+
effects.enter("gfmFootnoteCallMarker");
|
|
3995
|
+
effects.consume(code3);
|
|
3996
|
+
effects.exit("gfmFootnoteCallMarker");
|
|
3997
|
+
effects.enter("gfmFootnoteCallString");
|
|
3998
|
+
effects.enter("chunkString").contentType = "string";
|
|
3999
|
+
return callData;
|
|
4000
|
+
}
|
|
4001
|
+
function callData(code3) {
|
|
4002
|
+
if (
|
|
4003
|
+
// Too long.
|
|
4004
|
+
size > 999 || // Closing brace with nothing.
|
|
4005
|
+
code3 === 93 && !data || // Space or tab is not supported by GFM for some reason.
|
|
4006
|
+
// `\n` and `[` not being supported makes sense.
|
|
4007
|
+
code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3)
|
|
4008
|
+
) {
|
|
4009
|
+
return nok(code3);
|
|
4010
|
+
}
|
|
4011
|
+
if (code3 === 93) {
|
|
4012
|
+
effects.exit("chunkString");
|
|
4013
|
+
const token = effects.exit("gfmFootnoteCallString");
|
|
4014
|
+
if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
|
|
4015
|
+
return nok(code3);
|
|
4016
|
+
}
|
|
4017
|
+
effects.enter("gfmFootnoteCallLabelMarker");
|
|
4018
|
+
effects.consume(code3);
|
|
4019
|
+
effects.exit("gfmFootnoteCallLabelMarker");
|
|
4020
|
+
effects.exit("gfmFootnoteCall");
|
|
4021
|
+
return ok3;
|
|
4022
|
+
}
|
|
4023
|
+
if (!markdownLineEndingOrSpace(code3)) {
|
|
4024
|
+
data = true;
|
|
4025
|
+
}
|
|
4026
|
+
size++;
|
|
4027
|
+
effects.consume(code3);
|
|
4028
|
+
return code3 === 92 ? callEscape : callData;
|
|
4029
|
+
}
|
|
4030
|
+
function callEscape(code3) {
|
|
4031
|
+
if (code3 === 91 || code3 === 92 || code3 === 93) {
|
|
4032
|
+
effects.consume(code3);
|
|
4033
|
+
size++;
|
|
4034
|
+
return callData;
|
|
4035
|
+
}
|
|
4036
|
+
return callData(code3);
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4039
|
+
function tokenizeDefinitionStart(effects, ok3, nok) {
|
|
4040
|
+
const self = this;
|
|
4041
|
+
const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
|
|
4042
|
+
let identifier;
|
|
4043
|
+
let size = 0;
|
|
4044
|
+
let data;
|
|
4045
|
+
return start;
|
|
4046
|
+
function start(code3) {
|
|
4047
|
+
effects.enter("gfmFootnoteDefinition")._container = true;
|
|
4048
|
+
effects.enter("gfmFootnoteDefinitionLabel");
|
|
4049
|
+
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
|
4050
|
+
effects.consume(code3);
|
|
4051
|
+
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
|
4052
|
+
return labelAtMarker;
|
|
4053
|
+
}
|
|
4054
|
+
function labelAtMarker(code3) {
|
|
4055
|
+
if (code3 === 94) {
|
|
4056
|
+
effects.enter("gfmFootnoteDefinitionMarker");
|
|
4057
|
+
effects.consume(code3);
|
|
4058
|
+
effects.exit("gfmFootnoteDefinitionMarker");
|
|
4059
|
+
effects.enter("gfmFootnoteDefinitionLabelString");
|
|
4060
|
+
effects.enter("chunkString").contentType = "string";
|
|
4061
|
+
return labelInside;
|
|
4062
|
+
}
|
|
4063
|
+
return nok(code3);
|
|
4064
|
+
}
|
|
4065
|
+
function labelInside(code3) {
|
|
4066
|
+
if (
|
|
4067
|
+
// Too long.
|
|
4068
|
+
size > 999 || // Closing brace with nothing.
|
|
4069
|
+
code3 === 93 && !data || // Space or tab is not supported by GFM for some reason.
|
|
4070
|
+
// `\n` and `[` not being supported makes sense.
|
|
4071
|
+
code3 === null || code3 === 91 || markdownLineEndingOrSpace(code3)
|
|
4072
|
+
) {
|
|
4073
|
+
return nok(code3);
|
|
4074
|
+
}
|
|
4075
|
+
if (code3 === 93) {
|
|
4076
|
+
effects.exit("chunkString");
|
|
4077
|
+
const token = effects.exit("gfmFootnoteDefinitionLabelString");
|
|
4078
|
+
identifier = normalizeIdentifier(self.sliceSerialize(token));
|
|
4079
|
+
effects.enter("gfmFootnoteDefinitionLabelMarker");
|
|
4080
|
+
effects.consume(code3);
|
|
4081
|
+
effects.exit("gfmFootnoteDefinitionLabelMarker");
|
|
4082
|
+
effects.exit("gfmFootnoteDefinitionLabel");
|
|
4083
|
+
return labelAfter;
|
|
4084
|
+
}
|
|
4085
|
+
if (!markdownLineEndingOrSpace(code3)) {
|
|
4086
|
+
data = true;
|
|
4087
|
+
}
|
|
4088
|
+
size++;
|
|
4089
|
+
effects.consume(code3);
|
|
4090
|
+
return code3 === 92 ? labelEscape : labelInside;
|
|
4091
|
+
}
|
|
4092
|
+
function labelEscape(code3) {
|
|
4093
|
+
if (code3 === 91 || code3 === 92 || code3 === 93) {
|
|
4094
|
+
effects.consume(code3);
|
|
4095
|
+
size++;
|
|
4096
|
+
return labelInside;
|
|
4097
|
+
}
|
|
4098
|
+
return labelInside(code3);
|
|
4099
|
+
}
|
|
4100
|
+
function labelAfter(code3) {
|
|
4101
|
+
if (code3 === 58) {
|
|
4102
|
+
effects.enter("definitionMarker");
|
|
4103
|
+
effects.consume(code3);
|
|
4104
|
+
effects.exit("definitionMarker");
|
|
4105
|
+
if (!defined.includes(identifier)) {
|
|
4106
|
+
defined.push(identifier);
|
|
4107
|
+
}
|
|
4108
|
+
return factorySpace(effects, whitespaceAfter, "gfmFootnoteDefinitionWhitespace");
|
|
4109
|
+
}
|
|
4110
|
+
return nok(code3);
|
|
4111
|
+
}
|
|
4112
|
+
function whitespaceAfter(code3) {
|
|
4113
|
+
return ok3(code3);
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
function tokenizeDefinitionContinuation(effects, ok3, nok) {
|
|
4117
|
+
return effects.check(blankLine, ok3, effects.attempt(indent, ok3, nok));
|
|
4118
|
+
}
|
|
4119
|
+
function gfmFootnoteDefinitionEnd(effects) {
|
|
4120
|
+
effects.exit("gfmFootnoteDefinition");
|
|
4121
|
+
}
|
|
4122
|
+
function tokenizeIndent(effects, ok3, nok) {
|
|
4123
|
+
const self = this;
|
|
4124
|
+
return factorySpace(effects, afterPrefix, "gfmFootnoteDefinitionIndent", 4 + 1);
|
|
4125
|
+
function afterPrefix(code3) {
|
|
4126
|
+
const tail = self.events[self.events.length - 1];
|
|
4127
|
+
return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok3(code3) : nok(code3);
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
|
|
4131
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-strikethrough@2.1.0/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
|
|
4132
|
+
function gfmStrikethrough(options) {
|
|
4133
|
+
const options_ = options || {};
|
|
4134
|
+
let single = options_.singleTilde;
|
|
4135
|
+
const tokenizer = {
|
|
4136
|
+
name: "strikethrough",
|
|
4137
|
+
tokenize: tokenizeStrikethrough,
|
|
4138
|
+
resolveAll: resolveAllStrikethrough
|
|
4139
|
+
};
|
|
4140
|
+
if (single === null || single === void 0) {
|
|
4141
|
+
single = true;
|
|
4142
|
+
}
|
|
4143
|
+
return {
|
|
4144
|
+
text: {
|
|
4145
|
+
[126]: tokenizer
|
|
4146
|
+
},
|
|
4147
|
+
insideSpan: {
|
|
4148
|
+
null: [tokenizer]
|
|
4149
|
+
},
|
|
4150
|
+
attentionMarkers: {
|
|
4151
|
+
null: [126]
|
|
4152
|
+
}
|
|
4153
|
+
};
|
|
4154
|
+
function resolveAllStrikethrough(events, context) {
|
|
4155
|
+
let index = -1;
|
|
4156
|
+
while (++index < events.length) {
|
|
4157
|
+
if (events[index][0] === "enter" && events[index][1].type === "strikethroughSequenceTemporary" && events[index][1]._close) {
|
|
4158
|
+
let open = index;
|
|
4159
|
+
while (open--) {
|
|
4160
|
+
if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && // If the sizes are the same:
|
|
4161
|
+
events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
|
|
4162
|
+
events[index][1].type = "strikethroughSequence";
|
|
4163
|
+
events[open][1].type = "strikethroughSequence";
|
|
4164
|
+
const strikethrough = {
|
|
4165
|
+
type: "strikethrough",
|
|
4166
|
+
start: Object.assign({}, events[open][1].start),
|
|
4167
|
+
end: Object.assign({}, events[index][1].end)
|
|
4168
|
+
};
|
|
4169
|
+
const text3 = {
|
|
4170
|
+
type: "strikethroughText",
|
|
4171
|
+
start: Object.assign({}, events[open][1].end),
|
|
4172
|
+
end: Object.assign({}, events[index][1].start)
|
|
4173
|
+
};
|
|
4174
|
+
const nextEvents = [["enter", strikethrough, context], ["enter", events[open][1], context], ["exit", events[open][1], context], ["enter", text3, context]];
|
|
4175
|
+
const insideSpan = context.parser.constructs.insideSpan.null;
|
|
4176
|
+
if (insideSpan) {
|
|
4177
|
+
splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));
|
|
4178
|
+
}
|
|
4179
|
+
splice(nextEvents, nextEvents.length, 0, [["exit", text3, context], ["enter", events[index][1], context], ["exit", events[index][1], context], ["exit", strikethrough, context]]);
|
|
4180
|
+
splice(events, open - 1, index - open + 3, nextEvents);
|
|
4181
|
+
index = open + nextEvents.length - 2;
|
|
4182
|
+
break;
|
|
4183
|
+
}
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
index = -1;
|
|
4188
|
+
while (++index < events.length) {
|
|
4189
|
+
if (events[index][1].type === "strikethroughSequenceTemporary") {
|
|
4190
|
+
events[index][1].type = "data";
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
return events;
|
|
4194
|
+
}
|
|
4195
|
+
function tokenizeStrikethrough(effects, ok3, nok) {
|
|
4196
|
+
const previous2 = this.previous;
|
|
4197
|
+
const events = this.events;
|
|
4198
|
+
let size = 0;
|
|
4199
|
+
return start;
|
|
4200
|
+
function start(code3) {
|
|
4201
|
+
if (previous2 === 126 && events[events.length - 1][1].type !== "characterEscape") {
|
|
4202
|
+
return nok(code3);
|
|
4203
|
+
}
|
|
4204
|
+
effects.enter("strikethroughSequenceTemporary");
|
|
4205
|
+
return more(code3);
|
|
4206
|
+
}
|
|
4207
|
+
function more(code3) {
|
|
4208
|
+
const before = classifyCharacter(previous2);
|
|
4209
|
+
if (code3 === 126) {
|
|
4210
|
+
if (size > 1) return nok(code3);
|
|
4211
|
+
effects.consume(code3);
|
|
4212
|
+
size++;
|
|
4213
|
+
return more;
|
|
4214
|
+
}
|
|
4215
|
+
if (size < 2 && !single) return nok(code3);
|
|
4216
|
+
const token = effects.exit("strikethroughSequenceTemporary");
|
|
4217
|
+
const after = classifyCharacter(code3);
|
|
4218
|
+
token._open = !after || after === 2 && Boolean(before);
|
|
4219
|
+
token._close = !before || before === 2 && Boolean(after);
|
|
4220
|
+
return ok3(code3);
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
|
|
4225
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/edit-map.js
|
|
4226
|
+
var EditMap = class {
|
|
4227
|
+
/**
|
|
4228
|
+
* Create a new edit map.
|
|
4229
|
+
*/
|
|
4230
|
+
constructor() {
|
|
4231
|
+
this.map = [];
|
|
4232
|
+
}
|
|
4233
|
+
/**
|
|
4234
|
+
* Create an edit: a remove and/or add at a certain place.
|
|
4235
|
+
*
|
|
4236
|
+
* @param {number} index
|
|
4237
|
+
* @param {number} remove
|
|
4238
|
+
* @param {Array<Event>} add
|
|
4239
|
+
* @returns {undefined}
|
|
4240
|
+
*/
|
|
4241
|
+
add(index, remove, add) {
|
|
4242
|
+
addImplementation(this, index, remove, add);
|
|
4243
|
+
}
|
|
4244
|
+
// To do: add this when moving to `micromark`.
|
|
4245
|
+
// /**
|
|
4246
|
+
// * Create an edit: but insert `add` before existing additions.
|
|
4247
|
+
// *
|
|
4248
|
+
// * @param {number} index
|
|
4249
|
+
// * @param {number} remove
|
|
4250
|
+
// * @param {Array<Event>} add
|
|
4251
|
+
// * @returns {undefined}
|
|
4252
|
+
// */
|
|
4253
|
+
// addBefore(index, remove, add) {
|
|
4254
|
+
// addImplementation(this, index, remove, add, true)
|
|
4255
|
+
// }
|
|
4256
|
+
/**
|
|
4257
|
+
* Done, change the events.
|
|
4258
|
+
*
|
|
4259
|
+
* @param {Array<Event>} events
|
|
4260
|
+
* @returns {undefined}
|
|
4261
|
+
*/
|
|
4262
|
+
consume(events) {
|
|
4263
|
+
this.map.sort(function(a, b) {
|
|
4264
|
+
return a[0] - b[0];
|
|
4265
|
+
});
|
|
4266
|
+
if (this.map.length === 0) {
|
|
4267
|
+
return;
|
|
4268
|
+
}
|
|
4269
|
+
let index = this.map.length;
|
|
4270
|
+
const vecs = [];
|
|
4271
|
+
while (index > 0) {
|
|
4272
|
+
index -= 1;
|
|
4273
|
+
vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
|
|
4274
|
+
events.length = this.map[index][0];
|
|
4275
|
+
}
|
|
4276
|
+
vecs.push(events.slice());
|
|
4277
|
+
events.length = 0;
|
|
4278
|
+
let slice = vecs.pop();
|
|
4279
|
+
while (slice) {
|
|
4280
|
+
for (const element of slice) {
|
|
4281
|
+
events.push(element);
|
|
4282
|
+
}
|
|
4283
|
+
slice = vecs.pop();
|
|
4284
|
+
}
|
|
4285
|
+
this.map.length = 0;
|
|
4286
|
+
}
|
|
4287
|
+
};
|
|
4288
|
+
function addImplementation(editMap, at, remove, add) {
|
|
4289
|
+
let index = 0;
|
|
4290
|
+
if (remove === 0 && add.length === 0) {
|
|
4291
|
+
return;
|
|
4292
|
+
}
|
|
4293
|
+
while (index < editMap.map.length) {
|
|
4294
|
+
if (editMap.map[index][0] === at) {
|
|
4295
|
+
editMap.map[index][1] += remove;
|
|
4296
|
+
editMap.map[index][2].push(...add);
|
|
4297
|
+
return;
|
|
4298
|
+
}
|
|
4299
|
+
index += 1;
|
|
4300
|
+
}
|
|
4301
|
+
editMap.map.push([at, remove, add]);
|
|
4302
|
+
}
|
|
4303
|
+
|
|
4304
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/infer.js
|
|
4305
|
+
function gfmTableAlign(events, index) {
|
|
4306
|
+
let inDelimiterRow = false;
|
|
4307
|
+
const align = [];
|
|
4308
|
+
while (index < events.length) {
|
|
4309
|
+
const event = events[index];
|
|
4310
|
+
if (inDelimiterRow) {
|
|
4311
|
+
if (event[0] === "enter") {
|
|
4312
|
+
if (event[1].type === "tableContent") {
|
|
4313
|
+
align.push(events[index + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
|
|
4314
|
+
}
|
|
4315
|
+
} else if (event[1].type === "tableContent") {
|
|
4316
|
+
if (events[index - 1][1].type === "tableDelimiterMarker") {
|
|
4317
|
+
const alignIndex = align.length - 1;
|
|
4318
|
+
align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
|
|
4319
|
+
}
|
|
4320
|
+
} else if (event[1].type === "tableDelimiterRow") {
|
|
4321
|
+
break;
|
|
4322
|
+
}
|
|
4323
|
+
} else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") {
|
|
4324
|
+
inDelimiterRow = true;
|
|
4325
|
+
}
|
|
4326
|
+
index += 1;
|
|
4327
|
+
}
|
|
4328
|
+
return align;
|
|
1171
4329
|
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
4330
|
+
|
|
4331
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-table@2.1.1/node_modules/micromark-extension-gfm-table/lib/syntax.js
|
|
4332
|
+
function gfmTable() {
|
|
4333
|
+
return {
|
|
4334
|
+
flow: {
|
|
4335
|
+
null: {
|
|
4336
|
+
name: "table",
|
|
4337
|
+
tokenize: tokenizeTable,
|
|
4338
|
+
resolveAll: resolveTable
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
};
|
|
4342
|
+
}
|
|
4343
|
+
function tokenizeTable(effects, ok3, nok) {
|
|
4344
|
+
const self = this;
|
|
4345
|
+
let size = 0;
|
|
4346
|
+
let sizeB = 0;
|
|
4347
|
+
let seen;
|
|
4348
|
+
return start;
|
|
4349
|
+
function start(code3) {
|
|
4350
|
+
let index = self.events.length - 1;
|
|
4351
|
+
while (index > -1) {
|
|
4352
|
+
const type = self.events[index][1].type;
|
|
4353
|
+
if (type === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
|
|
4354
|
+
type === "linePrefix") index--;
|
|
4355
|
+
else break;
|
|
1183
4356
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
4357
|
+
const tail = index > -1 ? self.events[index][1].type : null;
|
|
4358
|
+
const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
|
|
4359
|
+
if (next === bodyRowStart && self.parser.lazy[self.now().line]) {
|
|
4360
|
+
return nok(code3);
|
|
1188
4361
|
}
|
|
1189
|
-
|
|
4362
|
+
return next(code3);
|
|
1190
4363
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
4364
|
+
function headRowBefore(code3) {
|
|
4365
|
+
effects.enter("tableHead");
|
|
4366
|
+
effects.enter("tableRow");
|
|
4367
|
+
return headRowStart(code3);
|
|
1194
4368
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
4369
|
+
function headRowStart(code3) {
|
|
4370
|
+
if (code3 === 124) {
|
|
4371
|
+
return headRowBreak(code3);
|
|
4372
|
+
}
|
|
4373
|
+
seen = true;
|
|
4374
|
+
sizeB += 1;
|
|
4375
|
+
return headRowBreak(code3);
|
|
4376
|
+
}
|
|
4377
|
+
function headRowBreak(code3) {
|
|
4378
|
+
if (code3 === null) {
|
|
4379
|
+
return nok(code3);
|
|
4380
|
+
}
|
|
4381
|
+
if (markdownLineEnding(code3)) {
|
|
4382
|
+
if (sizeB > 1) {
|
|
4383
|
+
sizeB = 0;
|
|
4384
|
+
self.interrupt = true;
|
|
4385
|
+
effects.exit("tableRow");
|
|
4386
|
+
effects.enter("lineEnding");
|
|
4387
|
+
effects.consume(code3);
|
|
4388
|
+
effects.exit("lineEnding");
|
|
4389
|
+
return headDelimiterStart;
|
|
1200
4390
|
}
|
|
4391
|
+
return nok(code3);
|
|
1201
4392
|
}
|
|
1202
|
-
|
|
4393
|
+
if (markdownSpace(code3)) {
|
|
4394
|
+
return factorySpace(effects, headRowBreak, "whitespace")(code3);
|
|
4395
|
+
}
|
|
4396
|
+
sizeB += 1;
|
|
4397
|
+
if (seen) {
|
|
4398
|
+
seen = false;
|
|
4399
|
+
size += 1;
|
|
4400
|
+
}
|
|
4401
|
+
if (code3 === 124) {
|
|
4402
|
+
effects.enter("tableCellDivider");
|
|
4403
|
+
effects.consume(code3);
|
|
4404
|
+
effects.exit("tableCellDivider");
|
|
4405
|
+
seen = true;
|
|
4406
|
+
return headRowBreak;
|
|
4407
|
+
}
|
|
4408
|
+
effects.enter("data");
|
|
4409
|
+
return headRowData(code3);
|
|
1203
4410
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
const sectionEnd = findSectionEnd(generated, anchor.endIndex);
|
|
1209
|
-
pieces.push(generated.slice(cursor, sectionEnd));
|
|
1210
|
-
const blocks = anchorToBlocks.get(anchor.id);
|
|
1211
|
-
if (blocks && blocks.length > 0) {
|
|
1212
|
-
pieces.push(renderBlocks(blocks));
|
|
1213
|
-
anchorToBlocks.delete(anchor.id);
|
|
4411
|
+
function headRowData(code3) {
|
|
4412
|
+
if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) {
|
|
4413
|
+
effects.exit("data");
|
|
4414
|
+
return headRowBreak(code3);
|
|
1214
4415
|
}
|
|
1215
|
-
|
|
4416
|
+
effects.consume(code3);
|
|
4417
|
+
return code3 === 92 ? headRowEscape : headRowData;
|
|
1216
4418
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
4419
|
+
function headRowEscape(code3) {
|
|
4420
|
+
if (code3 === 92 || code3 === 124) {
|
|
4421
|
+
effects.consume(code3);
|
|
4422
|
+
return headRowData;
|
|
4423
|
+
}
|
|
4424
|
+
return headRowData(code3);
|
|
1219
4425
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
4426
|
+
function headDelimiterStart(code3) {
|
|
4427
|
+
self.interrupt = false;
|
|
4428
|
+
if (self.parser.lazy[self.now().line]) {
|
|
4429
|
+
return nok(code3);
|
|
4430
|
+
}
|
|
4431
|
+
effects.enter("tableDelimiterRow");
|
|
4432
|
+
seen = false;
|
|
4433
|
+
if (markdownSpace(code3)) {
|
|
4434
|
+
return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code3);
|
|
1223
4435
|
}
|
|
4436
|
+
return headDelimiterBefore(code3);
|
|
4437
|
+
}
|
|
4438
|
+
function headDelimiterBefore(code3) {
|
|
4439
|
+
if (code3 === 45 || code3 === 58) {
|
|
4440
|
+
return headDelimiterValueBefore(code3);
|
|
4441
|
+
}
|
|
4442
|
+
if (code3 === 124) {
|
|
4443
|
+
seen = true;
|
|
4444
|
+
effects.enter("tableCellDivider");
|
|
4445
|
+
effects.consume(code3);
|
|
4446
|
+
effects.exit("tableCellDivider");
|
|
4447
|
+
return headDelimiterCellBefore;
|
|
4448
|
+
}
|
|
4449
|
+
return headDelimiterNok(code3);
|
|
4450
|
+
}
|
|
4451
|
+
function headDelimiterCellBefore(code3) {
|
|
4452
|
+
if (markdownSpace(code3)) {
|
|
4453
|
+
return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code3);
|
|
4454
|
+
}
|
|
4455
|
+
return headDelimiterValueBefore(code3);
|
|
4456
|
+
}
|
|
4457
|
+
function headDelimiterValueBefore(code3) {
|
|
4458
|
+
if (code3 === 58) {
|
|
4459
|
+
sizeB += 1;
|
|
4460
|
+
seen = true;
|
|
4461
|
+
effects.enter("tableDelimiterMarker");
|
|
4462
|
+
effects.consume(code3);
|
|
4463
|
+
effects.exit("tableDelimiterMarker");
|
|
4464
|
+
return headDelimiterLeftAlignmentAfter;
|
|
4465
|
+
}
|
|
4466
|
+
if (code3 === 45) {
|
|
4467
|
+
sizeB += 1;
|
|
4468
|
+
return headDelimiterLeftAlignmentAfter(code3);
|
|
4469
|
+
}
|
|
4470
|
+
if (code3 === null || markdownLineEnding(code3)) {
|
|
4471
|
+
return headDelimiterCellAfter(code3);
|
|
4472
|
+
}
|
|
4473
|
+
return headDelimiterNok(code3);
|
|
4474
|
+
}
|
|
4475
|
+
function headDelimiterLeftAlignmentAfter(code3) {
|
|
4476
|
+
if (code3 === 45) {
|
|
4477
|
+
effects.enter("tableDelimiterFiller");
|
|
4478
|
+
return headDelimiterFiller(code3);
|
|
4479
|
+
}
|
|
4480
|
+
return headDelimiterNok(code3);
|
|
4481
|
+
}
|
|
4482
|
+
function headDelimiterFiller(code3) {
|
|
4483
|
+
if (code3 === 45) {
|
|
4484
|
+
effects.consume(code3);
|
|
4485
|
+
return headDelimiterFiller;
|
|
4486
|
+
}
|
|
4487
|
+
if (code3 === 58) {
|
|
4488
|
+
seen = true;
|
|
4489
|
+
effects.exit("tableDelimiterFiller");
|
|
4490
|
+
effects.enter("tableDelimiterMarker");
|
|
4491
|
+
effects.consume(code3);
|
|
4492
|
+
effects.exit("tableDelimiterMarker");
|
|
4493
|
+
return headDelimiterRightAlignmentAfter;
|
|
4494
|
+
}
|
|
4495
|
+
effects.exit("tableDelimiterFiller");
|
|
4496
|
+
return headDelimiterRightAlignmentAfter(code3);
|
|
4497
|
+
}
|
|
4498
|
+
function headDelimiterRightAlignmentAfter(code3) {
|
|
4499
|
+
if (markdownSpace(code3)) {
|
|
4500
|
+
return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code3);
|
|
4501
|
+
}
|
|
4502
|
+
return headDelimiterCellAfter(code3);
|
|
4503
|
+
}
|
|
4504
|
+
function headDelimiterCellAfter(code3) {
|
|
4505
|
+
if (code3 === 124) {
|
|
4506
|
+
return headDelimiterBefore(code3);
|
|
4507
|
+
}
|
|
4508
|
+
if (code3 === null || markdownLineEnding(code3)) {
|
|
4509
|
+
if (!seen || size !== sizeB) {
|
|
4510
|
+
return headDelimiterNok(code3);
|
|
4511
|
+
}
|
|
4512
|
+
effects.exit("tableDelimiterRow");
|
|
4513
|
+
effects.exit("tableHead");
|
|
4514
|
+
return ok3(code3);
|
|
4515
|
+
}
|
|
4516
|
+
return headDelimiterNok(code3);
|
|
4517
|
+
}
|
|
4518
|
+
function headDelimiterNok(code3) {
|
|
4519
|
+
return nok(code3);
|
|
4520
|
+
}
|
|
4521
|
+
function bodyRowStart(code3) {
|
|
4522
|
+
effects.enter("tableRow");
|
|
4523
|
+
return bodyRowBreak(code3);
|
|
4524
|
+
}
|
|
4525
|
+
function bodyRowBreak(code3) {
|
|
4526
|
+
if (code3 === 124) {
|
|
4527
|
+
effects.enter("tableCellDivider");
|
|
4528
|
+
effects.consume(code3);
|
|
4529
|
+
effects.exit("tableCellDivider");
|
|
4530
|
+
return bodyRowBreak;
|
|
4531
|
+
}
|
|
4532
|
+
if (code3 === null || markdownLineEnding(code3)) {
|
|
4533
|
+
effects.exit("tableRow");
|
|
4534
|
+
return ok3(code3);
|
|
4535
|
+
}
|
|
4536
|
+
if (markdownSpace(code3)) {
|
|
4537
|
+
return factorySpace(effects, bodyRowBreak, "whitespace")(code3);
|
|
4538
|
+
}
|
|
4539
|
+
effects.enter("data");
|
|
4540
|
+
return bodyRowData(code3);
|
|
4541
|
+
}
|
|
4542
|
+
function bodyRowData(code3) {
|
|
4543
|
+
if (code3 === null || code3 === 124 || markdownLineEndingOrSpace(code3)) {
|
|
4544
|
+
effects.exit("data");
|
|
4545
|
+
return bodyRowBreak(code3);
|
|
4546
|
+
}
|
|
4547
|
+
effects.consume(code3);
|
|
4548
|
+
return code3 === 92 ? bodyRowEscape : bodyRowData;
|
|
4549
|
+
}
|
|
4550
|
+
function bodyRowEscape(code3) {
|
|
4551
|
+
if (code3 === 92 || code3 === 124) {
|
|
4552
|
+
effects.consume(code3);
|
|
4553
|
+
return bodyRowData;
|
|
4554
|
+
}
|
|
4555
|
+
return bodyRowData(code3);
|
|
1224
4556
|
}
|
|
1225
|
-
return { content: pieces.join(""), orphans, warnings };
|
|
1226
4557
|
}
|
|
1227
|
-
function
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
4558
|
+
function resolveTable(events, context) {
|
|
4559
|
+
let index = -1;
|
|
4560
|
+
let inFirstCellAwaitingPipe = true;
|
|
4561
|
+
let rowKind = 0;
|
|
4562
|
+
let lastCell = [0, 0, 0, 0];
|
|
4563
|
+
let cell = [0, 0, 0, 0];
|
|
4564
|
+
let afterHeadAwaitingFirstBodyRow = false;
|
|
4565
|
+
let lastTableEnd = 0;
|
|
4566
|
+
let currentTable;
|
|
4567
|
+
let currentBody;
|
|
4568
|
+
let currentCell;
|
|
4569
|
+
const map3 = new EditMap();
|
|
4570
|
+
while (++index < events.length) {
|
|
4571
|
+
const event = events[index];
|
|
4572
|
+
const token = event[1];
|
|
4573
|
+
if (event[0] === "enter") {
|
|
4574
|
+
if (token.type === "tableHead") {
|
|
4575
|
+
afterHeadAwaitingFirstBodyRow = false;
|
|
4576
|
+
if (lastTableEnd !== 0) {
|
|
4577
|
+
flushTableEnd(map3, context, lastTableEnd, currentTable, currentBody);
|
|
4578
|
+
currentBody = void 0;
|
|
4579
|
+
lastTableEnd = 0;
|
|
4580
|
+
}
|
|
4581
|
+
currentTable = {
|
|
4582
|
+
type: "table",
|
|
4583
|
+
start: Object.assign({}, token.start),
|
|
4584
|
+
// Note: correct end is set later.
|
|
4585
|
+
end: Object.assign({}, token.end)
|
|
4586
|
+
};
|
|
4587
|
+
map3.add(index, 0, [["enter", currentTable, context]]);
|
|
4588
|
+
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
|
4589
|
+
inFirstCellAwaitingPipe = true;
|
|
4590
|
+
currentCell = void 0;
|
|
4591
|
+
lastCell = [0, 0, 0, 0];
|
|
4592
|
+
cell = [0, index + 1, 0, 0];
|
|
4593
|
+
if (afterHeadAwaitingFirstBodyRow) {
|
|
4594
|
+
afterHeadAwaitingFirstBodyRow = false;
|
|
4595
|
+
currentBody = {
|
|
4596
|
+
type: "tableBody",
|
|
4597
|
+
start: Object.assign({}, token.start),
|
|
4598
|
+
// Note: correct end is set later.
|
|
4599
|
+
end: Object.assign({}, token.end)
|
|
4600
|
+
};
|
|
4601
|
+
map3.add(index, 0, [["enter", currentBody, context]]);
|
|
4602
|
+
}
|
|
4603
|
+
rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
|
|
4604
|
+
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
|
4605
|
+
inFirstCellAwaitingPipe = false;
|
|
4606
|
+
if (cell[2] === 0) {
|
|
4607
|
+
if (lastCell[1] !== 0) {
|
|
4608
|
+
cell[0] = cell[1];
|
|
4609
|
+
currentCell = flushCell(map3, context, lastCell, rowKind, void 0, currentCell);
|
|
4610
|
+
lastCell = [0, 0, 0, 0];
|
|
4611
|
+
}
|
|
4612
|
+
cell[2] = index;
|
|
4613
|
+
}
|
|
4614
|
+
} else if (token.type === "tableCellDivider") {
|
|
4615
|
+
if (inFirstCellAwaitingPipe) {
|
|
4616
|
+
inFirstCellAwaitingPipe = false;
|
|
4617
|
+
} else {
|
|
4618
|
+
if (lastCell[1] !== 0) {
|
|
4619
|
+
cell[0] = cell[1];
|
|
4620
|
+
currentCell = flushCell(map3, context, lastCell, rowKind, void 0, currentCell);
|
|
4621
|
+
}
|
|
4622
|
+
lastCell = cell;
|
|
4623
|
+
cell = [lastCell[1], index, 0, 0];
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
} else if (token.type === "tableHead") {
|
|
4627
|
+
afterHeadAwaitingFirstBodyRow = true;
|
|
4628
|
+
lastTableEnd = index;
|
|
4629
|
+
} else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
|
|
4630
|
+
lastTableEnd = index;
|
|
4631
|
+
if (lastCell[1] !== 0) {
|
|
4632
|
+
cell[0] = cell[1];
|
|
4633
|
+
currentCell = flushCell(map3, context, lastCell, rowKind, index, currentCell);
|
|
4634
|
+
} else if (cell[1] !== 0) {
|
|
4635
|
+
currentCell = flushCell(map3, context, cell, rowKind, index, currentCell);
|
|
4636
|
+
}
|
|
4637
|
+
rowKind = 0;
|
|
4638
|
+
} else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
|
|
4639
|
+
cell[3] = index;
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
if (lastTableEnd !== 0) {
|
|
4643
|
+
flushTableEnd(map3, context, lastTableEnd, currentTable, currentBody);
|
|
4644
|
+
}
|
|
4645
|
+
map3.consume(context.events);
|
|
4646
|
+
index = -1;
|
|
4647
|
+
while (++index < context.events.length) {
|
|
4648
|
+
const event = context.events[index];
|
|
4649
|
+
if (event[0] === "enter" && event[1].type === "table") {
|
|
4650
|
+
event[1]._align = gfmTableAlign(context.events, index);
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
return events;
|
|
4654
|
+
}
|
|
4655
|
+
function flushCell(map3, context, range, rowKind, rowEnd, previousCell) {
|
|
4656
|
+
const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
|
|
4657
|
+
const valueName = "tableContent";
|
|
4658
|
+
if (range[0] !== 0) {
|
|
4659
|
+
previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
|
|
4660
|
+
map3.add(range[0], 0, [["exit", previousCell, context]]);
|
|
4661
|
+
}
|
|
4662
|
+
const now = getPoint(context.events, range[1]);
|
|
4663
|
+
previousCell = {
|
|
4664
|
+
type: groupName,
|
|
4665
|
+
start: Object.assign({}, now),
|
|
4666
|
+
// Note: correct end is set later.
|
|
4667
|
+
end: Object.assign({}, now)
|
|
4668
|
+
};
|
|
4669
|
+
map3.add(range[1], 0, [["enter", previousCell, context]]);
|
|
4670
|
+
if (range[2] !== 0) {
|
|
4671
|
+
const relatedStart = getPoint(context.events, range[2]);
|
|
4672
|
+
const relatedEnd = getPoint(context.events, range[3]);
|
|
4673
|
+
const valueToken = {
|
|
4674
|
+
type: valueName,
|
|
4675
|
+
start: Object.assign({}, relatedStart),
|
|
4676
|
+
end: Object.assign({}, relatedEnd)
|
|
4677
|
+
};
|
|
4678
|
+
map3.add(range[2], 0, [["enter", valueToken, context]]);
|
|
4679
|
+
if (rowKind !== 2) {
|
|
4680
|
+
const start = context.events[range[2]];
|
|
4681
|
+
const end = context.events[range[3]];
|
|
4682
|
+
start[1].end = Object.assign({}, end[1].end);
|
|
4683
|
+
start[1].type = "chunkText";
|
|
4684
|
+
start[1].contentType = "text";
|
|
4685
|
+
if (range[3] > range[2] + 1) {
|
|
4686
|
+
const a = range[2] + 1;
|
|
4687
|
+
const b = range[3] - range[2] - 1;
|
|
4688
|
+
map3.add(a, b, []);
|
|
4689
|
+
}
|
|
4690
|
+
}
|
|
4691
|
+
map3.add(range[3] + 1, 0, [["exit", valueToken, context]]);
|
|
4692
|
+
}
|
|
4693
|
+
if (rowEnd !== void 0) {
|
|
4694
|
+
previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
|
|
4695
|
+
map3.add(rowEnd, 0, [["exit", previousCell, context]]);
|
|
4696
|
+
previousCell = void 0;
|
|
4697
|
+
}
|
|
4698
|
+
return previousCell;
|
|
4699
|
+
}
|
|
4700
|
+
function flushTableEnd(map3, context, index, table, tableBody) {
|
|
4701
|
+
const exits = [];
|
|
4702
|
+
const related = getPoint(context.events, index);
|
|
4703
|
+
if (tableBody) {
|
|
4704
|
+
tableBody.end = Object.assign({}, related);
|
|
4705
|
+
exits.push(["exit", tableBody, context]);
|
|
4706
|
+
}
|
|
4707
|
+
table.end = Object.assign({}, related);
|
|
4708
|
+
exits.push(["exit", table, context]);
|
|
4709
|
+
map3.add(index + 1, 0, exits);
|
|
1232
4710
|
}
|
|
1233
|
-
function
|
|
1234
|
-
|
|
4711
|
+
function getPoint(events, index) {
|
|
4712
|
+
const event = events[index];
|
|
4713
|
+
const side = event[0] === "enter" ? "start" : "end";
|
|
4714
|
+
return event[1][side];
|
|
1235
4715
|
}
|
|
1236
|
-
function renderBlock(block) {
|
|
1237
|
-
const idAttr = block.hasExplicitId ? ` id="${block.id}"` : "";
|
|
1238
|
-
return `<!-- @manual:start${idAttr} -->
|
|
1239
|
-
${block.content}
|
|
1240
|
-
<!-- @manual:end -->
|
|
1241
4716
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
4717
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm-task-list-item@2.1.0/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
|
|
4718
|
+
var tasklistCheck = {
|
|
4719
|
+
name: "tasklistCheck",
|
|
4720
|
+
tokenize: tokenizeTasklistCheck
|
|
4721
|
+
};
|
|
4722
|
+
function gfmTaskListItem() {
|
|
4723
|
+
return {
|
|
4724
|
+
text: {
|
|
4725
|
+
[91]: tasklistCheck
|
|
4726
|
+
}
|
|
1250
4727
|
};
|
|
1251
|
-
if (block.hasExplicitId) out.manualBlockId = block.id;
|
|
1252
|
-
return out;
|
|
1253
4728
|
}
|
|
1254
|
-
function
|
|
1255
|
-
|
|
4729
|
+
function tokenizeTasklistCheck(effects, ok3, nok) {
|
|
4730
|
+
const self = this;
|
|
4731
|
+
return open;
|
|
4732
|
+
function open(code3) {
|
|
4733
|
+
if (
|
|
4734
|
+
// Exit if there’s stuff before.
|
|
4735
|
+
self.previous !== null || // Exit if not in the first content that is the first child of a list
|
|
4736
|
+
// item.
|
|
4737
|
+
!self._gfmTasklistFirstContentOfListItem
|
|
4738
|
+
) {
|
|
4739
|
+
return nok(code3);
|
|
4740
|
+
}
|
|
4741
|
+
effects.enter("taskListCheck");
|
|
4742
|
+
effects.enter("taskListCheckMarker");
|
|
4743
|
+
effects.consume(code3);
|
|
4744
|
+
effects.exit("taskListCheckMarker");
|
|
4745
|
+
return inside;
|
|
4746
|
+
}
|
|
4747
|
+
function inside(code3) {
|
|
4748
|
+
if (markdownLineEndingOrSpace(code3)) {
|
|
4749
|
+
effects.enter("taskListCheckValueUnchecked");
|
|
4750
|
+
effects.consume(code3);
|
|
4751
|
+
effects.exit("taskListCheckValueUnchecked");
|
|
4752
|
+
return close2;
|
|
4753
|
+
}
|
|
4754
|
+
if (code3 === 88 || code3 === 120) {
|
|
4755
|
+
effects.enter("taskListCheckValueChecked");
|
|
4756
|
+
effects.consume(code3);
|
|
4757
|
+
effects.exit("taskListCheckValueChecked");
|
|
4758
|
+
return close2;
|
|
4759
|
+
}
|
|
4760
|
+
return nok(code3);
|
|
4761
|
+
}
|
|
4762
|
+
function close2(code3) {
|
|
4763
|
+
if (code3 === 93) {
|
|
4764
|
+
effects.enter("taskListCheckMarker");
|
|
4765
|
+
effects.consume(code3);
|
|
4766
|
+
effects.exit("taskListCheckMarker");
|
|
4767
|
+
effects.exit("taskListCheck");
|
|
4768
|
+
return after;
|
|
4769
|
+
}
|
|
4770
|
+
return nok(code3);
|
|
4771
|
+
}
|
|
4772
|
+
function after(code3) {
|
|
4773
|
+
if (markdownLineEnding(code3)) {
|
|
4774
|
+
return ok3(code3);
|
|
4775
|
+
}
|
|
4776
|
+
if (markdownSpace(code3)) {
|
|
4777
|
+
return effects.check({
|
|
4778
|
+
tokenize: spaceThenNonSpace
|
|
4779
|
+
}, ok3, nok)(code3);
|
|
4780
|
+
}
|
|
4781
|
+
return nok(code3);
|
|
4782
|
+
}
|
|
1256
4783
|
}
|
|
1257
|
-
function
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
4784
|
+
function spaceThenNonSpace(effects, ok3, nok) {
|
|
4785
|
+
return factorySpace(effects, after, "whitespace");
|
|
4786
|
+
function after(code3) {
|
|
4787
|
+
return code3 === null ? nok(code3) : ok3(code3);
|
|
4788
|
+
}
|
|
1262
4789
|
}
|
|
1263
|
-
function renderOrphanFile(record) {
|
|
1264
|
-
const fields = {
|
|
1265
|
-
orphaned: record.orphanedAt,
|
|
1266
|
-
source_file: record.sourceFile,
|
|
1267
|
-
anchor_id: record.anchorId
|
|
1268
|
-
};
|
|
1269
|
-
if (record.anchorLastSeen) fields.anchor_last_seen = record.anchorLastSeen;
|
|
1270
|
-
if (record.manualBlockId) fields.manual_block_id = record.manualBlockId;
|
|
1271
|
-
const yaml = Object.entries(fields).map(([k, v]) => `${k}: ${formatYamlScalar2(v)}`).join("\n");
|
|
1272
|
-
return `---
|
|
1273
|
-
${yaml}
|
|
1274
|
-
---
|
|
1275
4790
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
await (0, import_promises2.writeFile)(absPath, renderOrphanFile(record), "utf8");
|
|
1286
|
-
return absPath;
|
|
4791
|
+
// ../../node_modules/.pnpm/micromark-extension-gfm@3.0.0/node_modules/micromark-extension-gfm/index.js
|
|
4792
|
+
function gfm(options) {
|
|
4793
|
+
return combineExtensions([
|
|
4794
|
+
gfmAutolinkLiteral(),
|
|
4795
|
+
gfmFootnote(),
|
|
4796
|
+
gfmStrikethrough(options),
|
|
4797
|
+
gfmTable(),
|
|
4798
|
+
gfmTaskListItem()
|
|
4799
|
+
]);
|
|
1287
4800
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
4801
|
+
|
|
4802
|
+
// ../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js
|
|
4803
|
+
var emptyOptions2 = {};
|
|
4804
|
+
function remarkGfm(options) {
|
|
4805
|
+
const self = (
|
|
4806
|
+
/** @type {Processor<Root>} */
|
|
4807
|
+
this
|
|
4808
|
+
);
|
|
4809
|
+
const settings = options || emptyOptions2;
|
|
4810
|
+
const data = self.data();
|
|
4811
|
+
const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
|
|
4812
|
+
const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
|
|
4813
|
+
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
|
4814
|
+
micromarkExtensions.push(gfm(settings));
|
|
4815
|
+
fromMarkdownExtensions.push(gfmFromMarkdown());
|
|
4816
|
+
toMarkdownExtensions.push(gfmToMarkdown(settings));
|
|
1293
4817
|
}
|
|
1294
4818
|
|
|
1295
4819
|
// ../site/dist/index.js
|
|
1296
|
-
var import_fs2 = require("fs");
|
|
1297
|
-
var import_promises3 = require("fs/promises");
|
|
1298
|
-
var import_path5 = __toESM(require("path"), 1);
|
|
1299
|
-
var import_url = require("url");
|
|
1300
|
-
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
1301
|
-
var import_unified = require("unified");
|
|
1302
|
-
var import_remark_parse = __toESM(require("remark-parse"), 1);
|
|
1303
4820
|
var import_remark_rehype = __toESM(require("remark-rehype"), 1);
|
|
1304
4821
|
var import_rehype_raw = __toESM(require("rehype-raw"), 1);
|
|
1305
4822
|
var import_rehype_sanitize = __toESM(require("rehype-sanitize"), 1);
|
|
1306
4823
|
var import_rehype_slug = __toESM(require("rehype-slug"), 1);
|
|
1307
4824
|
var import_rehype_autolink_headings = __toESM(require("rehype-autolink-headings"), 1);
|
|
1308
4825
|
var import_rehype_stringify = __toESM(require("rehype-stringify"), 1);
|
|
1309
|
-
var
|
|
4826
|
+
var import_unist_util_visit2 = require("unist-util-visit");
|
|
1310
4827
|
var import_shiki = require("shiki");
|
|
1311
4828
|
var import_promises4 = require("fs/promises");
|
|
1312
4829
|
var import_path6 = __toESM(require("path"), 1);
|
|
@@ -1318,15 +4835,18 @@ var pagefind = __toESM(require("pagefind"), 1);
|
|
|
1318
4835
|
var import_check = __toESM(require("lucide/dist/esm/icons/check.mjs"), 1);
|
|
1319
4836
|
var import_chevron_down = __toESM(require("lucide/dist/esm/icons/chevron-down.mjs"), 1);
|
|
1320
4837
|
var import_external_link = __toESM(require("lucide/dist/esm/icons/external-link.mjs"), 1);
|
|
4838
|
+
var import_mail = __toESM(require("lucide/dist/esm/icons/mail.mjs"), 1);
|
|
1321
4839
|
var import_menu = __toESM(require("lucide/dist/esm/icons/menu.mjs"), 1);
|
|
1322
4840
|
var import_monitor = __toESM(require("lucide/dist/esm/icons/monitor.mjs"), 1);
|
|
1323
4841
|
var import_moon = __toESM(require("lucide/dist/esm/icons/moon.mjs"), 1);
|
|
4842
|
+
var import_package = __toESM(require("lucide/dist/esm/icons/package.mjs"), 1);
|
|
4843
|
+
var import_rss = __toESM(require("lucide/dist/esm/icons/rss.mjs"), 1);
|
|
1324
4844
|
var import_search = __toESM(require("lucide/dist/esm/icons/search.mjs"), 1);
|
|
1325
4845
|
var import_sun = __toESM(require("lucide/dist/esm/icons/sun.mjs"), 1);
|
|
1326
4846
|
var import_x = __toESM(require("lucide/dist/esm/icons/x.mjs"), 1);
|
|
1327
4847
|
var import_unified2 = require("unified");
|
|
1328
4848
|
var import_remark_parse2 = __toESM(require("remark-parse"), 1);
|
|
1329
|
-
var
|
|
4849
|
+
var import_unist_util_visit3 = require("unist-util-visit");
|
|
1330
4850
|
var import_meta = {};
|
|
1331
4851
|
var CODE_THEME_PAIRS = {
|
|
1332
4852
|
github: { light: "github-light", dark: "github-dark" },
|
|
@@ -1375,7 +4895,7 @@ async function renderMarkdown(md, opts = {}) {
|
|
|
1375
4895
|
const highlighter = await getHighlighter();
|
|
1376
4896
|
const themes = CODE_THEME_PAIRS[opts.codeTheme ?? "github"] ?? CODE_THEME_PAIRS.github;
|
|
1377
4897
|
const headings = [];
|
|
1378
|
-
const file = await (0, import_unified.unified)().use(import_remark_parse.default).use(import_remark_rehype.default, { allowDangerousHtml: true }).use(import_rehype_raw.default).use(import_rehype_sanitize.default, SANITIZE_SCHEMA).use(import_rehype_slug.default).use(import_rehype_autolink_headings.default, {
|
|
4898
|
+
const file = await (0, import_unified.unified)().use(import_remark_parse.default).use(remarkGfm).use(import_remark_rehype.default, { allowDangerousHtml: true }).use(import_rehype_raw.default).use(import_rehype_sanitize.default, SANITIZE_SCHEMA).use(rehypeCallouts).use(rehypeTableWrap).use(import_rehype_slug.default).use(import_rehype_autolink_headings.default, {
|
|
1379
4899
|
// `append` keeps the heading text flush-left along with the prose;
|
|
1380
4900
|
// the `#` indicator floats in after the text on hover (see styles).
|
|
1381
4901
|
behavior: "append",
|
|
@@ -1387,29 +4907,103 @@ async function renderMarkdown(md, opts = {}) {
|
|
|
1387
4907
|
}).use(import_rehype_stringify.default, { allowDangerousHtml: true }).process(md);
|
|
1388
4908
|
return { html: String(file), headings };
|
|
1389
4909
|
}
|
|
4910
|
+
function rehypeTableWrap() {
|
|
4911
|
+
return (tree) => {
|
|
4912
|
+
(0, import_unist_util_visit2.visit)(tree, "element", (node2, index, parent) => {
|
|
4913
|
+
if (node2.tagName !== "table") return;
|
|
4914
|
+
if (!parent || typeof index !== "number") return;
|
|
4915
|
+
if (parent.type === "element" && readClassNames(parent).includes("ov-table-wrap")) {
|
|
4916
|
+
return;
|
|
4917
|
+
}
|
|
4918
|
+
const wrapper = {
|
|
4919
|
+
type: "element",
|
|
4920
|
+
tagName: "div",
|
|
4921
|
+
properties: { className: ["ov-table-wrap"] },
|
|
4922
|
+
children: [node2]
|
|
4923
|
+
};
|
|
4924
|
+
parent.children[index] = wrapper;
|
|
4925
|
+
});
|
|
4926
|
+
};
|
|
4927
|
+
}
|
|
4928
|
+
var CALLOUT_RE = /^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][^\S\n]*\n?/i;
|
|
4929
|
+
var CALLOUT_LABEL = {
|
|
4930
|
+
note: "Note",
|
|
4931
|
+
tip: "Tip",
|
|
4932
|
+
important: "Important",
|
|
4933
|
+
warning: "Warning",
|
|
4934
|
+
caution: "Caution"
|
|
4935
|
+
};
|
|
4936
|
+
function rehypeCallouts() {
|
|
4937
|
+
return (tree) => {
|
|
4938
|
+
(0, import_unist_util_visit2.visit)(tree, "element", (node2) => {
|
|
4939
|
+
if (node2.tagName !== "blockquote") return;
|
|
4940
|
+
const firstP = node2.children.find(
|
|
4941
|
+
(c) => c.type === "element" && c.tagName === "p"
|
|
4942
|
+
);
|
|
4943
|
+
if (!firstP) return;
|
|
4944
|
+
const firstText = firstP.children[0];
|
|
4945
|
+
if (!firstText || firstText.type !== "text") return;
|
|
4946
|
+
const m = CALLOUT_RE.exec(firstText.value);
|
|
4947
|
+
if (!m) return;
|
|
4948
|
+
const type = m[1].toLowerCase();
|
|
4949
|
+
firstText.value = firstText.value.slice(m[0].length);
|
|
4950
|
+
const stripped = firstText.value.replace(/^\s+/, "");
|
|
4951
|
+
if (firstP.children.length === 1 && firstText.type === "text" && stripped.length === 0) {
|
|
4952
|
+
node2.children = node2.children.filter((c) => c !== firstP);
|
|
4953
|
+
} else {
|
|
4954
|
+
firstText.value = stripped;
|
|
4955
|
+
}
|
|
4956
|
+
node2.tagName = "div";
|
|
4957
|
+
node2.properties = {
|
|
4958
|
+
...node2.properties ?? {},
|
|
4959
|
+
className: ["ov-callout", `ov-callout--${type}`]
|
|
4960
|
+
};
|
|
4961
|
+
const label = {
|
|
4962
|
+
type: "element",
|
|
4963
|
+
tagName: "div",
|
|
4964
|
+
properties: { className: ["ov-callout-label"] },
|
|
4965
|
+
children: [{ type: "text", value: CALLOUT_LABEL[type] }]
|
|
4966
|
+
};
|
|
4967
|
+
node2.children = [label, ...node2.children];
|
|
4968
|
+
});
|
|
4969
|
+
};
|
|
4970
|
+
}
|
|
1390
4971
|
function collectHeadings(tree, into) {
|
|
1391
|
-
(0,
|
|
1392
|
-
if (!/^h[2-3]$/.test(
|
|
1393
|
-
const depth = Number(
|
|
1394
|
-
const id = typeof
|
|
4972
|
+
(0, import_unist_util_visit2.visit)(tree, "element", (node2) => {
|
|
4973
|
+
if (!/^h[2-3]$/.test(node2.tagName)) return;
|
|
4974
|
+
const depth = Number(node2.tagName.slice(1));
|
|
4975
|
+
const id = typeof node2.properties?.id === "string" ? node2.properties.id : "";
|
|
1395
4976
|
if (!id) return;
|
|
1396
|
-
const
|
|
1397
|
-
into.push({ depth, text, id });
|
|
4977
|
+
const text3 = textOfHeading(node2).trim();
|
|
4978
|
+
into.push({ depth, text: text3, id });
|
|
1398
4979
|
});
|
|
1399
4980
|
}
|
|
4981
|
+
function textOfHeading(node2) {
|
|
4982
|
+
let out = "";
|
|
4983
|
+
for (const child of node2.children) {
|
|
4984
|
+
if (child.type === "text") {
|
|
4985
|
+
out += child.value;
|
|
4986
|
+
} else if (child.type === "element") {
|
|
4987
|
+
const classNames = readClassNames(child);
|
|
4988
|
+
if (classNames.includes("heading-anchor")) continue;
|
|
4989
|
+
out += textOf(child);
|
|
4990
|
+
}
|
|
4991
|
+
}
|
|
4992
|
+
return out;
|
|
4993
|
+
}
|
|
1400
4994
|
function highlightCodeBlocks(tree, highlighter, themes) {
|
|
1401
|
-
(0,
|
|
1402
|
-
if (
|
|
4995
|
+
(0, import_unist_util_visit2.visit)(tree, "element", (node2, index, parent) => {
|
|
4996
|
+
if (node2.tagName !== "pre" || !parent || typeof index !== "number" || !node2.children?.length) {
|
|
1403
4997
|
return;
|
|
1404
4998
|
}
|
|
1405
|
-
const
|
|
4999
|
+
const code3 = node2.children.find(
|
|
1406
5000
|
(c) => c.type === "element" && c.tagName === "code"
|
|
1407
5001
|
);
|
|
1408
|
-
if (!
|
|
1409
|
-
const langClass = readClassNames(
|
|
5002
|
+
if (!code3) return;
|
|
5003
|
+
const langClass = readClassNames(code3).find((c) => c.startsWith("language-"));
|
|
1410
5004
|
const lang = langClass ? langClass.slice("language-".length) : "text";
|
|
1411
5005
|
if (!SHIKI_LANGS.includes(lang)) return;
|
|
1412
|
-
const source = textOf(
|
|
5006
|
+
const source = textOf(code3);
|
|
1413
5007
|
const hast = highlighter.codeToHast(source, {
|
|
1414
5008
|
lang,
|
|
1415
5009
|
themes,
|
|
@@ -1417,48 +5011,66 @@ function highlightCodeBlocks(tree, highlighter, themes) {
|
|
|
1417
5011
|
});
|
|
1418
5012
|
const replacement = hast.children[0];
|
|
1419
5013
|
if (!replacement || replacement.type !== "element") return;
|
|
5014
|
+
replacement.properties = {
|
|
5015
|
+
...replacement.properties ?? {},
|
|
5016
|
+
"data-language": LANG_LABEL[lang] ?? lang,
|
|
5017
|
+
"data-copy": "true"
|
|
5018
|
+
};
|
|
1420
5019
|
parent.children[index] = replacement;
|
|
1421
5020
|
});
|
|
1422
5021
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
5022
|
+
var LANG_LABEL = {
|
|
5023
|
+
typescript: "ts",
|
|
5024
|
+
tsx: "tsx",
|
|
5025
|
+
javascript: "js",
|
|
5026
|
+
jsx: "jsx",
|
|
5027
|
+
json: "json",
|
|
5028
|
+
bash: "bash",
|
|
5029
|
+
shell: "shell",
|
|
5030
|
+
markdown: "md",
|
|
5031
|
+
yaml: "yaml",
|
|
5032
|
+
html: "html",
|
|
5033
|
+
css: "css"
|
|
5034
|
+
};
|
|
5035
|
+
function readClassNames(node2) {
|
|
5036
|
+
const cn = node2.properties?.className;
|
|
1425
5037
|
if (Array.isArray(cn)) return cn.filter((c) => typeof c === "string");
|
|
1426
5038
|
if (typeof cn === "string") return cn.split(/\s+/);
|
|
1427
5039
|
return [];
|
|
1428
5040
|
}
|
|
1429
|
-
function textOf(
|
|
5041
|
+
function textOf(node2) {
|
|
1430
5042
|
let out = "";
|
|
1431
|
-
for (const child of
|
|
5043
|
+
for (const child of node2.children) {
|
|
1432
5044
|
if (child.type === "text") out += child.value;
|
|
1433
5045
|
else if (child.type === "element") out += textOf(child);
|
|
1434
5046
|
}
|
|
1435
5047
|
return out;
|
|
1436
5048
|
}
|
|
1437
|
-
function flattenNav(
|
|
5049
|
+
function flattenNav(root2) {
|
|
1438
5050
|
const out = [];
|
|
1439
|
-
function walk2(
|
|
1440
|
-
if (
|
|
1441
|
-
for (const child of
|
|
5051
|
+
function walk2(node2) {
|
|
5052
|
+
if (node2.sourcePath !== void 0) out.push(node2);
|
|
5053
|
+
for (const child of node2.children) walk2(child);
|
|
1442
5054
|
}
|
|
1443
|
-
walk2(
|
|
5055
|
+
walk2(root2);
|
|
1444
5056
|
return out;
|
|
1445
5057
|
}
|
|
1446
|
-
function findBreadcrumbs(
|
|
5058
|
+
function findBreadcrumbs(root2, url) {
|
|
1447
5059
|
const path32 = [];
|
|
1448
|
-
function walk2(
|
|
1449
|
-
path32.push(
|
|
1450
|
-
if (
|
|
1451
|
-
for (const child of
|
|
5060
|
+
function walk2(node2) {
|
|
5061
|
+
path32.push(node2);
|
|
5062
|
+
if (node2.url === url) return true;
|
|
5063
|
+
for (const child of node2.children) {
|
|
1452
5064
|
if (walk2(child)) return true;
|
|
1453
5065
|
}
|
|
1454
5066
|
path32.pop();
|
|
1455
5067
|
return false;
|
|
1456
5068
|
}
|
|
1457
|
-
walk2(
|
|
5069
|
+
walk2(root2);
|
|
1458
5070
|
return path32;
|
|
1459
5071
|
}
|
|
1460
|
-
function findAdjacent(
|
|
1461
|
-
const flat = flattenNav(
|
|
5072
|
+
function findAdjacent(root2, url) {
|
|
5073
|
+
const flat = flattenNav(root2);
|
|
1462
5074
|
const idx = flat.findIndex((p) => p.url === url);
|
|
1463
5075
|
if (idx === -1) return {};
|
|
1464
5076
|
return {
|
|
@@ -1544,8 +5156,8 @@ function applyOrdering(children, meta) {
|
|
|
1544
5156
|
}
|
|
1545
5157
|
children.sort((a, b) => a.title.localeCompare(b.title));
|
|
1546
5158
|
}
|
|
1547
|
-
function slugOf(
|
|
1548
|
-
const trimmed =
|
|
5159
|
+
function slugOf(node2) {
|
|
5160
|
+
const trimmed = node2.url.replace(/\/+$/, "");
|
|
1549
5161
|
return trimmed.slice(trimmed.lastIndexOf("/") + 1);
|
|
1550
5162
|
}
|
|
1551
5163
|
function isMarkdown(name) {
|
|
@@ -1613,13 +5225,66 @@ async function indexSite(input2) {
|
|
|
1613
5225
|
errors: writeRes.errors
|
|
1614
5226
|
};
|
|
1615
5227
|
}
|
|
1616
|
-
function
|
|
5228
|
+
function generateRss(input2) {
|
|
1617
5229
|
if (!input2.baseUrl) return void 0;
|
|
1618
5230
|
const base = stripTrailingSlash(input2.baseUrl);
|
|
1619
5231
|
const prefix = input2.basePath ? stripTrailingSlash(input2.basePath) : "";
|
|
1620
5232
|
const exclude = new Set(input2.exclude ?? ["/404/"]);
|
|
5233
|
+
const limit = input2.limit ?? 20;
|
|
5234
|
+
const generatedAt = input2.generatedAt ?? /* @__PURE__ */ new Date();
|
|
5235
|
+
const homeLink = base + (prefix || "/");
|
|
5236
|
+
const selfLink = base + prefix + "/feed.xml";
|
|
5237
|
+
const items = input2.pages.filter((p) => !exclude.has(p.url)).sort((a, b) => compareLastMod(a.lastModified, b.lastModified)).slice(0, limit).map((p) => renderItem(p, base + prefix));
|
|
5238
|
+
const channelDesc = input2.description ? escapeXml(input2.description) : "";
|
|
5239
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
5240
|
+
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
5241
|
+
<channel>
|
|
5242
|
+
<title>${escapeXml(input2.title)}</title>
|
|
5243
|
+
<link>${escapeXml(homeLink)}</link>
|
|
5244
|
+
<description>${channelDesc}</description>
|
|
5245
|
+
<atom:link href="${escapeXml(selfLink)}" rel="self" type="application/rss+xml" />
|
|
5246
|
+
<lastBuildDate>${toRfc822(generatedAt)}</lastBuildDate>
|
|
5247
|
+
${items.join("\n")}
|
|
5248
|
+
</channel>
|
|
5249
|
+
</rss>
|
|
5250
|
+
`;
|
|
5251
|
+
}
|
|
5252
|
+
function renderItem(page, baseWithPrefix) {
|
|
5253
|
+
const link2 = baseWithPrefix + page.url;
|
|
5254
|
+
const pubDate = page.lastModified ? toRfc822(new Date(page.lastModified)) : void 0;
|
|
5255
|
+
const lines = [
|
|
5256
|
+
" <item>",
|
|
5257
|
+
` <title>${escapeXml(page.title)}</title>`,
|
|
5258
|
+
` <link>${escapeXml(link2)}</link>`,
|
|
5259
|
+
` <guid isPermaLink="true">${escapeXml(link2)}</guid>`,
|
|
5260
|
+
` <description>${page.description ? escapeXml(page.description) : ""}</description>`
|
|
5261
|
+
];
|
|
5262
|
+
if (pubDate) lines.push(` <pubDate>${pubDate}</pubDate>`);
|
|
5263
|
+
lines.push(" </item>");
|
|
5264
|
+
return lines.join("\n");
|
|
5265
|
+
}
|
|
5266
|
+
function compareLastMod(a, b) {
|
|
5267
|
+
if (a && b) return b.localeCompare(a);
|
|
5268
|
+
if (a && !b) return -1;
|
|
5269
|
+
if (!a && b) return 1;
|
|
5270
|
+
return 0;
|
|
5271
|
+
}
|
|
5272
|
+
function toRfc822(d) {
|
|
5273
|
+
return d.toUTCString();
|
|
5274
|
+
}
|
|
5275
|
+
function stripTrailingSlash(s) {
|
|
5276
|
+
return s.replace(/\/+$/, "");
|
|
5277
|
+
}
|
|
5278
|
+
function escapeXml(s) {
|
|
5279
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5280
|
+
}
|
|
5281
|
+
function generateSitemap(input2) {
|
|
5282
|
+
if (!input2.baseUrl) return void 0;
|
|
5283
|
+
const base = stripTrailingSlash2(input2.baseUrl);
|
|
5284
|
+
const prefix = input2.basePath ? stripTrailingSlash2(input2.basePath) : "";
|
|
5285
|
+
const exclude = new Set(input2.exclude ?? ["/404/"]);
|
|
1621
5286
|
const entries = input2.pages.filter((p) => !exclude.has(p.url)).map((p) => ` <url>
|
|
1622
|
-
<loc>${
|
|
5287
|
+
<loc>${escapeXml2(base + prefix + p.url)}</loc>
|
|
1623
5288
|
</url>`).join("\n");
|
|
1624
5289
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
1625
5290
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
@@ -1627,10 +5292,10 @@ ${entries}
|
|
|
1627
5292
|
</urlset>
|
|
1628
5293
|
`;
|
|
1629
5294
|
}
|
|
1630
|
-
function
|
|
5295
|
+
function stripTrailingSlash2(s) {
|
|
1631
5296
|
return s.replace(/\/+$/, "");
|
|
1632
5297
|
}
|
|
1633
|
-
function
|
|
5298
|
+
function escapeXml2(s) {
|
|
1634
5299
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1635
5300
|
}
|
|
1636
5301
|
var GITHUB_MARK = [
|
|
@@ -1652,7 +5317,10 @@ var REGISTRY = {
|
|
|
1652
5317
|
github: GITHUB_MARK,
|
|
1653
5318
|
"external-link": import_external_link.default,
|
|
1654
5319
|
search: import_search.default,
|
|
1655
|
-
check: import_check.default
|
|
5320
|
+
check: import_check.default,
|
|
5321
|
+
rss: import_rss.default,
|
|
5322
|
+
mail: import_mail.default,
|
|
5323
|
+
package: import_package.default
|
|
1656
5324
|
};
|
|
1657
5325
|
var ICONS = Object.fromEntries(
|
|
1658
5326
|
Object.keys(REGISTRY).map((name) => [name, nodesToInnerHtml(REGISTRY[name])])
|
|
@@ -1668,8 +5336,8 @@ function renderIcon(name, opts = {}) {
|
|
|
1668
5336
|
function nodesToInnerHtml(nodes) {
|
|
1669
5337
|
return nodes.map(nodeToHtml).join("");
|
|
1670
5338
|
}
|
|
1671
|
-
function nodeToHtml(
|
|
1672
|
-
const [tag, attrs, children] =
|
|
5339
|
+
function nodeToHtml(node2) {
|
|
5340
|
+
const [tag, attrs, children] = node2;
|
|
1673
5341
|
const attrStr = Object.entries(attrs).map(([k, v]) => `${k}="${escapeAttr(String(v))}"`).join(" ");
|
|
1674
5342
|
const inner = children && children.length > 0 ? nodesToInnerHtml(children) : "";
|
|
1675
5343
|
return inner ? `<${tag} ${attrStr}>${inner}</${tag}>` : `<${tag} ${attrStr}/>`;
|
|
@@ -1716,17 +5384,37 @@ function renderShell(opts) {
|
|
|
1716
5384
|
<head>
|
|
1717
5385
|
<meta charset="utf-8">
|
|
1718
5386
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5387
|
+
<!-- Drives Safari's URL bar tint and the top-of-page rubber-band area.
|
|
5388
|
+
data-light / data-dark are hex approximations of --color-bg
|
|
5389
|
+
(body) in light + dark \u2014 the topbar now reads as a continuation
|
|
5390
|
+
of the body, so the URL bar should match body, not chrome.
|
|
5391
|
+
Update these if --color-bg moves. The inline boot script below
|
|
5392
|
+
picks the right one before paint, and script.js keeps it in
|
|
5393
|
+
sync with the theme toggle + OS changes. -->
|
|
5394
|
+
<meta name="theme-color" id="ov-theme-color" data-light="#f4f4f4" data-dark="#101010" content="#f4f4f4">
|
|
1719
5395
|
<title>${escapeHtml(opts.fullTitle)}</title>
|
|
1720
5396
|
${desc ? `<meta name="description" content="${escapeAttr2(desc)}">` : ""}
|
|
1721
5397
|
${opts.site.baseUrl ? `<link rel="canonical" href="${escapeAttr2(join(opts.site.baseUrl, basePath + opts.url))}">` : ""}
|
|
5398
|
+
${opts.site.baseUrl ? `<link rel="alternate" type="application/rss+xml" title="${escapeAttr2(opts.site.title)}" href="${escapeAttr2(join(opts.site.baseUrl, basePath + "/feed.xml"))}">` : ""}
|
|
1722
5399
|
<link rel="stylesheet" href="${escapeAttr2(assets)}assets/ovellum.css">
|
|
1723
5400
|
${searchHead}
|
|
5401
|
+
${opts.site.headExtra ?? ""}
|
|
1724
5402
|
<script>
|
|
1725
5403
|
(function () {
|
|
1726
5404
|
try {
|
|
1727
5405
|
var t = localStorage.getItem('ovellum-theme');
|
|
1728
5406
|
if (t === 'light' || t === 'dark' || t === 'auto') {
|
|
1729
5407
|
document.documentElement.setAttribute('data-theme', t);
|
|
5408
|
+
} else {
|
|
5409
|
+
t = document.documentElement.getAttribute('data-theme') || 'auto';
|
|
5410
|
+
}
|
|
5411
|
+
var effective = t;
|
|
5412
|
+
if (t === 'auto') {
|
|
5413
|
+
effective = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
5414
|
+
}
|
|
5415
|
+
var meta = document.getElementById('ov-theme-color');
|
|
5416
|
+
if (meta) {
|
|
5417
|
+
meta.setAttribute('content', meta.getAttribute(effective === 'dark' ? 'data-dark' : 'data-light'));
|
|
1730
5418
|
}
|
|
1731
5419
|
} catch (_) {}
|
|
1732
5420
|
})();
|
|
@@ -1735,28 +5423,47 @@ function renderShell(opts) {
|
|
|
1735
5423
|
<body${opts.bodyClass ? ` class="${escapeAttr2(opts.bodyClass)}"` : ""}>
|
|
1736
5424
|
${renderTopbar(opts.site, assets, opts.docsHref ? siteUrl(opts.docsHref, basePath) : void 0, searchEnabled, basePath)}
|
|
1737
5425
|
${opts.body}
|
|
1738
|
-
${renderFooter(opts.site, opts.generatedAt)}
|
|
5426
|
+
${renderFooter(opts.site, opts.generatedAt, basePath)}
|
|
1739
5427
|
${searchScripts}
|
|
1740
5428
|
<script src="${escapeAttr2(assets)}assets/ovellum.js" defer></script>
|
|
1741
5429
|
</body>
|
|
1742
5430
|
</html>
|
|
1743
5431
|
`;
|
|
1744
5432
|
}
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
5433
|
+
var BRAND_MARK = `<svg class="ov-brand-mark" width="24" height="24" viewBox="0 0 3334 3334" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M1610.79,192.942l-603.283,-0.069c-72.722,290.674 -294.48,871.657 -294.48,871.657c-53.158,128.398 -37.404,275.067 41.795,389.217l743.687,1149.95l0,233.06c-42.509,41.505 -68.98,99.335 -68.98,163.352c-0.069,126.096 102.07,228.236 228.167,228.167c126.096,0.069 228.308,-102.144 228.235,-228.236c-0,-64.017 -26.471,-121.847 -68.985,-163.21l0,-233.06l743.765,-1150.03c79.122,-114.228 94.806,-260.819 41.722,-389.143c0,-0 -221.472,-580.983 -294.052,-871.652l-603.352,0l-94.239,-0.005Zm323.188,921.357c0,140.409 -104.731,256.078 -240.177,273.7l0,1386.96c-11.868,-1.795 -23.809,-3.093 -36.036,-3.093c-12.375,-0 -24.243,1.224 -36.037,3.093l-0,-1386.97c-135.593,-17.623 -240.251,-133.218 -240.251,-273.627c0,-152.635 123.652,-276.287 276.288,-276.287c152.635,0 276.282,123.656 276.213,276.223Z"/></svg>`;
|
|
5434
|
+
function resolveTopbarItems(site, basePath) {
|
|
5435
|
+
return (site.topbarNav ?? []).map((item) => {
|
|
1748
5436
|
const external = item.external === true || /^https?:\/\//i.test(item.href);
|
|
1749
|
-
const
|
|
5437
|
+
const icon = item.icon && item.icon in ICONS ? item.icon : void 0;
|
|
5438
|
+
return {
|
|
5439
|
+
label: item.label,
|
|
5440
|
+
href: external ? item.href : siteUrl(item.href, basePath),
|
|
5441
|
+
external,
|
|
5442
|
+
icon
|
|
5443
|
+
};
|
|
5444
|
+
});
|
|
5445
|
+
}
|
|
5446
|
+
function renderTopbarLinks(items, docsHref, compact) {
|
|
5447
|
+
const links = items.map(({ label, href, external, icon }) => {
|
|
1750
5448
|
const rel = external ? ' rel="noopener" target="_blank"' : "";
|
|
1751
|
-
|
|
1752
|
-
|
|
5449
|
+
if (icon && compact) {
|
|
5450
|
+
return `<a class="ov-topbar-link ov-topbar-link--icon" href="${escapeAttr2(href)}"${rel} aria-label="${escapeAttr2(label)}" title="${escapeAttr2(label)}">${renderIcon(icon, { class: "ov-topbar-glyph", size: 18 })}<span class="ov-sr-only">${escapeHtml(label)}</span></a>`;
|
|
5451
|
+
}
|
|
5452
|
+
const glyph = icon ? `${renderIcon(icon, { class: "ov-topbar-glyph", size: 18 })}` : "";
|
|
5453
|
+
const ext = external && !icon ? ` ${renderIcon("external-link", { class: "ov-topbar-icon", size: 14 })}` : "";
|
|
5454
|
+
return `<a class="ov-topbar-link" href="${escapeAttr2(href)}"${rel}>${glyph}${escapeHtml(label)}${ext}</a>`;
|
|
1753
5455
|
});
|
|
1754
|
-
if (docsHref) {
|
|
1755
|
-
|
|
5456
|
+
if (docsHref && !items.some((it) => it.href === docsHref)) {
|
|
5457
|
+
links.push(
|
|
1756
5458
|
`<a class="ov-topbar-link ov-topbar-link--docs" href="${escapeAttr2(docsHref)}">Docs</a>`
|
|
1757
5459
|
);
|
|
1758
5460
|
}
|
|
1759
|
-
|
|
5461
|
+
return links.join("\n ");
|
|
5462
|
+
}
|
|
5463
|
+
function renderTopbar(site, assets, docsHref, searchEnabled, basePath) {
|
|
5464
|
+
const items = resolveTopbarItems(site, basePath);
|
|
5465
|
+
const desktopLinks = renderTopbarLinks(items, docsHref, true);
|
|
5466
|
+
const mobileLinks = renderTopbarLinks(items, docsHref, false);
|
|
1760
5467
|
const search = searchEnabled ? `<div id="ov-search" class="ov-search"></div>` : "";
|
|
1761
5468
|
const menuButton = `<button class="ov-topbar-menu" type="button"
|
|
1762
5469
|
aria-label="Open menu" aria-expanded="false" aria-controls="ov-mobile-nav"
|
|
@@ -1770,22 +5477,46 @@ function renderTopbar(site, assets, docsHref, searchEnabled, basePath) {
|
|
|
1770
5477
|
<span class="ov-theme-icon ov-theme-icon-light">${renderIcon("sun")}</span>
|
|
1771
5478
|
<span class="ov-theme-icon ov-theme-icon-dark">${renderIcon("moon")}</span>
|
|
1772
5479
|
</button>`;
|
|
5480
|
+
const versionBadge = site.version ? `<span class="ov-brand-version" aria-label="Stable version ${escapeAttr2(site.version)}">${escapeHtml(site.version)}</span>` : "";
|
|
1773
5481
|
return `<header class="ov-topbar">
|
|
1774
|
-
<
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
5482
|
+
<div class="ov-topbar-inner">
|
|
5483
|
+
<div class="ov-brand-row">
|
|
5484
|
+
<a class="ov-brand" href="${escapeAttr2(assets)}">${BRAND_MARK}<span class="ov-brand-name">${escapeHtml(site.title)}</span></a>
|
|
5485
|
+
${versionBadge}
|
|
5486
|
+
</div>
|
|
5487
|
+
<div class="ov-topbar-search">${search}</div>
|
|
5488
|
+
<div class="ov-topbar-right">
|
|
5489
|
+
<nav class="ov-topbar-nav" aria-label="Primary">${desktopLinks}</nav>
|
|
5490
|
+
${themeButton}
|
|
5491
|
+
${menuButton}
|
|
5492
|
+
</div>
|
|
5493
|
+
<nav id="ov-mobile-nav" class="ov-mobile-nav" aria-label="Mobile">
|
|
5494
|
+
${mobileLinks}
|
|
5495
|
+
<div class="ov-mobile-theme">
|
|
5496
|
+
<span class="ov-mobile-theme-label">Theme</span>
|
|
5497
|
+
${themeButton}
|
|
5498
|
+
</div>
|
|
5499
|
+
</nav>
|
|
1780
5500
|
</div>
|
|
1781
|
-
<nav id="ov-mobile-nav" class="ov-mobile-nav" aria-label="Mobile">
|
|
1782
|
-
${navLinks}
|
|
1783
|
-
</nav>
|
|
1784
5501
|
</header>`;
|
|
1785
5502
|
}
|
|
1786
|
-
function renderFooter(site, generatedAt) {
|
|
1787
|
-
|
|
1788
|
-
|
|
5503
|
+
function renderFooter(site, generatedAt, basePath) {
|
|
5504
|
+
const items = site.footerNav ?? [];
|
|
5505
|
+
const hasItems = items.length > 0;
|
|
5506
|
+
if (!site.footer && !hasItems) return "";
|
|
5507
|
+
const left = site.footer ? `<div class="ov-footer-left"><span>${escapeHtml(site.footer)}</span><span class="ov-footer-sep">\xB7</span><time datetime="${escapeAttr2(generatedAt)}">${escapeHtml(generatedAt.slice(0, 10))}</time></div>` : '<div class="ov-footer-left"></div>';
|
|
5508
|
+
const right = hasItems ? `<nav class="ov-footer-right" aria-label="Site links">${items.map((item) => renderFooterNavItem(item, basePath)).join("")}</nav>` : "";
|
|
5509
|
+
return `<footer class="ov-footer"><div class="ov-footer-inner">${left}${right}</div></footer>`;
|
|
5510
|
+
}
|
|
5511
|
+
function renderFooterNavItem(item, basePath) {
|
|
5512
|
+
const external = item.external === true || /^https?:\/\//i.test(item.href);
|
|
5513
|
+
const href = external ? item.href : siteUrl(item.href, basePath);
|
|
5514
|
+
const rel = external ? ' rel="noopener" target="_blank"' : "";
|
|
5515
|
+
const iconName = item.icon;
|
|
5516
|
+
if (iconName && iconName in ICONS) {
|
|
5517
|
+
return `<a class="ov-footer-link ov-footer-link--icon" href="${escapeAttr2(href)}"${rel} aria-label="${escapeAttr2(item.label)}" title="${escapeAttr2(item.label)}">${renderIcon(iconName, { class: "ov-footer-icon", size: 18 })}<span class="ov-sr-only">${escapeHtml(item.label)}</span></a>`;
|
|
5518
|
+
}
|
|
5519
|
+
return `<a class="ov-footer-link" href="${escapeAttr2(href)}"${rel}>${escapeHtml(item.label)}</a>`;
|
|
1789
5520
|
}
|
|
1790
5521
|
function renderPage(input2) {
|
|
1791
5522
|
const fullTitle = input2.title && input2.title !== input2.site.title ? `${input2.title} \xB7 ${input2.site.title}` : input2.site.title;
|
|
@@ -1827,16 +5558,26 @@ function renderLanding(input2) {
|
|
|
1827
5558
|
heroTitle,
|
|
1828
5559
|
input2.landing.hero.subtitle,
|
|
1829
5560
|
input2.landing.hero.ctas,
|
|
5561
|
+
input2.landing.hero.media,
|
|
1830
5562
|
basePath
|
|
1831
5563
|
);
|
|
1832
5564
|
const features = renderFeatures(input2.landing.features);
|
|
1833
5565
|
const pitch = input2.pitchHtml ? `<section class="ov-pitch"><div class="ov-pitch-inner">${input2.pitchHtml}</div></section>` : "";
|
|
1834
5566
|
const trust = renderTrustStrip(input2.landing.trustStrip);
|
|
5567
|
+
const sections = [hero, features, pitch, trust].filter((s) => s !== "");
|
|
5568
|
+
const scenes = input2.landing.scenes ?? [];
|
|
5569
|
+
const interleaved = [];
|
|
5570
|
+
sections.forEach((section, i) => {
|
|
5571
|
+
interleaved.push(section);
|
|
5572
|
+
if (i < sections.length - 1 && scenes[i]) {
|
|
5573
|
+
interleaved.push(renderScene(scenes[i], i, basePath));
|
|
5574
|
+
}
|
|
5575
|
+
});
|
|
5576
|
+
scenes.slice(Math.max(0, sections.length - 1)).forEach((sc, j) => {
|
|
5577
|
+
interleaved.push(renderScene(sc, sections.length - 1 + j, basePath));
|
|
5578
|
+
});
|
|
1835
5579
|
const body = `<main class="ov-landing">
|
|
1836
|
-
${
|
|
1837
|
-
${features}
|
|
1838
|
-
${pitch}
|
|
1839
|
-
${trust}
|
|
5580
|
+
${interleaved.join("\n ")}
|
|
1840
5581
|
</main>`;
|
|
1841
5582
|
return renderShell({
|
|
1842
5583
|
site: input2.site,
|
|
@@ -1850,7 +5591,7 @@ function renderLanding(input2) {
|
|
|
1850
5591
|
bodyClass: "ov-body-landing"
|
|
1851
5592
|
});
|
|
1852
5593
|
}
|
|
1853
|
-
function renderHero(title, subtitle, ctas, basePath) {
|
|
5594
|
+
function renderHero(title, subtitle, ctas, media, basePath) {
|
|
1854
5595
|
const ctaButtons = ctas.map((cta, i) => {
|
|
1855
5596
|
const style = cta.style ?? (i === 0 ? "primary" : "secondary");
|
|
1856
5597
|
return `<a class="ov-cta ov-cta--${escapeAttr2(style)}" href="${escapeAttr2(siteUrl(cta.href, basePath))}">${escapeHtml(cta.label)}</a>`;
|
|
@@ -1858,17 +5599,42 @@ function renderHero(title, subtitle, ctas, basePath) {
|
|
|
1858
5599
|
const ctaRow = ctas.length > 0 ? `<div class="ov-cta-row">
|
|
1859
5600
|
${ctaButtons}
|
|
1860
5601
|
</div>` : "";
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
${
|
|
5602
|
+
const art = media ? renderHeroArt(media, basePath) : "";
|
|
5603
|
+
const sectionAttrs = media ? " data-media" : "";
|
|
5604
|
+
return `<section class="ov-hero"${sectionAttrs}>
|
|
5605
|
+
${art}
|
|
5606
|
+
<div class="ov-hero-inner">
|
|
5607
|
+
<h1 class="ov-hero-title">${escapeHtml(title)}</h1>
|
|
5608
|
+
${subtitle ? `<p class="ov-hero-subtitle">${escapeHtml(subtitle)}</p>` : ""}
|
|
5609
|
+
${ctaRow}
|
|
5610
|
+
</div>
|
|
1865
5611
|
</section>`;
|
|
1866
5612
|
}
|
|
5613
|
+
function renderHeroArt(media, basePath) {
|
|
5614
|
+
const alt = media.alt ?? "";
|
|
5615
|
+
const lightSrc = escapeAttr2(siteUrl(media.light, basePath));
|
|
5616
|
+
const darkSrc = media.dark ? escapeAttr2(siteUrl(media.dark, basePath)) : lightSrc;
|
|
5617
|
+
return `<div class="ov-hero-art" aria-hidden="${alt ? "false" : "true"}">
|
|
5618
|
+
<img class="ov-hero-art-img ov-hero-art-img--light" src="${lightSrc}" alt="${escapeAttr2(alt)}" loading="eager" decoding="async">
|
|
5619
|
+
<img class="ov-hero-art-img ov-hero-art-img--dark" src="${darkSrc}" alt="" loading="eager" decoding="async">
|
|
5620
|
+
</div>`;
|
|
5621
|
+
}
|
|
5622
|
+
function renderScene(scene, index, basePath) {
|
|
5623
|
+
const alt = scene.alt ?? "";
|
|
5624
|
+
const lightSrc = escapeAttr2(siteUrl(scene.light, basePath));
|
|
5625
|
+
const darkSrc = scene.dark ? escapeAttr2(siteUrl(scene.dark, basePath)) : lightSrc;
|
|
5626
|
+
return `<section class="ov-scene" aria-hidden="${alt ? "false" : "true"}" style="--ov-scene-i: ${index};">
|
|
5627
|
+
<figure class="ov-scene-art">
|
|
5628
|
+
<img class="ov-scene-img ov-scene-img--light" src="${lightSrc}" alt="${escapeAttr2(alt)}" loading="lazy" decoding="async">
|
|
5629
|
+
<img class="ov-scene-img ov-scene-img--dark" src="${darkSrc}" alt="" loading="lazy" decoding="async">
|
|
5630
|
+
</figure>
|
|
5631
|
+
</section>`;
|
|
5632
|
+
}
|
|
1867
5633
|
function renderFeatures(features) {
|
|
1868
5634
|
if (features.length === 0) return "";
|
|
1869
5635
|
const cards = features.map((f) => {
|
|
1870
5636
|
const icon = f.icon ? `<div class="ov-feature-icon" aria-hidden="true">${f.icon}</div>` : "";
|
|
1871
|
-
return `<article class="ov-feature-card">
|
|
5637
|
+
return `<article class="ov-card ov-feature-card">
|
|
1872
5638
|
${icon}
|
|
1873
5639
|
<h3 class="ov-feature-title">${escapeHtml(f.title)}</h3>
|
|
1874
5640
|
<p class="ov-feature-description">${escapeHtml(f.description)}</p>
|
|
@@ -1898,23 +5664,23 @@ function renderSidebar(nav, activeUrl, basePath) {
|
|
|
1898
5664
|
}
|
|
1899
5665
|
function navList(nodes, activeUrl, basePath) {
|
|
1900
5666
|
if (nodes.length === 0) return "";
|
|
1901
|
-
return nodes.map((
|
|
1902
|
-
const isActive =
|
|
1903
|
-
const hasChildren =
|
|
1904
|
-
const
|
|
1905
|
-
const children = hasChildren ? `<ul class="ov-nav-children">${navList(
|
|
1906
|
-
return `<li>${
|
|
5667
|
+
return nodes.map((node2) => {
|
|
5668
|
+
const isActive = node2.url === activeUrl;
|
|
5669
|
+
const hasChildren = node2.children.length > 0;
|
|
5670
|
+
const link2 = node2.sourcePath ? `<a class="ov-nav-link${isActive ? " is-active" : ""}" href="${escapeAttr2(siteUrl(node2.url, basePath))}">${escapeHtml(node2.title)}</a>` : `<span class="ov-nav-group">${escapeHtml(node2.title)}</span>`;
|
|
5671
|
+
const children = hasChildren ? `<ul class="ov-nav-children">${navList(node2.children, activeUrl, basePath)}</ul>` : "";
|
|
5672
|
+
return `<li>${link2}${children}</li>`;
|
|
1907
5673
|
}).join("");
|
|
1908
5674
|
}
|
|
1909
|
-
function renderBreadcrumbs(
|
|
1910
|
-
if (!
|
|
1911
|
-
const visible =
|
|
1912
|
-
const items = visible.map((
|
|
5675
|
+
function renderBreadcrumbs(trail2, basePath) {
|
|
5676
|
+
if (!trail2 || trail2.length < 3) return "";
|
|
5677
|
+
const visible = trail2.slice(1);
|
|
5678
|
+
const items = visible.map((node2, i) => {
|
|
1913
5679
|
const isLast = i === visible.length - 1;
|
|
1914
5680
|
if (isLast) {
|
|
1915
|
-
return `<li class="ov-crumb is-current" aria-current="page">${escapeHtml(
|
|
5681
|
+
return `<li class="ov-crumb is-current" aria-current="page">${escapeHtml(node2.title)}</li>`;
|
|
1916
5682
|
}
|
|
1917
|
-
return `<li class="ov-crumb"><a href="${escapeAttr2(siteUrl(
|
|
5683
|
+
return `<li class="ov-crumb"><a href="${escapeAttr2(siteUrl(node2.url, basePath))}">${escapeHtml(node2.title)}</a></li>`;
|
|
1918
5684
|
}).join("\n ");
|
|
1919
5685
|
return `<nav class="ov-breadcrumbs" aria-label="Breadcrumb">
|
|
1920
5686
|
<ol>
|
|
@@ -1992,14 +5758,14 @@ async function buildSite(options) {
|
|
|
1992
5758
|
let landingRendered = false;
|
|
1993
5759
|
if (landingEnabled) {
|
|
1994
5760
|
const landingBody = await readLandingBody(inputAbs, site);
|
|
1995
|
-
const
|
|
5761
|
+
const html2 = renderLanding({
|
|
1996
5762
|
site,
|
|
1997
5763
|
landing: site.landing,
|
|
1998
5764
|
pitchHtml: landingBody?.html,
|
|
1999
5765
|
generatedAt: now.toISOString(),
|
|
2000
5766
|
docsHref
|
|
2001
5767
|
});
|
|
2002
|
-
await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "index.html"),
|
|
5768
|
+
await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "index.html"), html2, "utf8");
|
|
2003
5769
|
pages.push({
|
|
2004
5770
|
sourcePath: landingBody?.sourcePath ?? "(landing config)",
|
|
2005
5771
|
outputPath: import_path5.default.relative(cwd, import_path5.default.join(outputAbs, "index.html")).replace(/\\/g, "/"),
|
|
@@ -2026,7 +5792,9 @@ async function buildSite(options) {
|
|
|
2026
5792
|
absInput: file,
|
|
2027
5793
|
url,
|
|
2028
5794
|
site,
|
|
2029
|
-
|
|
5795
|
+
// Sidebar renders the section subtree; prev/next + breadcrumbs above
|
|
5796
|
+
// still use the full nav so reading order spans the whole site.
|
|
5797
|
+
nav: sidebarRootFor(nav),
|
|
2030
5798
|
cwd,
|
|
2031
5799
|
generatedAt: now.toISOString(),
|
|
2032
5800
|
docsHref,
|
|
@@ -2041,7 +5809,9 @@ async function buildSite(options) {
|
|
|
2041
5809
|
sourcePath: import_path5.default.relative(cwd, file).replace(/\\/g, "/"),
|
|
2042
5810
|
outputPath: import_path5.default.relative(cwd, outputPath).replace(/\\/g, "/"),
|
|
2043
5811
|
url,
|
|
2044
|
-
title: result.title
|
|
5812
|
+
title: result.title,
|
|
5813
|
+
description: result.description,
|
|
5814
|
+
lastModified: result.lastModified
|
|
2045
5815
|
});
|
|
2046
5816
|
warnings.push(...result.warnings);
|
|
2047
5817
|
} else {
|
|
@@ -2058,9 +5828,19 @@ async function buildSite(options) {
|
|
|
2058
5828
|
if (site.baseUrl) {
|
|
2059
5829
|
const xml = generateSitemap({ pages, baseUrl: site.baseUrl, basePath: site.basePath });
|
|
2060
5830
|
if (xml) await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "sitemap.xml"), xml, "utf8");
|
|
5831
|
+
const rss = generateRss({
|
|
5832
|
+
pages,
|
|
5833
|
+
baseUrl: site.baseUrl,
|
|
5834
|
+
basePath: site.basePath,
|
|
5835
|
+
title: site.title,
|
|
5836
|
+
description: site.description,
|
|
5837
|
+
exclude: ["/404/", "/"],
|
|
5838
|
+
generatedAt: now
|
|
5839
|
+
});
|
|
5840
|
+
if (rss) await (0, import_promises3.writeFile)(import_path5.default.join(outputAbs, "feed.xml"), rss, "utf8");
|
|
2061
5841
|
} else {
|
|
2062
5842
|
warnings.push(
|
|
2063
|
-
"sitemap.xml not generated: set `site.baseUrl` in your config to enable
|
|
5843
|
+
"sitemap.xml and feed.xml not generated: set `site.baseUrl` in your config to enable them."
|
|
2064
5844
|
);
|
|
2065
5845
|
}
|
|
2066
5846
|
if (site.search.enabled) {
|
|
@@ -2089,7 +5869,7 @@ async function renderOne(input2) {
|
|
|
2089
5869
|
const pageMetaCfg = input2.site.pageMeta;
|
|
2090
5870
|
const readingMin = pageMetaCfg.readingTime ? readingMinutes(countWords(parsed.content)) : void 0;
|
|
2091
5871
|
const lastModified = pageMetaCfg.lastModified ? await lastModifiedISO({ absPath: input2.absInput, cwd: input2.cwd }) : void 0;
|
|
2092
|
-
const
|
|
5872
|
+
const html2 = renderPage({
|
|
2093
5873
|
site: input2.site,
|
|
2094
5874
|
nav: input2.nav,
|
|
2095
5875
|
url: input2.url,
|
|
@@ -2107,7 +5887,13 @@ async function renderOne(input2) {
|
|
|
2107
5887
|
lastModified,
|
|
2108
5888
|
bodyClass: input2.url === "/404/" ? "ov-body-404" : void 0
|
|
2109
5889
|
});
|
|
2110
|
-
return {
|
|
5890
|
+
return {
|
|
5891
|
+
html: html2,
|
|
5892
|
+
title,
|
|
5893
|
+
description: frontmatter.description,
|
|
5894
|
+
lastModified,
|
|
5895
|
+
warnings: []
|
|
5896
|
+
};
|
|
2111
5897
|
}
|
|
2112
5898
|
async function readLandingBody(inputAbs, site) {
|
|
2113
5899
|
const abs = import_path5.default.join(inputAbs, LANDING_BODY_FILE);
|
|
@@ -2115,13 +5901,30 @@ async function readLandingBody(inputAbs, site) {
|
|
|
2115
5901
|
const raw = await (0, import_promises3.readFile)(abs, "utf8");
|
|
2116
5902
|
const { content } = (0, import_gray_matter2.default)(raw);
|
|
2117
5903
|
if (!content.trim()) return void 0;
|
|
2118
|
-
const { html } = await renderMarkdown(content, { codeTheme: site.codeTheme });
|
|
2119
|
-
return { html, sourcePath: import_path5.default.join(import_path5.default.basename(inputAbs), LANDING_BODY_FILE) };
|
|
5904
|
+
const { html: html2 } = await renderMarkdown(content, { codeTheme: site.codeTheme });
|
|
5905
|
+
return { html: html2, sourcePath: import_path5.default.join(import_path5.default.basename(inputAbs), LANDING_BODY_FILE) };
|
|
2120
5906
|
}
|
|
2121
5907
|
function firstNavUrl(nav) {
|
|
2122
5908
|
const first = nav.children.find((c) => c.sourcePath !== void 0);
|
|
2123
5909
|
return first?.url;
|
|
2124
5910
|
}
|
|
5911
|
+
function sidebarRootFor(nav) {
|
|
5912
|
+
const groups = nav.children.filter((c) => c.children.length > 0);
|
|
5913
|
+
const looseRootPages = nav.children.filter(
|
|
5914
|
+
(c) => c.sourcePath !== void 0 && c.children.length === 0 && c.url !== "/404/"
|
|
5915
|
+
);
|
|
5916
|
+
if (groups.length !== 1 || looseRootPages.length > 0) return nav;
|
|
5917
|
+
const section = groups[0];
|
|
5918
|
+
const lead = section.sourcePath ? [
|
|
5919
|
+
{
|
|
5920
|
+
title: section.title,
|
|
5921
|
+
url: section.url,
|
|
5922
|
+
sourcePath: section.sourcePath,
|
|
5923
|
+
children: []
|
|
5924
|
+
}
|
|
5925
|
+
] : [];
|
|
5926
|
+
return { ...section, children: [...lead, ...section.children] };
|
|
5927
|
+
}
|
|
2125
5928
|
function resolveSiteConfig(config) {
|
|
2126
5929
|
const title = config.site.title ?? config.name ?? "Ovellum site";
|
|
2127
5930
|
return { ...config.site, title };
|
|
@@ -2179,11 +5982,11 @@ function resolveTemplateDir() {
|
|
|
2179
5982
|
function extractMarkdownLinks(content) {
|
|
2180
5983
|
const tree = (0, import_unified2.unified)().use(import_remark_parse2.default).parse(content);
|
|
2181
5984
|
const out = [];
|
|
2182
|
-
(0,
|
|
2183
|
-
if (typeof
|
|
5985
|
+
(0, import_unist_util_visit3.visit)(tree, "link", (node2) => {
|
|
5986
|
+
if (typeof node2.url !== "string") return;
|
|
2184
5987
|
out.push({
|
|
2185
|
-
target:
|
|
2186
|
-
line:
|
|
5988
|
+
target: node2.url,
|
|
5989
|
+
line: node2.position?.start.line ?? 1
|
|
2187
5990
|
});
|
|
2188
5991
|
});
|
|
2189
5992
|
return out;
|
|
@@ -2213,6 +6016,7 @@ async function runBuild(input2) {
|
|
|
2213
6016
|
let finalBody = generatedBody;
|
|
2214
6017
|
if (config.mode === "hybrid" && (0, import_node_fs.existsSync)(abs)) {
|
|
2215
6018
|
const manualDoc = await readManualDoc(abs);
|
|
6019
|
+
warnings.push(...manualDoc.warnings);
|
|
2216
6020
|
if (manualDoc.protectedBlocks.length > 0) {
|
|
2217
6021
|
const result = merge(generatedBody, manualDoc, { sourceFile: relOut });
|
|
2218
6022
|
finalBody = result.content;
|
|
@@ -2716,10 +6520,10 @@ async function serve404(opts, res) {
|
|
|
2716
6520
|
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
|
2717
6521
|
res.end("Not Found");
|
|
2718
6522
|
}
|
|
2719
|
-
function injectReloadScript(
|
|
6523
|
+
function injectReloadScript(html2) {
|
|
2720
6524
|
const tag = `<script src="${RELOAD_SCRIPT_PATH}" defer></script>`;
|
|
2721
|
-
if (/<\/body>/i.test(
|
|
2722
|
-
return
|
|
6525
|
+
if (/<\/body>/i.test(html2)) return html2.replace(/<\/body>/i, `${tag}$&`);
|
|
6526
|
+
return html2 + tag;
|
|
2723
6527
|
}
|
|
2724
6528
|
async function findFreePort(host, start, range) {
|
|
2725
6529
|
for (let p = start; p < start + range; p++) {
|
|
@@ -3131,11 +6935,11 @@ ${a.description || `Welcome to **${a.title}**. This file is \`${a.input}/index.m
|
|
|
3131
6935
|
async function ensureGitignore(cwd, a) {
|
|
3132
6936
|
const gi = import_node_path7.default.join(cwd, ".gitignore");
|
|
3133
6937
|
const want = a.mode === "auto" ? [a.output, ".orphans/"] : [a.output, ".orphans/"];
|
|
3134
|
-
const wantNorm = want.map((p) =>
|
|
6938
|
+
const wantNorm = want.map((p) => stripTrailingSlash3(p));
|
|
3135
6939
|
let current = "";
|
|
3136
6940
|
if ((0, import_node_fs4.existsSync)(gi)) current = await (0, import_promises9.readFile)(gi, "utf8");
|
|
3137
6941
|
const have = new Set(
|
|
3138
|
-
current.split(/\r?\n/).map((l) =>
|
|
6942
|
+
current.split(/\r?\n/).map((l) => stripTrailingSlash3(l.trim())).filter(Boolean)
|
|
3139
6943
|
);
|
|
3140
6944
|
const missing = wantNorm.filter((p) => !have.has(p));
|
|
3141
6945
|
if (missing.length === 0) return false;
|
|
@@ -3164,7 +6968,7 @@ function nextSteps(a) {
|
|
|
3164
6968
|
function titleFromName(name) {
|
|
3165
6969
|
return name.split(/[-_./@\s]/).filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
3166
6970
|
}
|
|
3167
|
-
function
|
|
6971
|
+
function stripTrailingSlash3(s) {
|
|
3168
6972
|
return s.endsWith("/") ? s.slice(0, -1) : s;
|
|
3169
6973
|
}
|
|
3170
6974
|
|