@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.js CHANGED
@@ -190,11 +190,7 @@ var require_tag = __commonJS({
190
190
  var peg$f3 = function(tag, primary, attributes, close) {
191
191
  if (primary) {
192
192
  attributes = attributes || [];
193
- attributes.unshift({
194
- type: "attribute",
195
- name: "primary",
196
- value: primary
197
- });
193
+ attributes.unshift({ type: "attribute", name: "primary", value: primary });
198
194
  }
199
195
  const [type, nesting] = close ? ["tag", 0] : ["tag_open", 1];
200
196
  return { type, nesting, meta: { tag, attributes } };
@@ -245,7 +241,8 @@ var require_tag = __commonJS({
245
241
  return value;
246
242
  };
247
243
  var peg$f18 = function(prefix, head, tail) {
248
- if (prefix === "@") return [head, ...tail];
244
+ if (prefix === "@")
245
+ return [head, ...tail];
249
246
  return new Variable2([head, ...tail]);
250
247
  };
251
248
  var peg$f19 = function() {
@@ -298,9 +295,7 @@ var require_tag = __commonJS({
298
295
  var peg$result;
299
296
  if ("startRule" in options) {
300
297
  if (!(options.startRule in peg$startRuleFunctions)) {
301
- throw new Error(
302
- `Can't start parsing from rule "` + options.startRule + '".'
303
- );
298
+ throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
304
299
  }
305
300
  peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
306
301
  }
@@ -332,12 +327,7 @@ var require_tag = __commonJS({
332
327
  return { type: "literal", text: text4, ignoreCase };
333
328
  }
334
329
  function peg$classExpectation(parts, inverted, ignoreCase) {
335
- return {
336
- type: "class",
337
- parts,
338
- inverted,
339
- ignoreCase
340
- };
330
+ return { type: "class", parts, inverted, ignoreCase };
341
331
  }
342
332
  function peg$anyExpectation() {
343
333
  return { type: "any" };
@@ -1784,21 +1774,6 @@ function resolve(value, config2 = {}) {
1784
1774
  return output;
1785
1775
  }
1786
1776
 
1787
- // src/tag.ts
1788
- var Tag = class {
1789
- constructor(name = "div", attributes = {}, children = []) {
1790
- this.$$mdtype = "Tag";
1791
- this.name = name;
1792
- this.attributes = attributes;
1793
- this.children = children;
1794
- }
1795
- static {
1796
- this.isTag = (tag) => {
1797
- return !!(tag?.$$mdtype === "Tag");
1798
- };
1799
- }
1800
- };
1801
-
1802
1777
  // src/schema-types/class.ts
1803
1778
  var Class = class {
1804
1779
  validate(value, _config, key) {
@@ -1833,6 +1808,21 @@ var Id = class {
1833
1808
  }
1834
1809
  };
1835
1810
 
1811
+ // src/tag.ts
1812
+ var Tag = class {
1813
+ constructor(name = "div", attributes = {}, children = []) {
1814
+ this.$$mdtype = "Tag";
1815
+ this.name = name;
1816
+ this.attributes = attributes;
1817
+ this.children = children;
1818
+ }
1819
+ static {
1820
+ this.isTag = (tag) => {
1821
+ return !!(tag?.$$mdtype === "Tag");
1822
+ };
1823
+ }
1824
+ };
1825
+
1836
1826
  // src/utils.ts
1837
1827
  var import_tag = __toESM(require_tag());
1838
1828
  var OPEN = "{%";
@@ -2006,7 +1996,7 @@ var transformer_default = {
2006
1996
  if (schema && schema.transform instanceof Function)
2007
1997
  return schema.transform(node2, config2);
2008
1998
  const children = this.children(node2, config2);
2009
- if (!schema || !schema.render) return children;
1999
+ if (!schema?.render) return children;
2010
2000
  const attributes = this.attributes(node2, config2);
2011
2001
  if (isPromise(attributes) || isPromise(children)) {
2012
2002
  return Promise.all([attributes, children]).then(
@@ -2181,14 +2171,14 @@ function* trimStart(g) {
2181
2171
  yield* g;
2182
2172
  }
2183
2173
  function* escapeMarkdownCharacters(s2, characters) {
2184
- yield s2.replace(characters, "\\$&").replace(new RegExp("\xA0", "g"), " ");
2174
+ yield s2.replace(characters, "\\$&").replace(/\xa0/g, " ");
2185
2175
  }
2186
2176
  function* formatNode(n, o = {}) {
2187
2177
  const no = { ...o, parent: n };
2188
2178
  const indent = SPACE.repeat(no.indent || 0);
2189
2179
  switch (n.type) {
2190
2180
  case "document": {
2191
- if (n.attributes.frontmatter && n.attributes.frontmatter.length) {
2181
+ if (n.attributes.frontmatter?.length) {
2192
2182
  yield "---" + NL + n.attributes.frontmatter + NL + "---" + NL + NL;
2193
2183
  }
2194
2184
  yield* trimStart(formatChildren(n, no));
@@ -2419,7 +2409,7 @@ function* formatNode(n, o = {}) {
2419
2409
  head.map((cell, i) => cell + SPACE.repeat(widths[i] - cell.length))
2420
2410
  );
2421
2411
  yield NL;
2422
- yield* formatTableRow(head.map((cell, i) => "-".repeat(widths[i])));
2412
+ yield* formatTableRow(head.map((_cell, i) => "-".repeat(widths[i])));
2423
2413
  yield NL;
2424
2414
  for (const row of rows) {
2425
2415
  yield* formatTableRow(
@@ -2676,6 +2666,14 @@ function annotate(node2, attributes) {
2676
2666
  });
2677
2667
  continue;
2678
2668
  }
2669
+ if (node2.type === "heading" && name === "level" && !(Number.isInteger(value) && value >= 1 && value <= 6)) {
2670
+ node2.errors.push({
2671
+ id: "attribute-value-invalid",
2672
+ level: "error",
2673
+ message: `Invalid heading level: '${value}'`
2674
+ });
2675
+ continue;
2676
+ }
2679
2677
  if (Object.prototype.hasOwnProperty.call(node2.attributes, name))
2680
2678
  node2.errors.push({
2681
2679
  id: "duplicate-attribute",
@@ -2711,7 +2709,7 @@ function handleAttrs(token, type) {
2711
2709
  case "text":
2712
2710
  case "code":
2713
2711
  case "comment":
2714
- return { content: (token.meta || {}).variable || token.content };
2712
+ return { content: token.meta?.variable || token.content };
2715
2713
  case "fence": {
2716
2714
  const [language] = token.info.split(" ", 1);
2717
2715
  return language === "" || language === OPEN ? { content: token.content } : { content: token.content, language };
@@ -2832,358 +2830,104 @@ function parser(tokens, args) {
2832
2830
  return doc;
2833
2831
  }
2834
2832
 
2835
- // src/schema.ts
2836
- var schema_exports = {};
2837
- __export(schema_exports, {
2838
- blockquote: () => blockquote,
2839
- code: () => code,
2840
- comment: () => comment,
2841
- document: () => document,
2842
- em: () => em,
2843
- error: () => error,
2844
- fence: () => fence,
2845
- hardbreak: () => hardbreak,
2846
- heading: () => heading,
2847
- hr: () => hr,
2848
- image: () => image,
2849
- inline: () => inline,
2850
- item: () => item,
2851
- link: () => link,
2852
- list: () => list,
2853
- node: () => node,
2854
- paragraph: () => paragraph,
2855
- s: () => s,
2856
- softbreak: () => softbreak,
2857
- strong: () => strong,
2858
- table: () => table,
2859
- tbody: () => tbody,
2860
- td: () => td,
2861
- text: () => text,
2862
- th: () => th,
2863
- thead: () => thead,
2864
- tr: () => tr
2833
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
2834
+ var mdurl_exports = {};
2835
+ __export(mdurl_exports, {
2836
+ decode: () => decode_default,
2837
+ encode: () => encode_default,
2838
+ format: () => format2,
2839
+ parse: () => parse_default
2865
2840
  });
2866
- var document = {
2867
- render: "article",
2868
- children: [
2869
- "heading",
2870
- "paragraph",
2871
- "image",
2872
- "table",
2873
- "tag",
2874
- "fence",
2875
- "blockquote",
2876
- "comment",
2877
- "list",
2878
- "hr"
2879
- ],
2880
- attributes: {
2881
- frontmatter: { render: false }
2841
+
2842
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
2843
+ var decodeCache = {};
2844
+ function getDecodeCache(exclude) {
2845
+ let cache = decodeCache[exclude];
2846
+ if (cache) {
2847
+ return cache;
2882
2848
  }
2883
- };
2884
- var heading = {
2885
- children: ["inline"],
2886
- attributes: {
2887
- level: { type: Number, render: false, required: true }
2888
- },
2889
- transform(node2, config2) {
2890
- return new Tag(
2891
- `h${node2.attributes["level"]}`,
2892
- node2.transformAttributes(config2),
2893
- node2.transformChildren(config2)
2894
- );
2849
+ cache = decodeCache[exclude] = [];
2850
+ for (let i = 0; i < 128; i++) {
2851
+ const ch = String.fromCharCode(i);
2852
+ cache.push(ch);
2895
2853
  }
2896
- };
2897
- var paragraph = {
2898
- render: "p",
2899
- children: ["inline"]
2900
- };
2901
- var image = {
2902
- render: "img",
2903
- attributes: {
2904
- src: { type: String, required: true },
2905
- alt: { type: String },
2906
- title: { type: String }
2907
- // width/height attributes will need to be to be implemented as an extension to markdown-it
2854
+ for (let i = 0; i < exclude.length; i++) {
2855
+ const ch = exclude.charCodeAt(i);
2856
+ cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2);
2908
2857
  }
2909
- };
2910
- var fence = {
2911
- render: "pre",
2912
- attributes: {
2913
- content: { type: String, render: false, required: true },
2914
- language: { type: String, render: "data-language" },
2915
- process: { type: Boolean, render: false, default: true }
2916
- },
2917
- transform(node2, config2) {
2918
- const attributes = node2.transformAttributes(config2);
2919
- const children = node2.children.length ? node2.transformChildren(config2) : [node2.attributes.content];
2920
- return new Tag("pre", attributes, children);
2858
+ return cache;
2859
+ }
2860
+ function decode(string, exclude) {
2861
+ if (typeof exclude !== "string") {
2862
+ exclude = decode.defaultChars;
2921
2863
  }
2922
- };
2923
- var blockquote = {
2924
- render: "blockquote",
2925
- children: [
2926
- "heading",
2927
- "paragraph",
2928
- "image",
2929
- "table",
2930
- "tag",
2931
- "fence",
2932
- "blockquote",
2933
- "list",
2934
- "hr"
2935
- ]
2936
- };
2937
- var item = {
2938
- render: "li",
2939
- children: [
2940
- "inline",
2941
- "heading",
2942
- "paragraph",
2943
- "image",
2944
- "table",
2945
- "tag",
2946
- "fence",
2947
- "blockquote",
2948
- "list",
2949
- "hr"
2950
- ]
2951
- };
2952
- var list = {
2953
- children: ["item"],
2954
- attributes: {
2955
- ordered: { type: Boolean, render: false, required: true },
2956
- start: { type: Number },
2957
- marker: { type: String, render: false }
2958
- },
2959
- transform(node2, config2) {
2960
- return new Tag(
2961
- node2.attributes.ordered ? "ol" : "ul",
2962
- node2.transformAttributes(config2),
2963
- node2.transformChildren(config2)
2964
- );
2965
- }
2966
- };
2967
- var hr = {
2968
- render: "hr"
2969
- };
2970
- var table = {
2971
- render: "table"
2972
- };
2973
- var td = {
2974
- render: "td",
2975
- children: [
2976
- "inline",
2977
- "heading",
2978
- "paragraph",
2979
- "image",
2980
- "table",
2981
- "tag",
2982
- "fence",
2983
- "blockquote",
2984
- "list",
2985
- "hr"
2986
- ],
2987
- attributes: {
2988
- align: { type: String },
2989
- colspan: { type: Number, render: "colSpan" },
2990
- rowspan: { type: Number, render: "rowSpan" }
2991
- }
2992
- };
2993
- var th = {
2994
- render: "th",
2995
- attributes: {
2996
- width: { type: String },
2997
- align: { type: String },
2998
- colspan: { type: Number, render: "colSpan" },
2999
- rowspan: { type: Number, render: "rowSpan" }
3000
- }
3001
- };
3002
- var tr = {
3003
- render: "tr",
3004
- children: ["th", "td"]
3005
- };
3006
- var tbody = {
3007
- render: "tbody",
3008
- children: ["tr", "tag"]
3009
- };
3010
- var thead = {
3011
- render: "thead",
3012
- children: ["tr"]
3013
- };
3014
- var strong = {
3015
- render: "strong",
3016
- children: ["em", "s", "link", "code", "text", "tag"],
3017
- attributes: {
3018
- marker: { type: String, render: false }
3019
- }
3020
- };
3021
- var em = {
3022
- render: "em",
3023
- children: ["strong", "s", "link", "code", "text", "tag"],
3024
- attributes: {
3025
- marker: { type: String, render: false }
3026
- }
3027
- };
3028
- var s = {
3029
- render: "s",
3030
- children: ["strong", "em", "link", "code", "text", "tag"]
3031
- };
3032
- var inline = {
3033
- children: [
3034
- "strong",
3035
- "em",
3036
- "s",
3037
- "code",
3038
- "text",
3039
- "tag",
3040
- "link",
3041
- "image",
3042
- "hardbreak",
3043
- "softbreak",
3044
- "comment"
3045
- ]
3046
- };
3047
- var link = {
3048
- render: "a",
3049
- children: ["strong", "em", "s", "code", "text", "tag"],
3050
- attributes: {
3051
- href: { type: String, required: true },
3052
- title: { type: String }
3053
- }
3054
- };
3055
- var code = {
3056
- render: "code",
3057
- attributes: {
3058
- content: { type: String, render: false, required: true }
3059
- },
3060
- transform(node2, config2) {
3061
- const attributes = node2.transformAttributes(config2);
3062
- return new Tag("code", attributes, [node2.attributes.content]);
3063
- }
3064
- };
3065
- var text = {
3066
- attributes: {
3067
- content: { type: String, required: true }
3068
- },
3069
- transform(node2) {
3070
- return node2.attributes.content;
3071
- }
3072
- };
3073
- var hardbreak = {
3074
- render: "br"
3075
- };
3076
- var softbreak = {
3077
- transform() {
3078
- return " ";
3079
- }
3080
- };
3081
- var comment = {
3082
- attributes: {
3083
- content: { type: String, required: true }
3084
- }
3085
- };
3086
- var error = {};
3087
- var node = {};
3088
-
3089
- // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/index.mjs
3090
- var mdurl_exports = {};
3091
- __export(mdurl_exports, {
3092
- decode: () => decode_default,
3093
- encode: () => encode_default,
3094
- format: () => format2,
3095
- parse: () => parse_default
3096
- });
3097
-
3098
- // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
3099
- var decodeCache = {};
3100
- function getDecodeCache(exclude) {
3101
- let cache = decodeCache[exclude];
3102
- if (cache) {
3103
- return cache;
3104
- }
3105
- cache = decodeCache[exclude] = [];
3106
- for (let i = 0; i < 128; i++) {
3107
- const ch = String.fromCharCode(i);
3108
- cache.push(ch);
3109
- }
3110
- for (let i = 0; i < exclude.length; i++) {
3111
- const ch = exclude.charCodeAt(i);
3112
- cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2);
3113
- }
3114
- return cache;
3115
- }
3116
- function decode(string, exclude) {
3117
- if (typeof exclude !== "string") {
3118
- exclude = decode.defaultChars;
3119
- }
3120
- const cache = getDecodeCache(exclude);
3121
- return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
3122
- let result = "";
3123
- for (let i = 0, l = seq.length; i < l; i += 3) {
3124
- const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
3125
- if (b1 < 128) {
3126
- result += cache[b1];
3127
- continue;
3128
- }
3129
- if ((b1 & 224) === 192 && i + 3 < l) {
3130
- const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
3131
- if ((b2 & 192) === 128) {
3132
- const chr = b1 << 6 & 1984 | b2 & 63;
3133
- if (chr < 128) {
3134
- result += "\uFFFD\uFFFD";
3135
- } else {
3136
- result += String.fromCharCode(chr);
3137
- }
3138
- i += 3;
3139
- continue;
3140
- }
3141
- }
3142
- if ((b1 & 240) === 224 && i + 6 < l) {
3143
- const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
3144
- const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
3145
- if ((b2 & 192) === 128 && (b3 & 192) === 128) {
3146
- const chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
3147
- if (chr < 2048 || chr >= 55296 && chr <= 57343) {
3148
- result += "\uFFFD\uFFFD\uFFFD";
3149
- } else {
3150
- result += String.fromCharCode(chr);
3151
- }
3152
- i += 6;
3153
- continue;
3154
- }
3155
- }
3156
- if ((b1 & 248) === 240 && i + 9 < l) {
3157
- const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
3158
- const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
3159
- const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
3160
- if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
3161
- let chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
3162
- if (chr < 65536 || chr > 1114111) {
3163
- result += "\uFFFD\uFFFD\uFFFD\uFFFD";
3164
- } else {
3165
- chr -= 65536;
3166
- result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
3167
- }
3168
- i += 9;
3169
- continue;
3170
- }
3171
- }
3172
- result += "\uFFFD";
3173
- }
3174
- return result;
3175
- });
3176
- }
3177
- decode.defaultChars = ";/?:@&=+$,#";
3178
- decode.componentChars = "";
3179
- var decode_default = decode;
3180
-
3181
- // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
3182
- var encodeCache = {};
3183
- function getEncodeCache(exclude) {
3184
- let cache = encodeCache[exclude];
3185
- if (cache) {
3186
- return cache;
2864
+ const cache = getDecodeCache(exclude);
2865
+ return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
2866
+ let result = "";
2867
+ for (let i = 0, l = seq.length; i < l; i += 3) {
2868
+ const b1 = parseInt(seq.slice(i + 1, i + 3), 16);
2869
+ if (b1 < 128) {
2870
+ result += cache[b1];
2871
+ continue;
2872
+ }
2873
+ if ((b1 & 224) === 192 && i + 3 < l) {
2874
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
2875
+ if ((b2 & 192) === 128) {
2876
+ const chr = b1 << 6 & 1984 | b2 & 63;
2877
+ if (chr < 128) {
2878
+ result += "\uFFFD\uFFFD";
2879
+ } else {
2880
+ result += String.fromCharCode(chr);
2881
+ }
2882
+ i += 3;
2883
+ continue;
2884
+ }
2885
+ }
2886
+ if ((b1 & 240) === 224 && i + 6 < l) {
2887
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
2888
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
2889
+ if ((b2 & 192) === 128 && (b3 & 192) === 128) {
2890
+ const chr = b1 << 12 & 61440 | b2 << 6 & 4032 | b3 & 63;
2891
+ if (chr < 2048 || chr >= 55296 && chr <= 57343) {
2892
+ result += "\uFFFD\uFFFD\uFFFD";
2893
+ } else {
2894
+ result += String.fromCharCode(chr);
2895
+ }
2896
+ i += 6;
2897
+ continue;
2898
+ }
2899
+ }
2900
+ if ((b1 & 248) === 240 && i + 9 < l) {
2901
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16);
2902
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16);
2903
+ const b4 = parseInt(seq.slice(i + 10, i + 12), 16);
2904
+ if ((b2 & 192) === 128 && (b3 & 192) === 128 && (b4 & 192) === 128) {
2905
+ let chr = b1 << 18 & 1835008 | b2 << 12 & 258048 | b3 << 6 & 4032 | b4 & 63;
2906
+ if (chr < 65536 || chr > 1114111) {
2907
+ result += "\uFFFD\uFFFD\uFFFD\uFFFD";
2908
+ } else {
2909
+ chr -= 65536;
2910
+ result += String.fromCharCode(55296 + (chr >> 10), 56320 + (chr & 1023));
2911
+ }
2912
+ i += 9;
2913
+ continue;
2914
+ }
2915
+ }
2916
+ result += "\uFFFD";
2917
+ }
2918
+ return result;
2919
+ });
2920
+ }
2921
+ decode.defaultChars = ";/?:@&=+$,#";
2922
+ decode.componentChars = "";
2923
+ var decode_default = decode;
2924
+
2925
+ // ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/encode.mjs
2926
+ var encodeCache = {};
2927
+ function getEncodeCache(exclude) {
2928
+ let cache = encodeCache[exclude];
2929
+ if (cache) {
2930
+ return cache;
3187
2931
  }
3188
2932
  cache = encodeCache[exclude] = [];
3189
2933
  for (let i = 0; i < 128; i++) {
@@ -4481,7 +4225,7 @@ var errors = {
4481
4225
  var baseMinusTMin = base - tMin;
4482
4226
  var floor = Math.floor;
4483
4227
  var stringFromCharCode = String.fromCharCode;
4484
- function error2(type) {
4228
+ function error(type) {
4485
4229
  throw new RangeError(errors[type]);
4486
4230
  }
4487
4231
  function map(array, callback) {
@@ -4561,7 +4305,7 @@ var decode2 = function(input) {
4561
4305
  }
4562
4306
  for (let j = 0; j < basic; ++j) {
4563
4307
  if (input.charCodeAt(j) >= 128) {
4564
- error2("not-basic");
4308
+ error("not-basic");
4565
4309
  }
4566
4310
  output.push(input.charCodeAt(j));
4567
4311
  }
@@ -4569,14 +4313,14 @@ var decode2 = function(input) {
4569
4313
  const oldi = i;
4570
4314
  for (let w = 1, k = base; ; k += base) {
4571
4315
  if (index >= inputLength) {
4572
- error2("invalid-input");
4316
+ error("invalid-input");
4573
4317
  }
4574
4318
  const digit = basicToDigit(input.charCodeAt(index++));
4575
4319
  if (digit >= base) {
4576
- error2("invalid-input");
4320
+ error("invalid-input");
4577
4321
  }
4578
4322
  if (digit > floor((maxInt - i) / w)) {
4579
- error2("overflow");
4323
+ error("overflow");
4580
4324
  }
4581
4325
  i += digit * w;
4582
4326
  const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
@@ -4585,14 +4329,14 @@ var decode2 = function(input) {
4585
4329
  }
4586
4330
  const baseMinusT = base - t;
4587
4331
  if (w > floor(maxInt / baseMinusT)) {
4588
- error2("overflow");
4332
+ error("overflow");
4589
4333
  }
4590
4334
  w *= baseMinusT;
4591
4335
  }
4592
4336
  const out = output.length + 1;
4593
4337
  bias = adapt(i - oldi, out, oldi == 0);
4594
4338
  if (floor(i / out) > maxInt - n) {
4595
- error2("overflow");
4339
+ error("overflow");
4596
4340
  }
4597
4341
  n += floor(i / out);
4598
4342
  i %= out;
@@ -4626,13 +4370,13 @@ var encode2 = function(input) {
4626
4370
  }
4627
4371
  const handledCPCountPlusOne = handledCPCount + 1;
4628
4372
  if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
4629
- error2("overflow");
4373
+ error("overflow");
4630
4374
  }
4631
4375
  delta += (m - n) * handledCPCountPlusOne;
4632
4376
  n = m;
4633
4377
  for (const currentValue of input) {
4634
4378
  if (currentValue < n && ++delta > maxInt) {
4635
- error2("overflow");
4379
+ error("overflow");
4636
4380
  }
4637
4381
  if (currentValue === n) {
4638
4382
  let q = delta;
@@ -5600,7 +5344,7 @@ function strip_references(state) {
5600
5344
  }
5601
5345
  if (tokens.length !== last) tokens.length = last;
5602
5346
  }
5603
- function inline2(state) {
5347
+ function inline(state) {
5604
5348
  const tokens = state.tokens;
5605
5349
  for (let i = 0, l = tokens.length; i < l; i++) {
5606
5350
  const tok = tokens[i];
@@ -5899,7 +5643,7 @@ var _rules$2 = [
5899
5643
  ["normalize", normalize],
5900
5644
  ["block", block],
5901
5645
  ["strip_references", strip_references],
5902
- ["inline", inline2],
5646
+ ["inline", inline],
5903
5647
  ["linkify", linkify$1],
5904
5648
  ["replacements", replace],
5905
5649
  ["smartquotes", smartquotes],
@@ -6062,7 +5806,7 @@ function escapedSplit(str) {
6062
5806
  result.push(current + str.substring(lastPos));
6063
5807
  return result;
6064
5808
  }
6065
- function table2(state, startLine, endLine, silent) {
5809
+ function table(state, startLine, endLine, silent) {
6066
5810
  if (startLine + 2 > endLine) return false;
6067
5811
  let nextLine = startLine + 1;
6068
5812
  if (state.sCount[nextLine] < state.blkIndent) return false;
@@ -6165,7 +5909,7 @@ function table2(state, startLine, endLine, silent) {
6165
5909
  state.line = nextLine;
6166
5910
  return true;
6167
5911
  }
6168
- function code2(state, startLine, endLine) {
5912
+ function code(state, startLine, endLine) {
6169
5913
  if (state.sCount[startLine] - state.blkIndent < 4) return false;
6170
5914
  let nextLine = startLine + 1;
6171
5915
  let last = nextLine;
@@ -6187,7 +5931,7 @@ function code2(state, startLine, endLine) {
6187
5931
  token.map = [startLine, state.line];
6188
5932
  return true;
6189
5933
  }
6190
- function fence2(state, startLine, endLine, silent) {
5934
+ function fence(state, startLine, endLine, silent) {
6191
5935
  let pos = state.bMarks[startLine] + state.tShift[startLine];
6192
5936
  let max2 = state.eMarks[startLine];
6193
5937
  if (!state.md.options.allowIndentation && state.sCount[startLine] - state.blkIndent >= 4) return false;
@@ -6230,7 +5974,7 @@ function fence2(state, startLine, endLine, silent) {
6230
5974
  token.map = [startLine, state.line];
6231
5975
  return true;
6232
5976
  }
6233
- function blockquote2(state, startLine, endLine, silent) {
5977
+ function blockquote(state, startLine, endLine, silent) {
6234
5978
  let pos = state.bMarks[startLine] + state.tShift[startLine];
6235
5979
  let max2 = state.eMarks[startLine];
6236
5980
  const oldLineMax = state.lineMax;
@@ -6331,7 +6075,7 @@ function blockquote2(state, startLine, endLine, silent) {
6331
6075
  state.blkIndent = oldIndent;
6332
6076
  return true;
6333
6077
  }
6334
- function hr2(state, startLine, endLine, silent) {
6078
+ function hr(state, startLine, endLine, silent) {
6335
6079
  const max2 = state.eMarks[startLine];
6336
6080
  if (!state.md.options.allowIndentation && state.sCount[startLine] - state.blkIndent >= 4) return false;
6337
6081
  let pos = state.bMarks[startLine] + state.tShift[startLine];
@@ -6392,7 +6136,7 @@ function markTightParagraphs(state, idx) {
6392
6136
  i += 2;
6393
6137
  }
6394
6138
  }
6395
- function list2(state, startLine, endLine, silent) {
6139
+ function list(state, startLine, endLine, silent) {
6396
6140
  let max2, pos, start, token;
6397
6141
  let nextLine = startLine;
6398
6142
  let tight = true;
@@ -6779,7 +6523,7 @@ function html_block(state, startLine, endLine, silent) {
6779
6523
  token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
6780
6524
  return true;
6781
6525
  }
6782
- function heading2(state, startLine, endLine, silent) {
6526
+ function heading(state, startLine, endLine, silent) {
6783
6527
  let pos = state.bMarks[startLine] + state.tShift[startLine];
6784
6528
  let max2 = state.eMarks[startLine];
6785
6529
  if (!state.md.options.allowIndentation && state.sCount[startLine] - state.blkIndent >= 4) return false;
@@ -6859,7 +6603,7 @@ function lheading(state, startLine, endLine) {
6859
6603
  state.parentType = oldParentType;
6860
6604
  return true;
6861
6605
  }
6862
- function paragraph2(state, startLine, endLine) {
6606
+ function paragraph(state, startLine, endLine) {
6863
6607
  const terminatorRules = state.md.block.ruler.getRules("paragraph");
6864
6608
  const oldParentType = state.parentType;
6865
6609
  let nextLine = startLine + 1;
@@ -6889,13 +6633,13 @@ function paragraph2(state, startLine, endLine) {
6889
6633
  var _rules$1 = [
6890
6634
  [
6891
6635
  "table",
6892
- table2,
6636
+ table,
6893
6637
  ["paragraph", "reference"]
6894
6638
  ],
6895
- ["code", code2],
6639
+ ["code", code],
6896
6640
  [
6897
6641
  "fence",
6898
- fence2,
6642
+ fence,
6899
6643
  [
6900
6644
  "paragraph",
6901
6645
  "reference",
@@ -6905,7 +6649,7 @@ var _rules$1 = [
6905
6649
  ],
6906
6650
  [
6907
6651
  "blockquote",
6908
- blockquote2,
6652
+ blockquote,
6909
6653
  [
6910
6654
  "paragraph",
6911
6655
  "reference",
@@ -6915,7 +6659,7 @@ var _rules$1 = [
6915
6659
  ],
6916
6660
  [
6917
6661
  "hr",
6918
- hr2,
6662
+ hr,
6919
6663
  [
6920
6664
  "paragraph",
6921
6665
  "reference",
@@ -6925,7 +6669,7 @@ var _rules$1 = [
6925
6669
  ],
6926
6670
  [
6927
6671
  "list",
6928
- list2,
6672
+ list,
6929
6673
  [
6930
6674
  "paragraph",
6931
6675
  "reference",
@@ -6944,7 +6688,7 @@ var _rules$1 = [
6944
6688
  ],
6945
6689
  [
6946
6690
  "heading",
6947
- heading2,
6691
+ heading,
6948
6692
  [
6949
6693
  "paragraph",
6950
6694
  "reference",
@@ -6952,7 +6696,7 @@ var _rules$1 = [
6952
6696
  ]
6953
6697
  ],
6954
6698
  ["lheading", lheading],
6955
- ["paragraph", paragraph2]
6699
+ ["paragraph", paragraph]
6956
6700
  ];
6957
6701
  var ParserBlock = class {
6958
6702
  constructor() {
@@ -7124,7 +6868,7 @@ function isTerminatorChar(ch) {
7124
6868
  return false;
7125
6869
  }
7126
6870
  }
7127
- function text2(state, silent) {
6871
+ function text(state, silent) {
7128
6872
  let pos = state.pos;
7129
6873
  while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) pos++;
7130
6874
  if (pos === state.pos) return false;
@@ -7437,7 +7181,7 @@ var emphasis_default = {
7437
7181
  tokenize: emphasis_tokenize,
7438
7182
  postProcess: emphasis_post_process
7439
7183
  };
7440
- function link2(state, silent) {
7184
+ function link(state, silent) {
7441
7185
  let code3, label, res, ref;
7442
7186
  let href = "";
7443
7187
  let title = "";
@@ -7521,7 +7265,7 @@ function link2(state, silent) {
7521
7265
  state.posMax = max2;
7522
7266
  return true;
7523
7267
  }
7524
- function image2(state, silent) {
7268
+ function image(state, silent) {
7525
7269
  let code3, content, label, pos, ref, res, title, start;
7526
7270
  let href = "";
7527
7271
  const oldPos = state.pos;
@@ -7798,15 +7542,15 @@ function fragments_join(state) {
7798
7542
  if (curr !== last) tokens.length = last;
7799
7543
  }
7800
7544
  var _rules = [
7801
- ["text", text2],
7545
+ ["text", text],
7802
7546
  ["linkify", linkify],
7803
7547
  ["newline", newline],
7804
7548
  ["escape", escape],
7805
7549
  ["backticks", backtick],
7806
7550
  ["strikethrough", strikethrough_default.tokenize],
7807
7551
  ["emphasis", emphasis_default.tokenize],
7808
- ["link", link2],
7809
- ["image", image2],
7552
+ ["link", link],
7553
+ ["image", image],
7810
7554
  ["autolink", autolink],
7811
7555
  ["html_inline", html_inline],
7812
7556
  ["entity", entity]
@@ -8348,16 +8092,19 @@ var voidElements = /* @__PURE__ */ new Set([
8348
8092
  "track",
8349
8093
  "wbr"
8350
8094
  ]);
8095
+ var tagName = /^[a-zA-Z][^\s/>\0]*$/;
8096
+ var attributeName = /^[^\s"'>/=\0]+$/;
8351
8097
  function render(node2) {
8352
8098
  if (typeof node2 === "string" || typeof node2 === "number")
8353
8099
  return escapeHtml2(String(node2));
8354
8100
  if (Array.isArray(node2)) return node2.map(render).join("");
8355
8101
  if (node2 === null || typeof node2 !== "object" || !Tag.isTag(node2)) return "";
8356
8102
  const { name, attributes, children = [] } = node2;
8357
- if (!name) return render(children);
8103
+ if (!name || !tagName.test(name)) return render(children);
8358
8104
  let output = `<${name}`;
8359
8105
  for (const [k, v] of Object.entries(attributes ?? {}))
8360
- output += ` ${k.toLowerCase()}="${escapeHtml2(String(v))}"`;
8106
+ if (v != null && attributeName.test(k))
8107
+ output += ` ${k.toLowerCase()}="${escapeHtml2(String(v))}"`;
8361
8108
  output += ">";
8362
8109
  if (voidElements.has(name)) return output;
8363
8110
  if (children.length) output += render(children);
@@ -8366,10 +8113,10 @@ function render(node2) {
8366
8113
  }
8367
8114
 
8368
8115
  // src/renderers/react/react.ts
8369
- function tagName(name, components) {
8116
+ function tagName2(name, components) {
8370
8117
  return typeof name !== "string" ? name : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
8371
8118
  }
8372
- function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {}) {
8119
+ function dynamic(node2, React, { components = {}, resolveTagName = tagName2 } = {}) {
8373
8120
  function deepRender2(value) {
8374
8121
  if (value == null || typeof value !== "object") return value;
8375
8122
  if (Array.isArray(value)) return value.map((item2) => deepRender2(item2));
@@ -8393,7 +8140,7 @@ function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {
8393
8140
  if (className) attrs.className = className;
8394
8141
  return React.createElement(
8395
8142
  resolveTagName(name, components),
8396
- Object.keys(attrs).length == 0 ? null : deepRender2(attrs),
8143
+ Object.keys(attrs).length === 0 ? null : deepRender2(attrs),
8397
8144
  ...children.map(render3)
8398
8145
  );
8399
8146
  }
@@ -8401,7 +8148,7 @@ function dynamic(node2, React, { components = {}, resolveTagName = tagName } = {
8401
8148
  }
8402
8149
 
8403
8150
  // src/renderers/react/static.ts
8404
- function tagName2(name, components) {
8151
+ function tagName3(name, components) {
8405
8152
  return typeof name !== "string" ? "Fragment" : name[0] !== name[0].toUpperCase() ? name : components instanceof Function ? components(name) : components[name];
8406
8153
  }
8407
8154
  function renderArray(children) {
@@ -8429,10 +8176,10 @@ function render2(node2) {
8429
8176
  if (className) attrs.className = className;
8430
8177
  return `React.createElement(
8431
8178
  tagName(${JSON.stringify(name)}, components),
8432
- ${Object.keys(attrs).length == 0 ? "null" : deepRender(attrs)},
8179
+ ${Object.keys(attrs).length === 0 ? "null" : deepRender(attrs)},
8433
8180
  ${renderArray(children)})`;
8434
8181
  }
8435
- function reactStatic(node2, { resolveTagName = tagName2 } = {}) {
8182
+ function reactStatic(node2, { resolveTagName = tagName3 } = {}) {
8436
8183
  if (resolveTagName.name !== "tagName") {
8437
8184
  throw new Error("resolveTagName must be named tagName");
8438
8185
  }
@@ -8447,6 +8194,263 @@ function reactStatic(node2, { resolveTagName = tagName2 } = {}) {
8447
8194
  // src/renderers/index.ts
8448
8195
  var renderers_default = { html: render, react: dynamic, reactStatic };
8449
8196
 
8197
+ // src/schema.ts
8198
+ var schema_exports = {};
8199
+ __export(schema_exports, {
8200
+ blockquote: () => blockquote2,
8201
+ code: () => code2,
8202
+ comment: () => comment,
8203
+ document: () => document,
8204
+ em: () => em,
8205
+ error: () => error2,
8206
+ fence: () => fence2,
8207
+ hardbreak: () => hardbreak,
8208
+ heading: () => heading2,
8209
+ hr: () => hr2,
8210
+ image: () => image2,
8211
+ inline: () => inline2,
8212
+ item: () => item,
8213
+ link: () => link2,
8214
+ list: () => list2,
8215
+ node: () => node,
8216
+ paragraph: () => paragraph2,
8217
+ s: () => s,
8218
+ softbreak: () => softbreak,
8219
+ strong: () => strong,
8220
+ table: () => table2,
8221
+ tbody: () => tbody,
8222
+ td: () => td,
8223
+ text: () => text2,
8224
+ th: () => th,
8225
+ thead: () => thead,
8226
+ tr: () => tr
8227
+ });
8228
+ var document = {
8229
+ render: "article",
8230
+ children: [
8231
+ "heading",
8232
+ "paragraph",
8233
+ "image",
8234
+ "table",
8235
+ "tag",
8236
+ "fence",
8237
+ "blockquote",
8238
+ "comment",
8239
+ "list",
8240
+ "hr"
8241
+ ],
8242
+ attributes: {
8243
+ frontmatter: { render: false }
8244
+ }
8245
+ };
8246
+ var heading2 = {
8247
+ children: ["inline"],
8248
+ attributes: {
8249
+ level: { type: Number, render: false, required: true }
8250
+ },
8251
+ transform(node2, config2) {
8252
+ const level = node2.attributes["level"];
8253
+ if (!(Number.isInteger(level) && level >= 1 && level <= 6))
8254
+ return node2.transformChildren(config2);
8255
+ return new Tag(
8256
+ `h${level}`,
8257
+ node2.transformAttributes(config2),
8258
+ node2.transformChildren(config2)
8259
+ );
8260
+ }
8261
+ };
8262
+ var paragraph2 = {
8263
+ render: "p",
8264
+ children: ["inline"]
8265
+ };
8266
+ var image2 = {
8267
+ render: "img",
8268
+ attributes: {
8269
+ src: { type: String, required: true },
8270
+ alt: { type: String },
8271
+ title: { type: String }
8272
+ // width/height attributes will need to be to be implemented as an extension to markdown-it
8273
+ }
8274
+ };
8275
+ var fence2 = {
8276
+ render: "pre",
8277
+ attributes: {
8278
+ content: { type: String, render: false, required: true },
8279
+ language: { type: String, render: "data-language" },
8280
+ process: { type: Boolean, render: false, default: true }
8281
+ },
8282
+ transform(node2, config2) {
8283
+ const attributes = node2.transformAttributes(config2);
8284
+ const children = node2.children.length ? node2.transformChildren(config2) : [node2.attributes.content];
8285
+ return new Tag("pre", attributes, children);
8286
+ }
8287
+ };
8288
+ var blockquote2 = {
8289
+ render: "blockquote",
8290
+ children: [
8291
+ "heading",
8292
+ "paragraph",
8293
+ "image",
8294
+ "table",
8295
+ "tag",
8296
+ "fence",
8297
+ "blockquote",
8298
+ "list",
8299
+ "hr"
8300
+ ]
8301
+ };
8302
+ var item = {
8303
+ render: "li",
8304
+ children: [
8305
+ "inline",
8306
+ "heading",
8307
+ "paragraph",
8308
+ "image",
8309
+ "table",
8310
+ "tag",
8311
+ "fence",
8312
+ "blockquote",
8313
+ "list",
8314
+ "hr"
8315
+ ]
8316
+ };
8317
+ var list2 = {
8318
+ children: ["item"],
8319
+ attributes: {
8320
+ ordered: { type: Boolean, render: false, required: true },
8321
+ start: { type: Number },
8322
+ marker: { type: String, render: false }
8323
+ },
8324
+ transform(node2, config2) {
8325
+ return new Tag(
8326
+ node2.attributes.ordered ? "ol" : "ul",
8327
+ node2.transformAttributes(config2),
8328
+ node2.transformChildren(config2)
8329
+ );
8330
+ }
8331
+ };
8332
+ var hr2 = {
8333
+ render: "hr"
8334
+ };
8335
+ var table2 = {
8336
+ render: "table"
8337
+ };
8338
+ var td = {
8339
+ render: "td",
8340
+ children: [
8341
+ "inline",
8342
+ "heading",
8343
+ "paragraph",
8344
+ "image",
8345
+ "table",
8346
+ "tag",
8347
+ "fence",
8348
+ "blockquote",
8349
+ "list",
8350
+ "hr"
8351
+ ],
8352
+ attributes: {
8353
+ align: { type: String },
8354
+ colspan: { type: Number, render: "colSpan" },
8355
+ rowspan: { type: Number, render: "rowSpan" }
8356
+ }
8357
+ };
8358
+ var th = {
8359
+ render: "th",
8360
+ attributes: {
8361
+ width: { type: String },
8362
+ align: { type: String },
8363
+ colspan: { type: Number, render: "colSpan" },
8364
+ rowspan: { type: Number, render: "rowSpan" }
8365
+ }
8366
+ };
8367
+ var tr = {
8368
+ render: "tr",
8369
+ children: ["th", "td"]
8370
+ };
8371
+ var tbody = {
8372
+ render: "tbody",
8373
+ children: ["tr", "tag"]
8374
+ };
8375
+ var thead = {
8376
+ render: "thead",
8377
+ children: ["tr"]
8378
+ };
8379
+ var strong = {
8380
+ render: "strong",
8381
+ children: ["em", "s", "link", "code", "text", "tag"],
8382
+ attributes: {
8383
+ marker: { type: String, render: false }
8384
+ }
8385
+ };
8386
+ var em = {
8387
+ render: "em",
8388
+ children: ["strong", "s", "link", "code", "text", "tag"],
8389
+ attributes: {
8390
+ marker: { type: String, render: false }
8391
+ }
8392
+ };
8393
+ var s = {
8394
+ render: "s",
8395
+ children: ["strong", "em", "link", "code", "text", "tag"]
8396
+ };
8397
+ var inline2 = {
8398
+ children: [
8399
+ "strong",
8400
+ "em",
8401
+ "s",
8402
+ "code",
8403
+ "text",
8404
+ "tag",
8405
+ "link",
8406
+ "image",
8407
+ "hardbreak",
8408
+ "softbreak",
8409
+ "comment"
8410
+ ]
8411
+ };
8412
+ var link2 = {
8413
+ render: "a",
8414
+ children: ["strong", "em", "s", "code", "text", "tag"],
8415
+ attributes: {
8416
+ href: { type: String, required: true },
8417
+ title: { type: String }
8418
+ }
8419
+ };
8420
+ var code2 = {
8421
+ render: "code",
8422
+ attributes: {
8423
+ content: { type: String, render: false, required: true }
8424
+ },
8425
+ transform(node2, config2) {
8426
+ const attributes = node2.transformAttributes(config2);
8427
+ return new Tag("code", attributes, [node2.attributes.content]);
8428
+ }
8429
+ };
8430
+ var text2 = {
8431
+ attributes: {
8432
+ content: { type: String, required: true }
8433
+ },
8434
+ transform(node2) {
8435
+ return node2.attributes.content;
8436
+ }
8437
+ };
8438
+ var hardbreak = {
8439
+ render: "br"
8440
+ };
8441
+ var softbreak = {
8442
+ transform() {
8443
+ return " ";
8444
+ }
8445
+ };
8446
+ var comment = {
8447
+ attributes: {
8448
+ content: { type: String, required: true }
8449
+ }
8450
+ };
8451
+ var error2 = {};
8452
+ var node = {};
8453
+
8450
8454
  // src/tags/partial.ts
8451
8455
  var PartialFile = class {
8452
8456
  validate(file, config2) {
@@ -8488,12 +8492,6 @@ var partial = {
8488
8492
  }
8489
8493
  };
8490
8494
 
8491
- // src/tags/table.ts
8492
- var table3 = {
8493
- children: ["table"],
8494
- inline: false
8495
- };
8496
-
8497
8495
  // src/tags/slot.ts
8498
8496
  var slot = {
8499
8497
  attributes: {
@@ -8501,6 +8499,12 @@ var slot = {
8501
8499
  }
8502
8500
  };
8503
8501
 
8502
+ // src/tags/table.ts
8503
+ var table3 = {
8504
+ children: ["table"],
8505
+ inline: false
8506
+ };
8507
+
8504
8508
  // src/tags/index.ts
8505
8509
  var tags_default = {
8506
8510
  else: tagElse,
@@ -8537,7 +8541,7 @@ function createToken(state, content, contentStart) {
8537
8541
  return token;
8538
8542
  }
8539
8543
  }
8540
- function block2(state, startLine, endLine, silent) {
8544
+ function block2(state, startLine, _endLine, silent) {
8541
8545
  const start = state.bMarks[startLine] + state.tShift[startLine];
8542
8546
  const finish = state.eMarks[startLine];
8543
8547
  if (!state.src.startsWith(OPEN, start)) return false;
@@ -8603,35 +8607,10 @@ function plugin(md) {
8603
8607
  md.core.ruler.push("annotations", core);
8604
8608
  }
8605
8609
 
8606
- // src/tokenizer/plugins/frontmatter.ts
8607
- var fence3 = "---";
8608
- function getLine2(state, n) {
8609
- return state.src.slice(state.bMarks[n], state.eMarks[n]).trim();
8610
- }
8611
- function findClose(state, endLine) {
8612
- for (let line = 1; line < endLine; line++)
8613
- if (getLine2(state, line) === fence3) return line;
8614
- }
8615
- function block3(state, startLine, endLine, silent) {
8616
- if (startLine != 0 || getLine2(state, 0) != fence3) return false;
8617
- const close = findClose(state, endLine);
8618
- if (!close) return false;
8619
- if (silent) return true;
8620
- const token = state.push("frontmatter", "", 0);
8621
- token.content = state.src.slice(state.eMarks[0], state.bMarks[close]).trim();
8622
- token.map = [0, close];
8623
- token.hidden = true;
8624
- state.line = close + 1;
8625
- return true;
8626
- }
8627
- function plugin2(md) {
8628
- md.block.ruler.before("hr", "frontmatter", block3);
8629
- }
8630
-
8631
8610
  // src/tokenizer/plugins/comments.ts
8632
8611
  var OPEN2 = "<!--";
8633
8612
  var CLOSE2 = "-->";
8634
- function block4(state, startLine, endLine, silent) {
8613
+ function block3(state, startLine, _endLine, silent) {
8635
8614
  const start = state.bMarks[startLine] + state.tShift[startLine];
8636
8615
  if (!state.src.startsWith(OPEN2, start)) return false;
8637
8616
  const close = state.src.indexOf(CLOSE2, start);
@@ -8656,11 +8635,36 @@ function inline4(state, silent) {
8656
8635
  state.pos = close + CLOSE2.length;
8657
8636
  return true;
8658
8637
  }
8659
- function plugin3(md) {
8660
- md.block.ruler.before("table", "comment", block4, { alt: ["paragraph"] });
8638
+ function plugin2(md) {
8639
+ md.block.ruler.before("table", "comment", block3, { alt: ["paragraph"] });
8661
8640
  md.inline.ruler.push("comment", inline4);
8662
8641
  }
8663
8642
 
8643
+ // src/tokenizer/plugins/frontmatter.ts
8644
+ var fence3 = "---";
8645
+ function getLine2(state, n) {
8646
+ return state.src.slice(state.bMarks[n], state.eMarks[n]).trim();
8647
+ }
8648
+ function findClose(state, endLine) {
8649
+ for (let line = 1; line < endLine; line++)
8650
+ if (getLine2(state, line) === fence3) return line;
8651
+ }
8652
+ function block4(state, startLine, endLine, silent) {
8653
+ if (startLine !== 0 || getLine2(state, 0) !== fence3) return false;
8654
+ const close = findClose(state, endLine);
8655
+ if (!close) return false;
8656
+ if (silent) return true;
8657
+ const token = state.push("frontmatter", "", 0);
8658
+ token.content = state.src.slice(state.eMarks[0], state.bMarks[close]).trim();
8659
+ token.map = [0, close];
8660
+ token.hidden = true;
8661
+ state.line = close + 1;
8662
+ return true;
8663
+ }
8664
+ function plugin3(md) {
8665
+ md.block.ruler.before("hr", "frontmatter", block4);
8666
+ }
8667
+
8664
8668
  // src/tokenizer/plugins/link.ts
8665
8669
  var INVALID_HREF_MESSAGE = "The 'href' format cannot contain Markdoc tag or variable. URLs must be static strings.";
8666
8670
  function pushHrefError(token) {
@@ -8689,13 +8693,13 @@ var Tokenizer = class {
8689
8693
  constructor(config2 = {}) {
8690
8694
  this.parser = new MarkdownItCallable(config2);
8691
8695
  this.parser.use(plugin);
8692
- this.parser.use(plugin2);
8696
+ this.parser.use(plugin3);
8693
8697
  this.parser.disable([
8694
8698
  "lheading",
8695
8699
  // Disable indented `code_block` support https://spec.commonmark.org/0.30/#indented-code-block
8696
8700
  "code"
8697
8701
  ]);
8698
- if (config2.allowComments) this.parser.use(plugin3);
8702
+ if (config2.allowComments) this.parser.use(plugin2);
8699
8703
  if (config2.allowLinkValidation) {
8700
8704
  this.parser.use(
8701
8705
  plugin4,
@@ -8804,7 +8808,7 @@ function validator(node2, config2) {
8804
8808
  });
8805
8809
  return errors2;
8806
8810
  }
8807
- if (schema.inline != void 0 && node2.inline !== schema.inline)
8811
+ if (schema.inline != null && node2.inline !== schema.inline)
8808
8812
  errors2.push({
8809
8813
  id: "tag-placement-invalid",
8810
8814
  level: "critical",
@@ -8898,7 +8902,8 @@ function validator(node2, config2) {
8898
8902
  }
8899
8903
  }
8900
8904
  for (const [key, { required }] of Object.entries(attributes))
8901
- if (required && (!Object.prototype.hasOwnProperty.call(node2.attributes, key) || node2.attributes[key] === void 0))
8905
+ if (required && // biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn requires ES2022; Markdoc targets ES2021.
8906
+ (!Object.prototype.hasOwnProperty.call(node2.attributes, key) || node2.attributes[key] === void 0))
8902
8907
  errors2.push({
8903
8908
  id: "attribute-missing-required",
8904
8909
  level: "error",