@markdoc/markdoc 0.5.13 → 0.5.14

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.
Files changed (86) hide show
  1. package/README.md +11 -0
  2. package/dist/index.d.ts +4 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +467 -462
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.mjs +467 -462
  7. package/dist/index.mjs.map +4 -4
  8. package/dist/react.js +1 -1
  9. package/dist/react.js.map +2 -2
  10. package/dist/src/ast/base.d.ts +1 -1
  11. package/dist/src/ast/base.d.ts.map +1 -1
  12. package/dist/src/ast/function.d.ts +1 -1
  13. package/dist/src/ast/function.d.ts.map +1 -1
  14. package/dist/src/ast/index.d.ts +2 -2
  15. package/dist/src/ast/index.d.ts.map +1 -1
  16. package/dist/src/ast/node.d.ts.map +1 -1
  17. package/dist/src/ast/variable.d.ts +1 -1
  18. package/dist/src/ast/variable.d.ts.map +1 -1
  19. package/dist/src/formatter.d.ts.map +1 -1
  20. package/dist/src/functions/index.d.ts.map +1 -1
  21. package/dist/src/parser.d.ts.map +1 -1
  22. package/dist/src/renderers/html.d.ts.map +1 -1
  23. package/dist/src/renderers/react/react.d.ts +2 -2
  24. package/dist/src/renderers/react/react.d.ts.map +1 -1
  25. package/dist/src/renderers/react/static.d.ts +1 -1
  26. package/dist/src/renderers/react/static.d.ts.map +1 -1
  27. package/dist/src/schema-types/class.d.ts +1 -1
  28. package/dist/src/schema-types/class.d.ts.map +1 -1
  29. package/dist/src/schema-types/conditional.d.ts +1 -1
  30. package/dist/src/schema-types/conditional.d.ts.map +1 -1
  31. package/dist/src/schema.d.ts.map +1 -1
  32. package/dist/src/tags/conditional.d.ts +1 -1
  33. package/dist/src/tags/conditional.d.ts.map +1 -1
  34. package/dist/src/tokenizer/index.d.ts.map +1 -1
  35. package/dist/src/tokenizer/plugins/annotations.d.ts.map +1 -1
  36. package/dist/src/transformer.d.ts.map +1 -1
  37. package/dist/src/validator.d.ts +1 -1
  38. package/dist/src/validator.d.ts.map +1 -1
  39. package/index.ts +21 -22
  40. package/package.json +7 -13
  41. package/spec/support/matchers.d.ts +6 -4
  42. package/src/ast/base.ts +2 -2
  43. package/src/ast/function.ts +1 -1
  44. package/src/ast/index.ts +3 -4
  45. package/src/ast/node.test.ts +60 -46
  46. package/src/ast/node.ts +3 -3
  47. package/src/ast/variable.test.ts +5 -4
  48. package/src/ast/variable.ts +1 -1
  49. package/src/formatter.test.ts +4 -3
  50. package/src/formatter.ts +11 -11
  51. package/src/functions/index.test.ts +8 -7
  52. package/src/functions/index.ts +1 -1
  53. package/src/grammar/tag.d.ts +1 -1
  54. package/src/grammar/tag.js +208 -285
  55. package/src/grammar/tag.pegjs +4 -4
  56. package/src/grammar/tag.test.ts +56 -52
  57. package/src/parser.test.ts +93 -70
  58. package/src/parser.ts +19 -6
  59. package/src/renderers/html.test.ts +56 -16
  60. package/src/renderers/html.ts +10 -2
  61. package/src/renderers/react/react.test.ts +29 -28
  62. package/src/renderers/react/react.ts +7 -8
  63. package/src/renderers/react/static.ts +5 -6
  64. package/src/schema-types/class.ts +1 -1
  65. package/src/schema-types/conditional.ts +1 -1
  66. package/src/schema.ts +9 -4
  67. package/src/tag.test.ts +2 -1
  68. package/src/tag.ts +1 -1
  69. package/src/tags/conditional.ts +4 -4
  70. package/src/tags/index.ts +2 -2
  71. package/src/tags/partial.ts +1 -1
  72. package/src/tokenizer/index.ts +6 -5
  73. package/src/tokenizer/plugins/annotations.test.ts +29 -28
  74. package/src/tokenizer/plugins/annotations.ts +12 -12
  75. package/src/tokenizer/plugins/comments.test.ts +11 -10
  76. package/src/tokenizer/plugins/comments.ts +2 -2
  77. package/src/tokenizer/plugins/frontmatter.test.ts +7 -6
  78. package/src/tokenizer/plugins/frontmatter.ts +2 -2
  79. package/src/tokenizer/plugins/link.test.ts +14 -13
  80. package/src/transformer.ts +7 -5
  81. package/src/transforms/table.test.ts +18 -17
  82. package/src/transforms/table.ts +1 -1
  83. package/src/utils.test.ts +23 -22
  84. package/src/utils.ts +3 -3
  85. package/src/validator.test.ts +60 -59
  86. package/src/validator.ts +13 -11
package/dist/index.mjs CHANGED
@@ -188,11 +188,7 @@ var require_tag = __commonJS({
188
188
  var peg$f3 = function(tag, primary, attributes, close) {
189
189
  if (primary) {
190
190
  attributes = attributes || [];
191
- attributes.unshift({
192
- type: "attribute",
193
- name: "primary",
194
- value: primary
195
- });
191
+ attributes.unshift({ type: "attribute", name: "primary", value: primary });
196
192
  }
197
193
  const [type, nesting] = close ? ["tag", 0] : ["tag_open", 1];
198
194
  return { type, nesting, meta: { tag, attributes } };
@@ -243,7 +239,8 @@ var require_tag = __commonJS({
243
239
  return value;
244
240
  };
245
241
  var peg$f18 = function(prefix, head, tail) {
246
- if (prefix === "@") return [head, ...tail];
242
+ if (prefix === "@")
243
+ return [head, ...tail];
247
244
  return new Variable2([head, ...tail]);
248
245
  };
249
246
  var peg$f19 = function() {
@@ -296,9 +293,7 @@ var require_tag = __commonJS({
296
293
  var peg$result;
297
294
  if ("startRule" in options) {
298
295
  if (!(options.startRule in peg$startRuleFunctions)) {
299
- throw new Error(
300
- `Can't start parsing from rule "` + options.startRule + '".'
301
- );
296
+ throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
302
297
  }
303
298
  peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
304
299
  }
@@ -330,12 +325,7 @@ var require_tag = __commonJS({
330
325
  return { type: "literal", text: text4, ignoreCase };
331
326
  }
332
327
  function peg$classExpectation(parts, inverted, ignoreCase) {
333
- return {
334
- type: "class",
335
- parts,
336
- inverted,
337
- ignoreCase
338
- };
328
+ return { type: "class", parts, inverted, ignoreCase };
339
329
  }
340
330
  function peg$anyExpectation() {
341
331
  return { type: "any" };
@@ -1755,21 +1745,6 @@ function resolve(value, config2 = {}) {
1755
1745
  return output;
1756
1746
  }
1757
1747
 
1758
- // src/tag.ts
1759
- var Tag = class {
1760
- constructor(name = "div", attributes = {}, children = []) {
1761
- this.$$mdtype = "Tag";
1762
- this.name = name;
1763
- this.attributes = attributes;
1764
- this.children = children;
1765
- }
1766
- static {
1767
- this.isTag = (tag) => {
1768
- return !!(tag?.$$mdtype === "Tag");
1769
- };
1770
- }
1771
- };
1772
-
1773
1748
  // src/schema-types/class.ts
1774
1749
  var Class = class {
1775
1750
  validate(value, _config, key) {
@@ -1804,6 +1779,21 @@ var Id = class {
1804
1779
  }
1805
1780
  };
1806
1781
 
1782
+ // src/tag.ts
1783
+ var Tag = class {
1784
+ constructor(name = "div", attributes = {}, children = []) {
1785
+ this.$$mdtype = "Tag";
1786
+ this.name = name;
1787
+ this.attributes = attributes;
1788
+ this.children = children;
1789
+ }
1790
+ static {
1791
+ this.isTag = (tag) => {
1792
+ return !!(tag?.$$mdtype === "Tag");
1793
+ };
1794
+ }
1795
+ };
1796
+
1807
1797
  // src/utils.ts
1808
1798
  var import_tag = __toESM(require_tag());
1809
1799
  var OPEN = "{%";
@@ -1977,7 +1967,7 @@ var transformer_default = {
1977
1967
  if (schema && schema.transform instanceof Function)
1978
1968
  return schema.transform(node2, config2);
1979
1969
  const children = this.children(node2, config2);
1980
- if (!schema || !schema.render) return children;
1970
+ if (!schema?.render) return children;
1981
1971
  const attributes = this.attributes(node2, config2);
1982
1972
  if (isPromise(attributes) || isPromise(children)) {
1983
1973
  return Promise.all([attributes, children]).then(
@@ -2152,14 +2142,14 @@ function* trimStart(g) {
2152
2142
  yield* g;
2153
2143
  }
2154
2144
  function* escapeMarkdownCharacters(s2, characters) {
2155
- yield s2.replace(characters, "\\$&").replace(new RegExp("\xA0", "g"), " ");
2145
+ yield s2.replace(characters, "\\$&").replace(/\xa0/g, " ");
2156
2146
  }
2157
2147
  function* formatNode(n, o = {}) {
2158
2148
  const no = { ...o, parent: n };
2159
2149
  const indent = SPACE.repeat(no.indent || 0);
2160
2150
  switch (n.type) {
2161
2151
  case "document": {
2162
- if (n.attributes.frontmatter && n.attributes.frontmatter.length) {
2152
+ if (n.attributes.frontmatter?.length) {
2163
2153
  yield "---" + NL + n.attributes.frontmatter + NL + "---" + NL + NL;
2164
2154
  }
2165
2155
  yield* trimStart(formatChildren(n, no));
@@ -2390,7 +2380,7 @@ function* formatNode(n, o = {}) {
2390
2380
  head.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length))
2391
2381
  );
2392
2382
  yield NL;
2393
- yield* formatTableRow(head.map((cell, i) => "-".repeat(widths[i])));
2383
+ yield* formatTableRow(head.map((_cell, i) => "-".repeat(widths[i])));
2394
2384
  yield NL;
2395
2385
  for (const row of rows) {
2396
2386
  yield* formatTableRow(
@@ -2647,6 +2637,14 @@ function annotate(node2, attributes) {
2647
2637
  });
2648
2638
  continue;
2649
2639
  }
2640
+ if (node2.type === "heading" && name === "level" && !(Number.isInteger(value) && value >= 1 && value <= 6)) {
2641
+ node2.errors.push({
2642
+ id: "attribute-value-invalid",
2643
+ level: "error",
2644
+ message: `Invalid heading level: '${value}'`
2645
+ });
2646
+ continue;
2647
+ }
2650
2648
  if (Object.prototype.hasOwnProperty.call(node2.attributes, name))
2651
2649
  node2.errors.push({
2652
2650
  id: "duplicate-attribute",
@@ -2682,7 +2680,7 @@ function handleAttrs(token, type) {
2682
2680
  case "text":
2683
2681
  case "code":
2684
2682
  case "comment":
2685
- return { content: (token.meta || {}).variable || token.content };
2683
+ return { content: token.meta?.variable || token.content };
2686
2684
  case "fence": {
2687
2685
  const [language] = token.info.split(" ", 1);
2688
2686
  return language === "" || language === OPEN ? { content: token.content } : { content: token.content, language };
@@ -2803,358 +2801,104 @@ function parser(tokens, args) {
2803
2801
  return doc;
2804
2802
  }
2805
2803
 
2806
- // src/schema.ts
2807
- var schema_exports = {};
2808
- __export(schema_exports, {
2809
- blockquote: () => blockquote,
2810
- code: () => code,
2811
- comment: () => comment,
2812
- document: () => document,
2813
- em: () => em,
2814
- error: () => error,
2815
- fence: () => fence,
2816
- hardbreak: () => hardbreak,
2817
- heading: () => heading,
2818
- hr: () => hr,
2819
- image: () => image,
2820
- inline: () => inline,
2821
- item: () => item,
2822
- link: () => link,
2823
- list: () => list,
2824
- node: () => node,
2825
- paragraph: () => paragraph,
2826
- s: () => s,
2827
- softbreak: () => softbreak,
2828
- strong: () => strong,
2829
- table: () => table,
2830
- tbody: () => tbody,
2831
- td: () => td,
2832
- text: () => text,
2833
- th: () => th,
2834
- thead: () => thead,
2835
- tr: () => tr
2804
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
2805
+ var mdurl_exports = {};
2806
+ __export(mdurl_exports, {
2807
+ decode: () => decode_default,
2808
+ encode: () => encode_default,
2809
+ format: () => format2,
2810
+ parse: () => parse_default
2836
2811
  });
2837
- var document = {
2838
- render: "article",
2839
- children: [
2840
- "heading",
2841
- "paragraph",
2842
- "image",
2843
- "table",
2844
- "tag",
2845
- "fence",
2846
- "blockquote",
2847
- "comment",
2848
- "list",
2849
- "hr"
2850
- ],
2851
- attributes: {
2852
- frontmatter: { render: false }
2812
+
2813
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
2814
+ var decodeCache = {};
2815
+ function getDecodeCache(exclude) {
2816
+ let cache = decodeCache[exclude];
2817
+ if (cache) {
2818
+ return cache;
2853
2819
  }
2854
- };
2855
- var heading = {
2856
- children: ["inline"],
2857
- attributes: {
2858
- level: { type: Number, render: false, required: true }
2859
- },
2860
- transform(node2, config2) {
2861
- return new Tag(
2862
- `h${node2.attributes["level"]}`,
2863
- node2.transformAttributes(config2),
2864
- node2.transformChildren(config2)
2865
- );
2820
+ cache = decodeCache[exclude] = [];
2821
+ for (let i = 0; i < 128; i++) {
2822
+ const ch = String.fromCharCode(i);
2823
+ cache.push(ch);
2866
2824
  }
2867
- };
2868
- var paragraph = {
2869
- render: "p",
2870
- children: ["inline"]
2871
- };
2872
- var image = {
2873
- render: "img",
2874
- attributes: {
2875
- src: { type: String, required: true },
2876
- alt: { type: String },
2877
- title: { type: String }
2878
- // width/height attributes will need to be to be implemented as an extension to markdown-it
2825
+ for (let i = 0; i < exclude.length; i++) {
2826
+ const ch = exclude.charCodeAt(i);
2827
+ cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2);
2879
2828
  }
2880
- };
2881
- var fence = {
2882
- render: "pre",
2883
- attributes: {
2884
- content: { type: String, render: false, required: true },
2885
- language: { type: String, render: "data-language" },
2886
- process: { type: Boolean, render: false, default: true }
2887
- },
2888
- transform(node2, config2) {
2889
- const attributes = node2.transformAttributes(config2);
2890
- const children = node2.children.length ? node2.transformChildren(config2) : [node2.attributes.content];
2891
- return new Tag("pre", attributes, children);
2829
+ return cache;
2830
+ }
2831
+ function decode(string, exclude) {
2832
+ if (typeof exclude !== "string") {
2833
+ exclude = decode.defaultChars;
2892
2834
  }
2893
- };
2894
- var blockquote = {
2895
- render: "blockquote",
2896
- children: [
2897
- "heading",
2898
- "paragraph",
2899
- "image",
2900
- "table",
2901
- "tag",
2902
- "fence",
2903
- "blockquote",
2904
- "list",
2905
- "hr"
2906
- ]
2907
- };
2908
- var item = {
2909
- render: "li",
2910
- children: [
2911
- "inline",
2912
- "heading",
2913
- "paragraph",
2914
- "image",
2915
- "table",
2916
- "tag",
2917
- "fence",
2918
- "blockquote",
2919
- "list",
2920
- "hr"
2921
- ]
2922
- };
2923
- var list = {
2924
- children: ["item"],
2925
- attributes: {
2926
- ordered: { type: Boolean, render: false, required: true },
2927
- start: { type: Number },
2928
- marker: { type: String, render: false }
2929
- },
2930
- transform(node2, config2) {
2931
- return new Tag(
2932
- node2.attributes.ordered ? "ol" : "ul",
2933
- node2.transformAttributes(config2),
2934
- node2.transformChildren(config2)
2935
- );
2936
- }
2937
- };
2938
- var hr = {
2939
- render: "hr"
2940
- };
2941
- var table = {
2942
- render: "table"
2943
- };
2944
- var td = {
2945
- render: "td",
2946
- children: [
2947
- "inline",
2948
- "heading",
2949
- "paragraph",
2950
- "image",
2951
- "table",
2952
- "tag",
2953
- "fence",
2954
- "blockquote",
2955
- "list",
2956
- "hr"
2957
- ],
2958
- attributes: {
2959
- align: { type: String },
2960
- colspan: { type: Number, render: "colSpan" },
2961
- rowspan: { type: Number, render: "rowSpan" }
2962
- }
2963
- };
2964
- var th = {
2965
- render: "th",
2966
- attributes: {
2967
- width: { type: String },
2968
- align: { type: String },
2969
- colspan: { type: Number, render: "colSpan" },
2970
- rowspan: { type: Number, render: "rowSpan" }
2971
- }
2972
- };
2973
- var tr = {
2974
- render: "tr",
2975
- children: ["th", "td"]
2976
- };
2977
- var tbody = {
2978
- render: "tbody",
2979
- children: ["tr", "tag"]
2980
- };
2981
- var thead = {
2982
- render: "thead",
2983
- children: ["tr"]
2984
- };
2985
- var strong = {
2986
- render: "strong",
2987
- children: ["em", "s", "link", "code", "text", "tag"],
2988
- attributes: {
2989
- marker: { type: String, render: false }
2990
- }
2991
- };
2992
- var em = {
2993
- render: "em",
2994
- children: ["strong", "s", "link", "code", "text", "tag"],
2995
- attributes: {
2996
- marker: { type: String, render: false }
2997
- }
2998
- };
2999
- var s = {
3000
- render: "s",
3001
- children: ["strong", "em", "link", "code", "text", "tag"]
3002
- };
3003
- var inline = {
3004
- children: [
3005
- "strong",
3006
- "em",
3007
- "s",
3008
- "code",
3009
- "text",
3010
- "tag",
3011
- "link",
3012
- "image",
3013
- "hardbreak",
3014
- "softbreak",
3015
- "comment"
3016
- ]
3017
- };
3018
- var link = {
3019
- render: "a",
3020
- children: ["strong", "em", "s", "code", "text", "tag"],
3021
- attributes: {
3022
- href: { type: String, required: true },
3023
- title: { type: String }
3024
- }
3025
- };
3026
- var code = {
3027
- render: "code",
3028
- attributes: {
3029
- content: { type: String, render: false, required: true }
3030
- },
3031
- transform(node2, config2) {
3032
- const attributes = node2.transformAttributes(config2);
3033
- return new Tag("code", attributes, [node2.attributes.content]);
3034
- }
3035
- };
3036
- var text = {
3037
- attributes: {
3038
- content: { type: String, required: true }
3039
- },
3040
- transform(node2) {
3041
- return node2.attributes.content;
3042
- }
3043
- };
3044
- var hardbreak = {
3045
- render: "br"
3046
- };
3047
- var softbreak = {
3048
- transform() {
3049
- return " ";
3050
- }
3051
- };
3052
- var comment = {
3053
- attributes: {
3054
- content: { type: String, required: true }
3055
- }
3056
- };
3057
- var error = {};
3058
- var node = {};
3059
-
3060
- // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
3061
- var mdurl_exports = {};
3062
- __export(mdurl_exports, {
3063
- decode: () => decode_default,
3064
- encode: () => encode_default,
3065
- format: () => format2,
3066
- parse: () => parse_default
3067
- });
3068
-
3069
- // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
3070
- var decodeCache = {};
3071
- function getDecodeCache(exclude) {
3072
- let cache = decodeCache[exclude];
3073
- if (cache) {
3074
- return cache;
3075
- }
3076
- cache = decodeCache[exclude] = [];
3077
- for (let i = 0; i < 128; i++) {
3078
- const ch = String.fromCharCode(i);
3079
- cache.push(ch);
3080
- }
3081
- for (let i = 0; i < exclude.length; i++) {
3082
- const ch = exclude.charCodeAt(i);
3083
- cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2);
3084
- }
3085
- return cache;
3086
- }
3087
- function decode(string, exclude) {
3088
- if (typeof exclude !== "string") {
3089
- exclude = decode.defaultChars;
3090
- }
3091
- const cache = getDecodeCache(exclude);
3092
- return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
3093
- let result = "";
3094
- for (let i = 0, l = seq.length; i < l; i += 3) {
3095
- const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
3096
- if (b1 < 128) {
3097
- result += cache[b1];
3098
- continue;
3099
- }
3100
- if ((b1 & 224) === 192 && i + 3 < l) {
3101
- const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
3102
- if ((b2 & 192) === 128) {
3103
- const chr = b1 << 6 & 1984 | b2 & 63;
3104
- if (chr < 128) {
3105
- result += "\uFFFD\uFFFD";
3106
- } else {
3107
- result += String.fromCharCode(chr);
3108
- }
3109
- i += 3;
3110
- continue;
3111
- }
3112
- }
3113
- if ((b1 & 240) === 224 && i + 6 < l) {
3114
- const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
3115
- const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
3116
- if ((b2 & 192) === 128 && (b3 & 192) === 128) {
3117
- const chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
3118
- if (chr < 2048 || chr >= 55296 && chr <= 57343) {
3119
- result += "\uFFFD\uFFFD\uFFFD";
3120
- } else {
3121
- result += String.fromCharCode(chr);
3122
- }
3123
- i += 6;
3124
- continue;
3125
- }
3126
- }
3127
- if ((b1 & 248) === 240 && i + 9 < l) {
3128
- const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
3129
- const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
3130
- const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
3131
- if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
3132
- let chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
3133
- if (chr < 65536 || chr > 1114111) {
3134
- result += "\uFFFD\uFFFD\uFFFD\uFFFD";
3135
- } else {
3136
- chr -= 65536;
3137
- result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
3138
- }
3139
- i += 9;
3140
- continue;
3141
- }
3142
- }
3143
- result += "\uFFFD";
3144
- }
3145
- return result;
3146
- });
3147
- }
3148
- decode.defaultChars = ";/?:@&=+$,#";
3149
- decode.componentChars = "";
3150
- var decode_default = decode;
3151
-
3152
- // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
3153
- var encodeCache = {};
3154
- function getEncodeCache(exclude) {
3155
- let cache = encodeCache[exclude];
3156
- if (cache) {
3157
- return cache;
2835
+ const cache = getDecodeCache(exclude);
2836
+ return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
2837
+ let result = "";
2838
+ for (let i = 0, l = seq.length; i < l; i += 3) {
2839
+ const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
2840
+ if (b1 < 128) {
2841
+ result += cache[b1];
2842
+ continue;
2843
+ }
2844
+ if ((b1 & 224) === 192 && i + 3 < l) {
2845
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
2846
+ if ((b2 & 192) === 128) {
2847
+ const chr = b1 << 6 & 1984 | b2 & 63;
2848
+ if (chr < 128) {
2849
+ result += "\uFFFD\uFFFD";
2850
+ } else {
2851
+ result += String.fromCharCode(chr);
2852
+ }
2853
+ i += 3;
2854
+ continue;
2855
+ }
2856
+ }
2857
+ if ((b1 & 240) === 224 && i + 6 < l) {
2858
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
2859
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
2860
+ if ((b2 & 192) === 128 && (b3 & 192) === 128) {
2861
+ const chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
2862
+ if (chr < 2048 || chr >= 55296 && chr <= 57343) {
2863
+ result += "\uFFFD\uFFFD\uFFFD";
2864
+ } else {
2865
+ result += String.fromCharCode(chr);
2866
+ }
2867
+ i += 6;
2868
+ continue;
2869
+ }
2870
+ }
2871
+ if ((b1 & 248) === 240 && i + 9 < l) {
2872
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
2873
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
2874
+ const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
2875
+ if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
2876
+ let chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
2877
+ if (chr < 65536 || chr > 1114111) {
2878
+ result += "\uFFFD\uFFFD\uFFFD\uFFFD";
2879
+ } else {
2880
+ chr -= 65536;
2881
+ result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
2882
+ }
2883
+ i += 9;
2884
+ continue;
2885
+ }
2886
+ }
2887
+ result += "\uFFFD";
2888
+ }
2889
+ return result;
2890
+ });
2891
+ }
2892
+ decode.defaultChars = ";/?:@&=+$,#";
2893
+ decode.componentChars = "";
2894
+ var decode_default = decode;
2895
+
2896
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
2897
+ var encodeCache = {};
2898
+ function getEncodeCache(exclude) {
2899
+ let cache = encodeCache[exclude];
2900
+ if (cache) {
2901
+ return cache;
3158
2902
  }
3159
2903
  cache = encodeCache[exclude] = [];
3160
2904
  for (let i = 0; i < 128; i++) {
@@ -4452,7 +4196,7 @@ var errors = {
4452
4196
  var baseMinusTMin = base - tMin;
4453
4197
  var floor = Math.floor;
4454
4198
  var stringFromCharCode = String.fromCharCode;
4455
- function error2(type) {
4199
+ function error(type) {
4456
4200
  throw new RangeError(errors[type]);
4457
4201
  }
4458
4202
  function map(array, callback) {
@@ -4532,7 +4276,7 @@ var decode2 = function(input) {
4532
4276
  }
4533
4277
  for (let j = 0; j < basic; ++j) {
4534
4278
  if (input.charCodeAt(j) >= 128) {
4535
- error2("not-basic");
4279
+ error("not-basic");
4536
4280
  }
4537
4281
  output.push(input.charCodeAt(j));
4538
4282
  }
@@ -4540,14 +4284,14 @@ var decode2 = function(input) {
4540
4284
  const oldi = i;
4541
4285
  for (let w = 1, k = base; ; k += base) {
4542
4286
  if (index >= inputLength) {
4543
- error2("invalid-input");
4287
+ error("invalid-input");
4544
4288
  }
4545
4289
  const digit = basicToDigit(input.charCodeAt(index++));
4546
4290
  if (digit >= base) {
4547
- error2("invalid-input");
4291
+ error("invalid-input");
4548
4292
  }
4549
4293
  if (digit > floor((maxInt - i) / w)) {
4550
- error2("overflow");
4294
+ error("overflow");
4551
4295
  }
4552
4296
  i += digit * w;
4553
4297
  const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
@@ -4556,14 +4300,14 @@ var decode2 = function(input) {
4556
4300
  }
4557
4301
  const baseMinusT = base - t;
4558
4302
  if (w > floor(maxInt / baseMinusT)) {
4559
- error2("overflow");
4303
+ error("overflow");
4560
4304
  }
4561
4305
  w *= baseMinusT;
4562
4306
  }
4563
4307
  const out = output.length + 1;
4564
4308
  bias = adapt(i - oldi, out, oldi == 0);
4565
4309
  if (floor(i / out) > maxInt - n) {
4566
- error2("overflow");
4310
+ error("overflow");
4567
4311
  }
4568
4312
  n += floor(i / out);
4569
4313
  i %= out;
@@ -4597,13 +4341,13 @@ var encode2 = function(input) {
4597
4341
  }
4598
4342
  const handledCPCountPlusOne = handledCPCount + 1;
4599
4343
  if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
4600
- error2("overflow");
4344
+ error("overflow");
4601
4345
  }
4602
4346
  delta += (m - n) * handledCPCountPlusOne;
4603
4347
  n = m;
4604
4348
  for (const currentValue of input) {
4605
4349
  if (currentValue < n && ++delta > maxInt) {
4606
- error2("overflow");
4350
+ error("overflow");
4607
4351
  }
4608
4352
  if (currentValue === n) {
4609
4353
  let q = delta;
@@ -5571,7 +5315,7 @@ function strip_references(state) {
5571
5315
  }
5572
5316
  if (tokens.length !== last) tokens.length = last;
5573
5317
  }
5574
- function inline2(state) {
5318
+ function inline(state) {
5575
5319
  const tokens = state.tokens;
5576
5320
  for (let i = 0, l = tokens.length; i < l; i++) {
5577
5321
  const tok = tokens[i];
@@ -5870,7 +5614,7 @@ var _rules$2 = [
5870
5614
  ["normalize", normalize],
5871
5615
  ["block", block],
5872
5616
  ["strip_references", strip_references],
5873
- ["inline", inline2],
5617
+ ["inline", inline],
5874
5618
  ["linkify", linkify$1],
5875
5619
  ["replacements", replace],
5876
5620
  ["smartquotes", smartquotes],
@@ -6033,7 +5777,7 @@ function escapedSplit(str) {
6033
5777
  result.push(current + str.substring(lastPos));
6034
5778
  return result;
6035
5779
  }
6036
- function table2(state, startLine, endLine, silent) {
5780
+ function table(state, startLine, endLine, silent) {
6037
5781
  if (startLine + 2 > endLine) return false;
6038
5782
  let nextLine = startLine + 1;
6039
5783
  if (state.sCount[nextLine] < state.blkIndent) return false;
@@ -6136,7 +5880,7 @@ function table2(state, startLine, endLine, silent) {
6136
5880
  state.line = nextLine;
6137
5881
  return true;
6138
5882
  }
6139
- function code2(state, startLine, endLine) {
5883
+ function code(state, startLine, endLine) {
6140
5884
  if (state.sCount[startLine] - state.blkIndent < 4) return false;
6141
5885
  let nextLine = startLine + 1;
6142
5886
  let last = nextLine;
@@ -6158,7 +5902,7 @@ function code2(state, startLine, endLine) {
6158
5902
  token.map = [startLine, state.line];
6159
5903
  return true;
6160
5904
  }
6161
- function fence2(state, startLine, endLine, silent) {
5905
+ function fence(state, startLine, endLine, silent) {
6162
5906
  let pos = state.bMarks[startLine] + state.tShift[startLine];
6163
5907
  let max2 = state.eMarks[startLine];
6164
5908
  if (!state.md.options.allowIndentation && state.sCount[startLine] - state.blkIndent >= 4) return false;
@@ -6201,7 +5945,7 @@ function fence2(state, startLine, endLine, silent) {
6201
5945
  token.map = [startLine, state.line];
6202
5946
  return true;
6203
5947
  }
6204
- function blockquote2(state, startLine, endLine, silent) {
5948
+ function blockquote(state, startLine, endLine, silent) {
6205
5949
  let pos = state.bMarks[startLine] + state.tShift[startLine];
6206
5950
  let max2 = state.eMarks[startLine];
6207
5951
  const oldLineMax = state.lineMax;
@@ -6302,7 +6046,7 @@ function blockquote2(state, startLine, endLine, silent) {
6302
6046
  state.blkIndent = oldIndent;
6303
6047
  return true;
6304
6048
  }
6305
- function hr2(state, startLine, endLine, silent) {
6049
+ function hr(state, startLine, endLine, silent) {
6306
6050
  const max2 = state.eMarks[startLine];
6307
6051
  if (!state.md.options.allowIndentation && state.sCount[startLine] - state.blkIndent >= 4) return false;
6308
6052
  let pos = state.bMarks[startLine] + state.tShift[startLine];
@@ -6363,7 +6107,7 @@ function markTightParagraphs(state, idx) {
6363
6107
  i += 2;
6364
6108
  }
6365
6109
  }
6366
- function list2(state, startLine, endLine, silent) {
6110
+ function list(state, startLine, endLine, silent) {
6367
6111
  let max2, pos, start, token;
6368
6112
  let nextLine = startLine;
6369
6113
  let tight = true;
@@ -6750,7 +6494,7 @@ function html_block(state, startLine, endLine, silent) {
6750
6494
  token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
6751
6495
  return true;
6752
6496
  }
6753
- function heading2(state, startLine, endLine, silent) {
6497
+ function heading(state, startLine, endLine, silent) {
6754
6498
  let pos = state.bMarks[startLine] + state.tShift[startLine];
6755
6499
  let max2 = state.eMarks[startLine];
6756
6500
  if (!state.md.options.allowIndentation && state.sCount[startLine] - state.blkIndent >= 4) return false;
@@ -6830,7 +6574,7 @@ function lheading(state, startLine, endLine) {
6830
6574
  state.parentType = oldParentType;
6831
6575
  return true;
6832
6576
  }
6833
- function paragraph2(state, startLine, endLine) {
6577
+ function paragraph(state, startLine, endLine) {
6834
6578
  const terminatorRules = state.md.block.ruler.getRules("paragraph");
6835
6579
  const oldParentType = state.parentType;
6836
6580
  let nextLine = startLine + 1;
@@ -6860,13 +6604,13 @@ function paragraph2(state, startLine, endLine) {
6860
6604
  var _rules$1 = [
6861
6605
  [
6862
6606
  "table",
6863
- table2,
6607
+ table,
6864
6608
  ["paragraph", "reference"]
6865
6609
  ],
6866
- ["code", code2],
6610
+ ["code", code],
6867
6611
  [
6868
6612
  "fence",
6869
- fence2,
6613
+ fence,
6870
6614
  [
6871
6615
  "paragraph",
6872
6616
  "reference",
@@ -6876,7 +6620,7 @@ var _rules$1 = [
6876
6620
  ],
6877
6621
  [
6878
6622
  "blockquote",
6879
- blockquote2,
6623
+ blockquote,
6880
6624
  [
6881
6625
  "paragraph",
6882
6626
  "reference",
@@ -6886,7 +6630,7 @@ var _rules$1 = [
6886
6630
  ],
6887
6631
  [
6888
6632
  "hr",
6889
- hr2,
6633
+ hr,
6890
6634
  [
6891
6635
  "paragraph",
6892
6636
  "reference",
@@ -6896,7 +6640,7 @@ var _rules$1 = [
6896
6640
  ],
6897
6641
  [
6898
6642
  "list",
6899
- list2,
6643
+ list,
6900
6644
  [
6901
6645
  "paragraph",
6902
6646
  "reference",
@@ -6915,7 +6659,7 @@ var _rules$1 = [
6915
6659
  ],
6916
6660
  [
6917
6661
  "heading",
6918
- heading2,
6662
+ heading,
6919
6663
  [
6920
6664
  "paragraph",
6921
6665
  "reference",
@@ -6923,7 +6667,7 @@ var _rules$1 = [
6923
6667
  ]
6924
6668
  ],
6925
6669
  ["lheading", lheading],
6926
- ["paragraph", paragraph2]
6670
+ ["paragraph", paragraph]
6927
6671
  ];
6928
6672
  var ParserBlock = class {
6929
6673
  constructor() {
@@ -7095,7 +6839,7 @@ function isTerminatorChar(ch) {
7095
6839
  return false;
7096
6840
  }
7097
6841
  }
7098
- function text2(state, silent) {
6842
+ function text(state, silent) {
7099
6843
  let pos = state.pos;
7100
6844
  while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) pos++;
7101
6845
  if (pos === state.pos) return false;
@@ -7408,7 +7152,7 @@ var emphasis_default = {
7408
7152
  tokenize: emphasis_tokenize,
7409
7153
  postProcess: emphasis_post_process
7410
7154
  };
7411
- function link2(state, silent) {
7155
+ function link(state, silent) {
7412
7156
  let code3, label, res, ref;
7413
7157
  let href = "";
7414
7158
  let title = "";
@@ -7492,7 +7236,7 @@ function link2(state, silent) {
7492
7236
  state.posMax = max2;
7493
7237
  return true;
7494
7238
  }
7495
- function image2(state, silent) {
7239
+ function image(state, silent) {
7496
7240
  let code3, content, label, pos, ref, res, title, start;
7497
7241
  let href = "";
7498
7242
  const oldPos = state.pos;
@@ -7769,15 +7513,15 @@ function fragments_join(state) {
7769
7513
  if (curr !== last) tokens.length = last;
7770
7514
  }
7771
7515
  var _rules = [
7772
- ["text", text2],
7516
+ ["text", text],
7773
7517
  ["linkify", linkify],
7774
7518
  ["newline", newline],
7775
7519
  ["escape", escape],
7776
7520
  ["backticks", backtick],
7777
7521
  ["strikethrough", strikethrough_default.tokenize],
7778
7522
  ["emphasis", emphasis_default.tokenize],
7779
- ["link", link2],
7780
- ["image", image2],
7523
+ ["link", link],
7524
+ ["image", image],
7781
7525
  ["autolink", autolink],
7782
7526
  ["html_inline", html_inline],
7783
7527
  ["entity", entity]
@@ -8319,16 +8063,19 @@ var voidElements = /* @__PURE__ */ new Set([
8319
8063
  "track",
8320
8064
  "wbr"
8321
8065
  ]);
8066
+ var tagName = /^[a-zA-Z][^\s/>\0]*$/;
8067
+ var attributeName = /^[^\s"'>/=\0]+$/;
8322
8068
  function render(node2) {
8323
8069
  if (typeof node2 === "string" || typeof node2 === "number")
8324
8070
  return escapeHtml2(String(node2));
8325
8071
  if (Array.isArray(node2)) return node2.map(render).join("");
8326
8072
  if (node2 === null || typeof node2 !== "object" || !Tag.isTag(node2)) return "";
8327
8073
  const { name, attributes, children = [] } = node2;
8328
- if (!name) return render(children);
8074
+ if (!name || !tagName.test(name)) return render(children);
8329
8075
  let output = `<${name}`;
8330
8076
  for (const [k, v] of Object.entries(attributes ?? {}))
8331
- output += ` ${k.toLowerCase()}="${escapeHtml2(String(v))}"`;
8077
+ if (v != null && attributeName.test(k))
8078
+ output += ` ${k.toLowerCase()}="${escapeHtml2(String(v))}"`;
8332
8079
  output += ">";
8333
8080
  if (voidElements.has(name)) return output;
8334
8081
  if (children.length) output += render(children);
@@ -8337,10 +8084,10 @@ function render(node2) {
8337
8084
  }
8338
8085
 
8339
8086
  // src/renderers/react/react.ts
8340
- function tagName(name, components) {
8087
+ function tagName2(name, components) {
8341
8088
  return typeof name !== "string" ? name : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
8342
8089
  }
8343
- function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {}) {
8090
+ function dynamic(node2, React, { components = {}, resolveTagName = tagName2 } = {}) {
8344
8091
  function deepRender2(value) {
8345
8092
  if (value == null || typeof value !== "object") return value;
8346
8093
  if (Array.isArray(value)) return value.map((item2) => deepRender2(item2));
@@ -8364,7 +8111,7 @@ function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {
8364
8111
  if (className) attrs.className = className;
8365
8112
  return React.createElement(
8366
8113
  resolveTagName(name, components),
8367
- Object.keys(attrs).length == 0 ? null : deepRender2(attrs),
8114
+ Object.keys(attrs).length === 0 ? null : deepRender2(attrs),
8368
8115
  ...children.map(render3)
8369
8116
  );
8370
8117
  }
@@ -8372,7 +8119,7 @@ function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {
8372
8119
  }
8373
8120
 
8374
8121
  // src/renderers/react/static.ts
8375
- function tagName2(name, components) {
8122
+ function tagName3(name, components) {
8376
8123
  return typeof name !== "string" ? "Fragment" : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
8377
8124
  }
8378
8125
  function renderArray(children) {
@@ -8400,10 +8147,10 @@ function render2(node2) {
8400
8147
  if (className) attrs.className = className;
8401
8148
  return `React.createElement(
8402
8149
  tagName(${JSON.stringify(name)}, components),
8403
- ${Object.keys(attrs).length == 0 ? "null" : deepRender(attrs)},
8150
+ ${Object.keys(attrs).length === 0 ? "null" : deepRender(attrs)},
8404
8151
  ${renderArray(children)})`;
8405
8152
  }
8406
- function reactStatic(node2, { resolveTagName = tagName2 } = {}) {
8153
+ function reactStatic(node2, { resolveTagName = tagName3 } = {}) {
8407
8154
  if (resolveTagName.name !== "tagName") {
8408
8155
  throw new Error("resolveTagName must be named tagName");
8409
8156
  }
@@ -8418,6 +8165,263 @@ function reactStatic(node2, { resolveTagName = tagName2 } = {}) {
8418
8165
  // src/renderers/index.ts
8419
8166
  var renderers_default = { html: render, react: dynamic, reactStatic };
8420
8167
 
8168
+ // src/schema.ts
8169
+ var schema_exports = {};
8170
+ __export(schema_exports, {
8171
+ blockquote: () => blockquote2,
8172
+ code: () => code2,
8173
+ comment: () => comment,
8174
+ document: () => document,
8175
+ em: () => em,
8176
+ error: () => error2,
8177
+ fence: () => fence2,
8178
+ hardbreak: () => hardbreak,
8179
+ heading: () => heading2,
8180
+ hr: () => hr2,
8181
+ image: () => image2,
8182
+ inline: () => inline2,
8183
+ item: () => item,
8184
+ link: () => link2,
8185
+ list: () => list2,
8186
+ node: () => node,
8187
+ paragraph: () => paragraph2,
8188
+ s: () => s,
8189
+ softbreak: () => softbreak,
8190
+ strong: () => strong,
8191
+ table: () => table2,
8192
+ tbody: () => tbody,
8193
+ td: () => td,
8194
+ text: () => text2,
8195
+ th: () => th,
8196
+ thead: () => thead,
8197
+ tr: () => tr
8198
+ });
8199
+ var document = {
8200
+ render: "article",
8201
+ children: [
8202
+ "heading",
8203
+ "paragraph",
8204
+ "image",
8205
+ "table",
8206
+ "tag",
8207
+ "fence",
8208
+ "blockquote",
8209
+ "comment",
8210
+ "list",
8211
+ "hr"
8212
+ ],
8213
+ attributes: {
8214
+ frontmatter: { render: false }
8215
+ }
8216
+ };
8217
+ var heading2 = {
8218
+ children: ["inline"],
8219
+ attributes: {
8220
+ level: { type: Number, render: false, required: true }
8221
+ },
8222
+ transform(node2, config2) {
8223
+ const level = node2.attributes["level"];
8224
+ if (!(Number.isInteger(level) && level >= 1 && level <= 6))
8225
+ return node2.transformChildren(config2);
8226
+ return new Tag(
8227
+ `h${level}`,
8228
+ node2.transformAttributes(config2),
8229
+ node2.transformChildren(config2)
8230
+ );
8231
+ }
8232
+ };
8233
+ var paragraph2 = {
8234
+ render: "p",
8235
+ children: ["inline"]
8236
+ };
8237
+ var image2 = {
8238
+ render: "img",
8239
+ attributes: {
8240
+ src: { type: String, required: true },
8241
+ alt: { type: String },
8242
+ title: { type: String }
8243
+ // width/height attributes will need to be to be implemented as an extension to markdown-it
8244
+ }
8245
+ };
8246
+ var fence2 = {
8247
+ render: "pre",
8248
+ attributes: {
8249
+ content: { type: String, render: false, required: true },
8250
+ language: { type: String, render: "data-language" },
8251
+ process: { type: Boolean, render: false, default: true }
8252
+ },
8253
+ transform(node2, config2) {
8254
+ const attributes = node2.transformAttributes(config2);
8255
+ const children = node2.children.length ? node2.transformChildren(config2) : [node2.attributes.content];
8256
+ return new Tag("pre", attributes, children);
8257
+ }
8258
+ };
8259
+ var blockquote2 = {
8260
+ render: "blockquote",
8261
+ children: [
8262
+ "heading",
8263
+ "paragraph",
8264
+ "image",
8265
+ "table",
8266
+ "tag",
8267
+ "fence",
8268
+ "blockquote",
8269
+ "list",
8270
+ "hr"
8271
+ ]
8272
+ };
8273
+ var item = {
8274
+ render: "li",
8275
+ children: [
8276
+ "inline",
8277
+ "heading",
8278
+ "paragraph",
8279
+ "image",
8280
+ "table",
8281
+ "tag",
8282
+ "fence",
8283
+ "blockquote",
8284
+ "list",
8285
+ "hr"
8286
+ ]
8287
+ };
8288
+ var list2 = {
8289
+ children: ["item"],
8290
+ attributes: {
8291
+ ordered: { type: Boolean, render: false, required: true },
8292
+ start: { type: Number },
8293
+ marker: { type: String, render: false }
8294
+ },
8295
+ transform(node2, config2) {
8296
+ return new Tag(
8297
+ node2.attributes.ordered ? "ol" : "ul",
8298
+ node2.transformAttributes(config2),
8299
+ node2.transformChildren(config2)
8300
+ );
8301
+ }
8302
+ };
8303
+ var hr2 = {
8304
+ render: "hr"
8305
+ };
8306
+ var table2 = {
8307
+ render: "table"
8308
+ };
8309
+ var td = {
8310
+ render: "td",
8311
+ children: [
8312
+ "inline",
8313
+ "heading",
8314
+ "paragraph",
8315
+ "image",
8316
+ "table",
8317
+ "tag",
8318
+ "fence",
8319
+ "blockquote",
8320
+ "list",
8321
+ "hr"
8322
+ ],
8323
+ attributes: {
8324
+ align: { type: String },
8325
+ colspan: { type: Number, render: "colSpan" },
8326
+ rowspan: { type: Number, render: "rowSpan" }
8327
+ }
8328
+ };
8329
+ var th = {
8330
+ render: "th",
8331
+ attributes: {
8332
+ width: { type: String },
8333
+ align: { type: String },
8334
+ colspan: { type: Number, render: "colSpan" },
8335
+ rowspan: { type: Number, render: "rowSpan" }
8336
+ }
8337
+ };
8338
+ var tr = {
8339
+ render: "tr",
8340
+ children: ["th", "td"]
8341
+ };
8342
+ var tbody = {
8343
+ render: "tbody",
8344
+ children: ["tr", "tag"]
8345
+ };
8346
+ var thead = {
8347
+ render: "thead",
8348
+ children: ["tr"]
8349
+ };
8350
+ var strong = {
8351
+ render: "strong",
8352
+ children: ["em", "s", "link", "code", "text", "tag"],
8353
+ attributes: {
8354
+ marker: { type: String, render: false }
8355
+ }
8356
+ };
8357
+ var em = {
8358
+ render: "em",
8359
+ children: ["strong", "s", "link", "code", "text", "tag"],
8360
+ attributes: {
8361
+ marker: { type: String, render: false }
8362
+ }
8363
+ };
8364
+ var s = {
8365
+ render: "s",
8366
+ children: ["strong", "em", "link", "code", "text", "tag"]
8367
+ };
8368
+ var inline2 = {
8369
+ children: [
8370
+ "strong",
8371
+ "em",
8372
+ "s",
8373
+ "code",
8374
+ "text",
8375
+ "tag",
8376
+ "link",
8377
+ "image",
8378
+ "hardbreak",
8379
+ "softbreak",
8380
+ "comment"
8381
+ ]
8382
+ };
8383
+ var link2 = {
8384
+ render: "a",
8385
+ children: ["strong", "em", "s", "code", "text", "tag"],
8386
+ attributes: {
8387
+ href: { type: String, required: true },
8388
+ title: { type: String }
8389
+ }
8390
+ };
8391
+ var code2 = {
8392
+ render: "code",
8393
+ attributes: {
8394
+ content: { type: String, render: false, required: true }
8395
+ },
8396
+ transform(node2, config2) {
8397
+ const attributes = node2.transformAttributes(config2);
8398
+ return new Tag("code", attributes, [node2.attributes.content]);
8399
+ }
8400
+ };
8401
+ var text2 = {
8402
+ attributes: {
8403
+ content: { type: String, required: true }
8404
+ },
8405
+ transform(node2) {
8406
+ return node2.attributes.content;
8407
+ }
8408
+ };
8409
+ var hardbreak = {
8410
+ render: "br"
8411
+ };
8412
+ var softbreak = {
8413
+ transform() {
8414
+ return " ";
8415
+ }
8416
+ };
8417
+ var comment = {
8418
+ attributes: {
8419
+ content: { type: String, required: true }
8420
+ }
8421
+ };
8422
+ var error2 = {};
8423
+ var node = {};
8424
+
8421
8425
  // src/tags/partial.ts
8422
8426
  var PartialFile = class {
8423
8427
  validate(file, config2) {
@@ -8459,12 +8463,6 @@ var partial = {
8459
8463
  }
8460
8464
  };
8461
8465
 
8462
- // src/tags/table.ts
8463
- var table3 = {
8464
- children: ["table"],
8465
- inline: false
8466
- };
8467
-
8468
8466
  // src/tags/slot.ts
8469
8467
  var slot = {
8470
8468
  attributes: {
@@ -8472,6 +8470,12 @@ var slot = {
8472
8470
  }
8473
8471
  };
8474
8472
 
8473
+ // src/tags/table.ts
8474
+ var table3 = {
8475
+ children: ["table"],
8476
+ inline: false
8477
+ };
8478
+
8475
8479
  // src/tags/index.ts
8476
8480
  var tags_default = {
8477
8481
  else: tagElse,
@@ -8508,7 +8512,7 @@ function createToken(state, content, contentStart) {
8508
8512
  return token;
8509
8513
  }
8510
8514
  }
8511
- function block2(state, startLine, endLine, silent) {
8515
+ function block2(state, startLine, _endLine, silent) {
8512
8516
  const start = state.bMarks[startLine] + state.tShift[startLine];
8513
8517
  const finish = state.eMarks[startLine];
8514
8518
  if (!state.src.startsWith(OPEN, start)) return false;
@@ -8574,35 +8578,10 @@ function plugin(md) {
8574
8578
  md.core.ruler.push("annotations", core);
8575
8579
  }
8576
8580
 
8577
- // src/tokenizer/plugins/frontmatter.ts
8578
- var fence3 = "---";
8579
- function getLine2(state, n) {
8580
- return state.src.slice(state.bMarks[n], state.eMarks[n]).trim();
8581
- }
8582
- function findClose(state, endLine) {
8583
- for (let line = 1; line < endLine; line++)
8584
- if (getLine2(state, line) === fence3) return line;
8585
- }
8586
- function block3(state, startLine, endLine, silent) {
8587
- if (startLine != 0 || getLine2(state, 0) != fence3) return false;
8588
- const close = findClose(state, endLine);
8589
- if (!close) return false;
8590
- if (silent) return true;
8591
- const token = state.push("frontmatter", "", 0);
8592
- token.content = state.src.slice(state.eMarks[0], state.bMarks[close]).trim();
8593
- token.map = [0, close];
8594
- token.hidden = true;
8595
- state.line = close + 1;
8596
- return true;
8597
- }
8598
- function plugin2(md) {
8599
- md.block.ruler.before("hr", "frontmatter", block3);
8600
- }
8601
-
8602
8581
  // src/tokenizer/plugins/comments.ts
8603
8582
  var OPEN2 = "<!--";
8604
8583
  var CLOSE2 = "-->";
8605
- function block4(state, startLine, endLine, silent) {
8584
+ function block3(state, startLine, _endLine, silent) {
8606
8585
  const start = state.bMarks[startLine] + state.tShift[startLine];
8607
8586
  if (!state.src.startsWith(OPEN2, start)) return false;
8608
8587
  const close = state.src.indexOf(CLOSE2, start);
@@ -8627,11 +8606,36 @@ function inline4(state, silent) {
8627
8606
  state.pos = close + CLOSE2.length;
8628
8607
  return true;
8629
8608
  }
8630
- function plugin3(md) {
8631
- md.block.ruler.before("table", "comment", block4, { alt: ["paragraph"] });
8609
+ function plugin2(md) {
8610
+ md.block.ruler.before("table", "comment", block3, { alt: ["paragraph"] });
8632
8611
  md.inline.ruler.push("comment", inline4);
8633
8612
  }
8634
8613
 
8614
+ // src/tokenizer/plugins/frontmatter.ts
8615
+ var fence3 = "---";
8616
+ function getLine2(state, n) {
8617
+ return state.src.slice(state.bMarks[n], state.eMarks[n]).trim();
8618
+ }
8619
+ function findClose(state, endLine) {
8620
+ for (let line = 1; line < endLine; line++)
8621
+ if (getLine2(state, line) === fence3) return line;
8622
+ }
8623
+ function block4(state, startLine, endLine, silent) {
8624
+ if (startLine !== 0 || getLine2(state, 0) !== fence3) return false;
8625
+ const close = findClose(state, endLine);
8626
+ if (!close) return false;
8627
+ if (silent) return true;
8628
+ const token = state.push("frontmatter", "", 0);
8629
+ token.content = state.src.slice(state.eMarks[0], state.bMarks[close]).trim();
8630
+ token.map = [0, close];
8631
+ token.hidden = true;
8632
+ state.line = close + 1;
8633
+ return true;
8634
+ }
8635
+ function plugin3(md) {
8636
+ md.block.ruler.before("hr", "frontmatter", block4);
8637
+ }
8638
+
8635
8639
  // src/tokenizer/plugins/link.ts
8636
8640
  var INVALID_HREF_MESSAGE = "The 'href' format cannot contain Markdoc tag or variable. URLs must be static strings.";
8637
8641
  function pushHrefError(token) {
@@ -8660,13 +8664,13 @@ var Tokenizer = class {
8660
8664
  constructor(config2 = {}) {
8661
8665
  this.parser = new MarkdownItCallable(config2);
8662
8666
  this.parser.use(plugin);
8663
- this.parser.use(plugin2);
8667
+ this.parser.use(plugin3);
8664
8668
  this.parser.disable([
8665
8669
  "lheading",
8666
8670
  // Disable indented `code_block` support https://spec.commonmark.org/0.30/#indented-code-block
8667
8671
  "code"
8668
8672
  ]);
8669
- if (config2.allowComments) this.parser.use(plugin3);
8673
+ if (config2.allowComments) this.parser.use(plugin2);
8670
8674
  if (config2.allowLinkValidation) {
8671
8675
  this.parser.use(
8672
8676
  plugin4,
@@ -8775,7 +8779,7 @@ function validator(node2, config2) {
8775
8779
  });
8776
8780
  return errors2;
8777
8781
  }
8778
- if (schema.inline != void 0 && node2.inline !== schema.inline)
8782
+ if (schema.inline != null && node2.inline !== schema.inline)
8779
8783
  errors2.push({
8780
8784
  id: "tag-placement-invalid",
8781
8785
  level: "critical",
@@ -8869,7 +8873,8 @@ function validator(node2, config2) {
8869
8873
  }
8870
8874
  }
8871
8875
  for (const [key, { required }] of Object.entries(attributes))
8872
- if (required && (!Object.prototype.hasOwnProperty.call(node2.attributes, key) || node2.attributes[key] === void 0))
8876
+ if (required && // biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn requires ES2022; Markdoc targets ES2021.
8877
+ (!Object.prototype.hasOwnProperty.call(node2.attributes, key) || node2.attributes[key] === void 0))
8873
8878
  errors2.push({
8874
8879
  id: "attribute-missing-required",
8875
8880
  level: "error",