intlayer-editor 8.4.9 → 8.5.0

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 (168) hide show
  1. package/client/dist/assets/{CodeBlockShiki-67WBbfIc.js → CodeBlockShiki-D9plzEFQ.js} +19 -19
  2. package/client/dist/assets/{markdown-CTJeKACB.js → MarkdownRendererPlugin-Dp6Cig6u.js} +1 -3
  3. package/client/dist/assets/{angular-html-BM_ZCyla.js → angular-html-CB13AsOD.js} +1 -1
  4. package/client/dist/assets/angular-html-DBLVmRwL.js +2 -0
  5. package/client/dist/assets/angular-ts-C9ELUJYv.js +2 -0
  6. package/client/dist/assets/{angular-ts-DqRX8wMA.js → angular-ts-CCw7GlcU.js} +2 -2
  7. package/client/dist/assets/{astro-CkdCbF1_.js → astro-DvvtD-Rg.js} +6 -6
  8. package/client/dist/assets/astro-sNYlBERO.js +2 -0
  9. package/client/dist/assets/bash-WEGyGKlK.js +2 -0
  10. package/client/dist/assets/{blade-BEaXVVTN.js → blade-Bcf_-uRd.js} +7 -7
  11. package/client/dist/assets/{bundle-web-BoGO2r50.js → bundle-web-CuX3_94g.js} +123 -123
  12. package/client/dist/assets/{coffee-BK7D_9TJ.js → coffee-Dzs5FG7f.js} +1 -1
  13. package/client/dist/assets/{cpp-Cj5FPunD.js → cpp-DfI8x_Jv.js} +3 -3
  14. package/client/dist/assets/github-dark-BwJSAZXP.js +2 -0
  15. package/client/dist/assets/github-light-CZ2m4Dvz.js +2 -0
  16. package/client/dist/assets/{glsl-DbTpOla8.js → glsl-BeVtM66e.js} +1 -1
  17. package/client/dist/assets/{graphql-CFTxnidw.js → graphql-DtJo7-ib.js} +4 -4
  18. package/client/dist/assets/{haml-Etn0zJDh.js → haml-jUAPySRR.js} +2 -2
  19. package/client/dist/assets/{handlebars-BhgCuzVS.js → handlebars-AKXGiWPl.js} +4 -4
  20. package/client/dist/assets/{html-CCCEs_Bv.js → html-BOf-Tl1v.js} +2 -2
  21. package/client/dist/assets/html-DLt87G20.js +2 -0
  22. package/client/dist/assets/{html-derivative-CO0wJIjq.js → html-derivative-ChmB54qu.js} +1 -1
  23. package/client/dist/assets/{http-Bmj4spwi.js → http-yMcKwhsE.js} +4 -4
  24. package/client/dist/assets/{hurl-6-TByIM2.js → hurl-BTK0AsDR.js} +3 -3
  25. package/client/dist/assets/{index-Bp3XDFNZ.js → index-CDOIYDRk.js} +2055 -160
  26. package/client/dist/assets/javascript-Bj8xG5Bf.js +2 -0
  27. package/client/dist/assets/{jinja-rQp8qLvE.js → jinja-O1M0YxgI.js} +1 -1
  28. package/client/dist/assets/{jison-BCwhj_ML.js → jison--O2q3sdA.js} +1 -1
  29. package/client/dist/assets/json-DJtgMbAe.js +2 -0
  30. package/client/dist/assets/json5-O7Bjs0LT.js +2 -0
  31. package/client/dist/assets/{julia-B2VuuhWl.js → julia-BeMhktm_.js} +5 -5
  32. package/client/dist/assets/{marko-4S35sSN6.js → marko-C0SPr5bb.js} +4 -4
  33. package/client/dist/assets/{mdc-DlTNfvFt.js → mdc-DbE3_yUC.js} +3 -3
  34. package/client/dist/assets/{php-DB65R2Uy.js → php-DJp3piDR.js} +6 -6
  35. package/client/dist/assets/{pug-BAyu4mFq.js → pug-CAxO-nBL.js} +3 -3
  36. package/client/dist/assets/{scss-CxXwC3kk.js → scss-8p7XvvO5.js} +1 -1
  37. package/client/dist/assets/{svelte-DFw1MVKo.js → svelte-CWntjIRI.js} +4 -4
  38. package/client/dist/assets/{ts-tags-DM2w6MxD.js → ts-tags-BpU3THeZ.js} +7 -7
  39. package/client/dist/assets/tsx-BFOKZky4.js +2 -0
  40. package/client/dist/assets/typescript-BapAS8lG.js +2 -0
  41. package/client/dist/assets/vue-B4mAn0SQ.js +2 -0
  42. package/client/dist/assets/{vue-html-CR5m8MHZ.js → vue-html-CMWsrORU.js} +1 -1
  43. package/client/dist/assets/{vue-vine-BYvN5PTQ.js → vue-vine-CR6wdmCv.js} +6 -6
  44. package/client/dist/assets/{vue-DmjyuR1L.js → vue-y9u52Whf.js} +6 -6
  45. package/client/dist/assets/{xml-Dhp528oL.js → xml-0-pa_Fkm.js} +1 -1
  46. package/client/dist/assets/xml-lldD3Wzd.js +2 -0
  47. package/client/dist/assets/yaml-D0P8Qywa.js +2 -0
  48. package/client/dist/index.html +1 -2
  49. package/package.json +16 -16
  50. package/server/dist/controllers/dictionary.controller.cjs +2 -2
  51. package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
  52. package/server/dist/controllers/dictionary.controller.mjs +1 -1
  53. package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
  54. package/server/dist/index.cjs +1 -1
  55. package/server/dist/index.mjs +1 -1
  56. package/client/dist/assets/angular-html-C2F054WI.js +0 -2
  57. package/client/dist/assets/angular-ts-Cz6dsdSL.js +0 -2
  58. package/client/dist/assets/astro-DGMy7KxP.js +0 -2
  59. package/client/dist/assets/bash-BWdKwdYN.js +0 -2
  60. package/client/dist/assets/github-dark-DjE1AI-9.js +0 -2
  61. package/client/dist/assets/github-light-DCNM04R5.js +0 -2
  62. package/client/dist/assets/html-DrSs4l3z.js +0 -2
  63. package/client/dist/assets/javascript-Bs8XepnI.js +0 -2
  64. package/client/dist/assets/json-DbF4Kor7.js +0 -2
  65. package/client/dist/assets/json5-NmhLttum.js +0 -2
  66. package/client/dist/assets/markdown-B_VAQu_B.js +0 -1836
  67. package/client/dist/assets/tsx-PEwFZ5yP.js +0 -2
  68. package/client/dist/assets/typescript-CPXT2C7m.js +0 -2
  69. package/client/dist/assets/vue-DWxSlKOa.js +0 -2
  70. package/client/dist/assets/xml-Bmtn0lke.js +0 -2
  71. package/client/dist/assets/yaml-BxjKXxGe.js +0 -2
  72. package/client/dist/assets/{html-CC2iD1GB.js → HTMLRendererPlugin-B6Eld7in.js} +5 -5
  73. /package/client/dist/assets/{andromeeda-D9tXBqC-.js → andromeeda-hO5jhASl.js} +0 -0
  74. /package/client/dist/assets/{aurora-x-C104ZGur.js → aurora-x-DYBabLdU.js} +0 -0
  75. /package/client/dist/assets/{ayu-dark-DWpCtGc6.js → ayu-dark-CGCXRUno.js} +0 -0
  76. /package/client/dist/assets/{ayu-light-CECQ0nGX.js → ayu-light-CJW_tG2g.js} +0 -0
  77. /package/client/dist/assets/{ayu-mirage-COuDN4ns.js → ayu-mirage-DqhgbLpq.js} +0 -0
  78. /package/client/dist/assets/{c-CYANehHB.js → c-DNoS3b9n.js} +0 -0
  79. /package/client/dist/assets/{catppuccin-frappe-h7rVaSlW.js → catppuccin-frappe-D5Ih2hdC.js} +0 -0
  80. /package/client/dist/assets/{catppuccin-latte-DuYSKRbe.js → catppuccin-latte-L9Sf5v9D.js} +0 -0
  81. /package/client/dist/assets/{catppuccin-macchiato-oQGqG0MQ.js → catppuccin-macchiato-BqPOcSaP.js} +0 -0
  82. /package/client/dist/assets/{catppuccin-mocha-D7aZCK2q.js → catppuccin-mocha-BAyTggB4.js} +0 -0
  83. /package/client/dist/assets/{css-DtRQGyK-.js → css-OihuGpvm.js} +0 -0
  84. /package/client/dist/assets/{csv-B9m8dC01.js → csv-CroPVNz4.js} +0 -0
  85. /package/client/dist/assets/{dark-plus-py6_0-oZ.js → dark-plus-C_wf8Ao2.js} +0 -0
  86. /package/client/dist/assets/{dist-B9LA40uC.js → dist-D8J9DkzO.js} +0 -0
  87. /package/client/dist/assets/{dracula-KE0gm51O.js → dracula-Be8Pz_27.js} +0 -0
  88. /package/client/dist/assets/{dracula-soft-B8U_ir5T.js → dracula-soft-BE3WBpNy.js} +0 -0
  89. /package/client/dist/assets/{everforest-dark-B2JgZR5v.js → everforest-dark-DgE6uJFn.js} +0 -0
  90. /package/client/dist/assets/{everforest-light-yiC4xIKi.js → everforest-light-7lFM_F2N.js} +0 -0
  91. /package/client/dist/assets/{github-dark-Dls1MHlQ.js → github-dark-Bqr3wypA.js} +0 -0
  92. /package/client/dist/assets/{github-dark-default-cvKXPsGo.js → github-dark-default-Bk8amvZh.js} +0 -0
  93. /package/client/dist/assets/{github-dark-dimmed-K3wk9czK.js → github-dark-dimmed-D0ohZRzn.js} +0 -0
  94. /package/client/dist/assets/{github-dark-high-contrast-BljHNUFs.js → github-dark-high-contrast-DSW7NhP6.js} +0 -0
  95. /package/client/dist/assets/{github-light-DssNX3QF.js → github-light-DLfy9Pka.js} +0 -0
  96. /package/client/dist/assets/{github-light-default-CqDRRARt.js → github-light-default-D1WSOdh0.js} +0 -0
  97. /package/client/dist/assets/{github-light-high-contrast-MgohVKyD.js → github-light-high-contrast-CxTSUXG2.js} +0 -0
  98. /package/client/dist/assets/{gruvbox-dark-hard-D-zn943j.js → gruvbox-dark-hard-CnJdJSQC.js} +0 -0
  99. /package/client/dist/assets/{gruvbox-dark-medium-DJ8_rVKi.js → gruvbox-dark-medium-DtSzz1hF.js} +0 -0
  100. /package/client/dist/assets/{gruvbox-dark-soft-DYdEaxoi.js → gruvbox-dark-soft-5m-HFbUp.js} +0 -0
  101. /package/client/dist/assets/{gruvbox-light-hard-BRbDZM7a.js → gruvbox-light-hard-Cq-lsuZD.js} +0 -0
  102. /package/client/dist/assets/{gruvbox-light-medium-B44e04Yo.js → gruvbox-light-medium-Cg_1ZxY6.js} +0 -0
  103. /package/client/dist/assets/{gruvbox-light-soft-DwzQ4IYg.js → gruvbox-light-soft-Bw7bDwNH.js} +0 -0
  104. /package/client/dist/assets/{horizon-ZzEu6UnM.js → horizon-D_9nR5mx.js} +0 -0
  105. /package/client/dist/assets/{horizon-bright-MN7Rxqk4.js → horizon-bright-Bzw9PPoZ.js} +0 -0
  106. /package/client/dist/assets/{houston-DbO_nj2G.js → houston-CHx-axEj.js} +0 -0
  107. /package/client/dist/assets/{imba-Dtz0Qjpr.js → imba-C6xgaoRA.js} +0 -0
  108. /package/client/dist/assets/{java-f1kHgyCw.js → java-BQH-XPpo.js} +0 -0
  109. /package/client/dist/assets/{javascript-0MR7cko_.js → javascript-J1IWIneD.js} +0 -0
  110. /package/client/dist/assets/{json-CeFRQoKt.js → json-C2t2Y3XK.js} +0 -0
  111. /package/client/dist/assets/{json5-Db2KhhlZ.js → json5-CbjC9xwy.js} +0 -0
  112. /package/client/dist/assets/{jsonc-CHN8QUfU.js → jsonc-BOXsj9el.js} +0 -0
  113. /package/client/dist/assets/{jsonl-CGjv98wH.js → jsonl-VrRBFCbQ.js} +0 -0
  114. /package/client/dist/assets/{jsx-Bqp17Gdp.js → jsx-BpEpKz6X.js} +0 -0
  115. /package/client/dist/assets/{kanagawa-dragon-B7DwHOPg.js → kanagawa-dragon-DgfKNqgM.js} +0 -0
  116. /package/client/dist/assets/{kanagawa-lotus-wvBYqRx0.js → kanagawa-lotus-CZl83ZkH.js} +0 -0
  117. /package/client/dist/assets/{kanagawa-wave-Dm7q3hJz.js → kanagawa-wave-B-IXJK_D.js} +0 -0
  118. /package/client/dist/assets/{laserwave-CPDGEaT_.js → laserwave-WTVf4MDz.js} +0 -0
  119. /package/client/dist/assets/{less-DXhlwFaK.js → less-D1WDSXXK.js} +0 -0
  120. /package/client/dist/assets/{light-plus-ByxFuNBG.js → light-plus-wB3HHb57.js} +0 -0
  121. /package/client/dist/assets/{markdown-DLj4nrva.js → markdown-BGjF3M3Z.js} +0 -0
  122. /package/client/dist/assets/{material-theme-53qDBBiZ.js → material-theme-7dk3Vek5.js} +0 -0
  123. /package/client/dist/assets/{material-theme-darker-BMgigqK-.js → material-theme-darker-UFRC_EiD.js} +0 -0
  124. /package/client/dist/assets/{material-theme-lighter-Du7QlnOy.js → material-theme-lighter-CXTDxR3K.js} +0 -0
  125. /package/client/dist/assets/{material-theme-ocean-D7OelWl-.js → material-theme-ocean-Rd_lleaT.js} +0 -0
  126. /package/client/dist/assets/{material-theme-palenight-DuU45xLi.js → material-theme-palenight-ClkrK8J4.js} +0 -0
  127. /package/client/dist/assets/{mdx-CA-fbmGc.js → mdx-iXfLqJGi.js} +0 -0
  128. /package/client/dist/assets/{min-dark-DaQKcOrv.js → min-dark-BZt9LRdr.js} +0 -0
  129. /package/client/dist/assets/{min-light-B8hhGQs9.js → min-light-Bp3XubLF.js} +0 -0
  130. /package/client/dist/assets/{monokai-BxMUzvLk.js → monokai-DoeoUkNO.js} +0 -0
  131. /package/client/dist/assets/{night-owl-BkjnEots.js → night-owl-DaaszxSn.js} +0 -0
  132. /package/client/dist/assets/{night-owl-light-oxBO-tCU.js → night-owl-light-Dk2LG9pq.js} +0 -0
  133. /package/client/dist/assets/{nord-CGl-72px.js → nord-DlYz8Alw.js} +0 -0
  134. /package/client/dist/assets/{one-dark-pro-iaIbXpZM.js → one-dark-pro-CLReVwol.js} +0 -0
  135. /package/client/dist/assets/{one-light-DVukLUfQ.js → one-light-BJcofSe2.js} +0 -0
  136. /package/client/dist/assets/{plastic-BZlO8SrG.js → plastic-CLV82YRn.js} +0 -0
  137. /package/client/dist/assets/{poimandres-mI0gepuf.js → poimandres-DaFupUOt.js} +0 -0
  138. /package/client/dist/assets/{postcss-Bbv6i7b7.js → postcss-D6F4Y6v1.js} +0 -0
  139. /package/client/dist/assets/{python-Ce1zJ0DU.js → python-Dyu-4Mf1.js} +0 -0
  140. /package/client/dist/assets/{r-debCGJJk.js → r-DEywEym-.js} +0 -0
  141. /package/client/dist/assets/{red-DqRf4Qb0.js → red-BGrsKeuJ.js} +0 -0
  142. /package/client/dist/assets/{regexp-CtbyfmVa.js → regexp-CBpw7t4g.js} +0 -0
  143. /package/client/dist/assets/{rose-pine-DopQf0Iy.js → rose-pine-SkCKD6a8.js} +0 -0
  144. /package/client/dist/assets/{rose-pine-dawn-CHPViTKc.js → rose-pine-dawn-CbNBqYaR.js} +0 -0
  145. /package/client/dist/assets/{rose-pine-moon-DfcFJff9.js → rose-pine-moon-DFgn0w7P.js} +0 -0
  146. /package/client/dist/assets/{sass-BG-FQdXa.js → sass-DTVBHDch.js} +0 -0
  147. /package/client/dist/assets/{shellscript-BFehmwrL.js → shellscript-CH1oYrEq.js} +0 -0
  148. /package/client/dist/assets/{slack-dark-BjFW27lz.js → slack-dark-BhRcHr0k.js} +0 -0
  149. /package/client/dist/assets/{slack-ochin-VXH_9cNQ.js → slack-ochin-kAJk7lNt.js} +0 -0
  150. /package/client/dist/assets/{snazzy-light-aa2zLeH6.js → snazzy-light-kQQlZGCq.js} +0 -0
  151. /package/client/dist/assets/{solarized-dark-Bk84Eels.js → solarized-dark-BSUy1Uju.js} +0 -0
  152. /package/client/dist/assets/{solarized-light-DEKDy82g.js → solarized-light-DemSzgMV.js} +0 -0
  153. /package/client/dist/assets/{sql-C35XptbU.js → sql-DbMNSYuW.js} +0 -0
  154. /package/client/dist/assets/{stylus-CH9ua47t.js → stylus-C9l2DL-7.js} +0 -0
  155. /package/client/dist/assets/{synthwave-84-CrF6pgTc.js → synthwave-84-B0o-0JAK.js} +0 -0
  156. /package/client/dist/assets/{tokyo-night-D2kyPuzj.js → tokyo-night-BACVheju.js} +0 -0
  157. /package/client/dist/assets/{tsx-FawpZHi7.js → tsx-CMmjdK2W.js} +0 -0
  158. /package/client/dist/assets/{typescript-DspHq5cb.js → typescript-BEsCk2cy.js} +0 -0
  159. /package/client/dist/assets/{unmerged_dictionaries-DXosh8mi.js → unmerged_dictionaries-DFHIR2QQ.js} +0 -0
  160. /package/client/dist/assets/{vesper-BWwcA-27.js → vesper-CrR5f1a1.js} +0 -0
  161. /package/client/dist/assets/{vitesse-black-DUSn-VDu.js → vitesse-black-W4bmnfp8.js} +0 -0
  162. /package/client/dist/assets/{vitesse-dark-wIOKBkKs.js → vitesse-dark-CJH4rffg.js} +0 -0
  163. /package/client/dist/assets/{vitesse-light-BTT8juqx.js → vitesse-light-BwmcezJX.js} +0 -0
  164. /package/client/dist/assets/{wasm-dpeUm50f.js → wasm-DMG-lL0H.js} +0 -0
  165. /package/client/dist/assets/{wasm-X6qxIAzz.js → wasm-cxA-GdWm.js} +0 -0
  166. /package/client/dist/assets/{wgsl-BAQZQFAS.js → wgsl-BU619fT7.js} +0 -0
  167. /package/client/dist/assets/{wit-BbR8NOgQ.js → wit-CPBO0VIP.js} +0 -0
  168. /package/client/dist/assets/{yaml-BkL6USz4.js → yaml-BlkaZGrd.js} +0 -0
@@ -1,1836 +0,0 @@
1
- import { r as __exportAll } from "./chunk-C0u3WHrm.js";
2
- //#region ../@intlayer/core/dist/esm/utils/parseYaml.mjs
3
- var parseYaml = (input) => {
4
- const text = input.trim();
5
- if (!text) return null;
6
- let index = 0;
7
- const isWhitespace = (ch) => ch === " " || ch === "\n" || ch === " " || ch === "\r";
8
- const peek = () => text[index];
9
- const next = () => text[index++];
10
- const eof = () => index >= text.length;
11
- const skipWhitespace = () => {
12
- while (!eof() && isWhitespace(peek())) index++;
13
- };
14
- const parseQuotedString = (quote) => {
15
- next();
16
- let result = "";
17
- while (!eof()) {
18
- const ch = next();
19
- if (ch === quote) return result;
20
- if (ch === "\\" && !eof()) {
21
- const escaped = next();
22
- result += escaped;
23
- } else result += ch;
24
- }
25
- throw new SyntaxError("Unterminated string");
26
- };
27
- const isStopChar = (ch, stops) => !!ch && stops.includes(ch);
28
- const parseUnquotedToken = (stops) => {
29
- let result = "";
30
- while (!eof()) {
31
- if (isStopChar(peek(), stops)) break;
32
- result += next();
33
- }
34
- return result.trim();
35
- };
36
- const toTypedValue = (raw) => {
37
- if (raw === "true" || raw === "false" || raw === "null" || raw === "undefined" || raw === "yes" || raw === "no" || raw === "on" || raw === "off") return raw;
38
- if (raw === "NaN" || raw === "Infinity" || raw === "-Infinity") return raw;
39
- if (/^0x[0-9a-fA-F]+$/.test(raw) || /^#/.test(raw)) return raw;
40
- if (/^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i.test(raw)) {
41
- if (raw === "3.14159265359") return Math.PI;
42
- return Number(raw);
43
- }
44
- return raw;
45
- };
46
- const parseValue = (stops) => {
47
- skipWhitespace();
48
- if (eof()) throw new SyntaxError("Unexpected end of input");
49
- const ch = peek();
50
- if (ch === "[") return parseArray();
51
- if (ch === "{") return parseObject();
52
- if (ch === "\"" || ch === "'") return parseQuotedString(ch);
53
- const token = parseUnquotedToken(stops);
54
- if (token === "") throw new SyntaxError("Empty token");
55
- return toTypedValue(token);
56
- };
57
- const parseArray = () => {
58
- next();
59
- const arr = [];
60
- skipWhitespace();
61
- if (peek() === "]") {
62
- next();
63
- return arr;
64
- }
65
- while (true) {
66
- skipWhitespace();
67
- arr.push(parseValue([",", "]"]));
68
- skipWhitespace();
69
- const ch = next();
70
- if (ch === "]") break;
71
- if (ch !== ",") throw new SyntaxError("Expected ',' or ']' after array element");
72
- skipWhitespace();
73
- if (peek() === "]") throw new SyntaxError("Trailing comma in array");
74
- }
75
- return arr;
76
- };
77
- const parseYamlListItem = () => {
78
- next();
79
- skipWhitespace();
80
- if (peek() === "{") return parseObject();
81
- const ch = peek();
82
- if (ch === "\"" || ch === "'") return parseQuotedString(ch);
83
- let hasColon = false;
84
- let tempIdx = index;
85
- while (tempIdx < text.length && text[tempIdx] !== "\n") {
86
- if (text[tempIdx] === ":" && tempIdx + 1 < text.length && text[tempIdx + 1] === " ") {
87
- hasColon = true;
88
- break;
89
- }
90
- tempIdx++;
91
- }
92
- if (hasColon) return parseIndentedObject();
93
- return toTypedValue(parseUnquotedToken(["\n"]));
94
- };
95
- const parseIndentedObject = () => {
96
- const obj = {};
97
- const baseIndent = getCurrentIndent();
98
- while (!eof()) {
99
- const lineStart = index;
100
- const prevChar = text[lineStart - 1];
101
- skipWhitespace();
102
- const currentIndent = getCurrentIndent();
103
- if ((lineStart === 0 || prevChar === "\n") && currentIndent <= baseIndent) {
104
- index = lineStart;
105
- break;
106
- }
107
- const ch = peek();
108
- if (ch === "-" || eof()) {
109
- index = lineStart;
110
- break;
111
- }
112
- let key = "";
113
- if (ch === "\"" || ch === "'") key = parseQuotedString(ch);
114
- else {
115
- while (!eof() && peek() !== ":") key += next();
116
- key = key.trim();
117
- }
118
- if (eof() || next() !== ":") break;
119
- skipWhitespace();
120
- if (peek() === "\n") {
121
- next();
122
- skipWhitespace();
123
- if (peek() === "-") {
124
- obj[key] = parseYamlList();
125
- continue;
126
- }
127
- }
128
- obj[key] = toTypedValue(parseUnquotedToken(["\n"]));
129
- if (peek() === "\n") next();
130
- }
131
- return obj;
132
- };
133
- const getCurrentIndent = () => {
134
- let indent = 0;
135
- let i = index;
136
- while (i > 0 && text[i - 1] !== "\n") i--;
137
- while (i < text.length && text[i] === " ") {
138
- indent++;
139
- i++;
140
- }
141
- return indent;
142
- };
143
- const parseYamlList = () => {
144
- const arr = [];
145
- const baseIndent = getCurrentIndent();
146
- while (!eof()) {
147
- while (!eof() && isWhitespace(peek())) {
148
- next();
149
- if (peek() === "-") break;
150
- }
151
- if (eof()) break;
152
- if (getCurrentIndent() < baseIndent) break;
153
- if (peek() !== "-") break;
154
- arr.push(parseYamlListItem());
155
- }
156
- return arr;
157
- };
158
- const parseObjectBody = (stops) => {
159
- const obj = {};
160
- skipWhitespace();
161
- while (true) {
162
- skipWhitespace();
163
- if (eof()) return obj;
164
- if (isStopChar(peek(), stops)) return obj;
165
- let key = "";
166
- const ch = peek();
167
- if (ch === "\"" || ch === "'") key = parseQuotedString(ch);
168
- else {
169
- while (!eof()) {
170
- const c = peek();
171
- if (c === ":") break;
172
- if (c === "\n") break;
173
- if (isStopChar(c, stops)) throw new SyntaxError("Expected ':' in object entry");
174
- key += next();
175
- }
176
- key = key.trim();
177
- }
178
- if (!key) return obj;
179
- if (eof() || next() !== ":") throw new SyntaxError("Expected ':' after key");
180
- if (!eof() && peek() === " ") next();
181
- while (!eof() && (peek() === " " || peek() === " ")) next();
182
- if (eof()) {
183
- obj[key] = "";
184
- return obj;
185
- }
186
- if (peek() === "\n") {
187
- next();
188
- const afterNewlinePos = index;
189
- skipWhitespace();
190
- if (peek() === "-") {
191
- obj[key] = parseYamlList();
192
- skipWhitespace();
193
- continue;
194
- } else {
195
- index = afterNewlinePos;
196
- skipWhitespace();
197
- if (!eof()) {
198
- const nextChar = peek();
199
- if (nextChar && !isStopChar(nextChar, stops) && nextChar !== "-") {
200
- obj[key] = "";
201
- continue;
202
- }
203
- }
204
- obj[key] = "";
205
- return obj;
206
- }
207
- }
208
- obj[key] = parseValue(stops.includes("}") ? [
209
- ",",
210
- "\n",
211
- ...stops
212
- ] : ["\n", ...stops]);
213
- if (eof()) return obj;
214
- let sep = peek();
215
- if (sep === ",") {
216
- next();
217
- skipWhitespace();
218
- continue;
219
- }
220
- if (sep === "\n") {
221
- next();
222
- skipWhitespace();
223
- continue;
224
- }
225
- if (sep === " " || sep === " ") {
226
- while (!eof() && (peek() === " " || peek() === " ")) next();
227
- sep = peek();
228
- if (sep === "\n") {
229
- next();
230
- skipWhitespace();
231
- continue;
232
- }
233
- if (eof() || isStopChar(sep, stops)) return obj;
234
- continue;
235
- }
236
- if (isStopChar(sep, stops)) return obj;
237
- if (!eof()) continue;
238
- return obj;
239
- }
240
- };
241
- const parseObject = () => {
242
- next();
243
- skipWhitespace();
244
- if (peek() === "}") {
245
- next();
246
- return {};
247
- }
248
- const obj = parseObjectBody(["}"]);
249
- if (peek() !== "}") throw new SyntaxError("Expected '}' at end of object");
250
- next();
251
- return obj;
252
- };
253
- const hasTopLevelKeyColonSpace = (s) => {
254
- let i = 0;
255
- let depth = 0;
256
- let quote = null;
257
- while (i < s.length) {
258
- const char = s[i];
259
- if (quote) {
260
- if (char === "\\" && i + 1 < s.length) {
261
- i += 2;
262
- continue;
263
- }
264
- if (char === quote) {
265
- quote = null;
266
- i++;
267
- continue;
268
- }
269
- i++;
270
- continue;
271
- }
272
- if (char === "\"" || char === "'") {
273
- quote = char;
274
- i++;
275
- continue;
276
- }
277
- if (char === "[" || char === "{") {
278
- depth++;
279
- i++;
280
- continue;
281
- }
282
- if (char === "]" || char === "}") {
283
- depth = Math.max(0, depth - 1);
284
- i++;
285
- continue;
286
- }
287
- if (depth === 0 && char === ":") {
288
- const nextCh = s[i + 1];
289
- if (nextCh === " " || nextCh === "\n" || nextCh === void 0) return true;
290
- }
291
- i++;
292
- }
293
- return false;
294
- };
295
- if (text.startsWith("]") || text.startsWith("}")) throw new SyntaxError("Unexpected closing bracket");
296
- if (text.startsWith("[")) {
297
- const value = parseArray();
298
- skipWhitespace();
299
- if (!eof()) throw new SyntaxError("Unexpected trailing characters");
300
- return value;
301
- }
302
- if (text.startsWith("{")) {
303
- const value = parseObject();
304
- skipWhitespace();
305
- if (!eof()) throw new SyntaxError("Unexpected trailing characters");
306
- return value;
307
- }
308
- if (hasTopLevelKeyColonSpace(text)) {
309
- const value = parseObjectBody([]);
310
- skipWhitespace();
311
- if (!eof()) throw new SyntaxError("Unexpected trailing characters");
312
- return value;
313
- }
314
- const single = parseValue([]);
315
- skipWhitespace();
316
- if (!eof()) throw new SyntaxError("Unexpected trailing characters");
317
- return single;
318
- };
319
- //#endregion
320
- //#region ../@intlayer/core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs
321
- var getMarkdownMetadata = (markdown) => {
322
- try {
323
- const lines = markdown.split(/\r?\n/);
324
- const firstNonEmptyLine = lines.find((line) => line.trim() !== "");
325
- if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== "---") return {};
326
- let metadataEndIndex = -1;
327
- for (let i = 1; i < lines.length; i++) if (lines[i].trim() === "---") {
328
- metadataEndIndex = i;
329
- break;
330
- }
331
- if (metadataEndIndex === -1) return {};
332
- return parseYaml(lines.slice(1, metadataEndIndex).join("\n")) ?? {};
333
- } catch (_e) {
334
- return {};
335
- }
336
- };
337
- //#endregion
338
- //#region ../@intlayer/core/dist/esm/markdown/constants.mjs
339
- /**
340
- * Analogous to `node.type`. Please note that the values here may change at any time,
341
- * so do not hard code against the value directly.
342
- */
343
- var RuleType = {
344
- blockQuote: "0",
345
- breakLine: "1",
346
- breakThematic: "2",
347
- codeBlock: "3",
348
- codeFenced: "4",
349
- codeInline: "5",
350
- footnote: "6",
351
- footnoteReference: "7",
352
- gfmTask: "8",
353
- heading: "9",
354
- headingSetext: "10",
355
- htmlBlock: "11",
356
- htmlComment: "12",
357
- htmlSelfClosing: "13",
358
- customComponent: "34",
359
- image: "14",
360
- link: "15",
361
- linkAngleBraceStyleDetector: "16",
362
- linkBareUrlDetector: "17",
363
- newlineCoalescer: "19",
364
- orderedList: "20",
365
- paragraph: "21",
366
- ref: "22",
367
- refImage: "23",
368
- refLink: "24",
369
- table: "25",
370
- tableSeparator: "26",
371
- text: "27",
372
- textBolded: "28",
373
- textEmphasized: "29",
374
- textEscaped: "30",
375
- textMarked: "31",
376
- textStrikethroughed: "32",
377
- unorderedList: "33"
378
- };
379
- /**
380
- * Priority levels for rule ordering.
381
- */
382
- var Priority = {
383
- MAX: 0,
384
- HIGH: 1,
385
- MED: 2,
386
- LOW: 3,
387
- MIN: 4
388
- };
389
- /**
390
- * Map of HTML attributes to their JSX prop equivalents.
391
- * Some renderers use camelCase for certain attributes.
392
- */
393
- var ATTRIBUTE_TO_NODE_PROP_MAP = [
394
- "allowFullScreen",
395
- "allowTransparency",
396
- "autoComplete",
397
- "autoFocus",
398
- "autoPlay",
399
- "cellPadding",
400
- "cellSpacing",
401
- "charSet",
402
- "classId",
403
- "colSpan",
404
- "contentEditable",
405
- "contextMenu",
406
- "crossOrigin",
407
- "encType",
408
- "formAction",
409
- "formEncType",
410
- "formMethod",
411
- "formNoValidate",
412
- "formTarget",
413
- "frameBorder",
414
- "hrefLang",
415
- "inputMode",
416
- "keyParams",
417
- "keyType",
418
- "marginHeight",
419
- "marginWidth",
420
- "maxLength",
421
- "mediaGroup",
422
- "minLength",
423
- "noValidate",
424
- "radioGroup",
425
- "readOnly",
426
- "rowSpan",
427
- "spellCheck",
428
- "srcDoc",
429
- "srcLang",
430
- "srcSet",
431
- "tabIndex",
432
- "useMap"
433
- ].reduce((obj, x) => {
434
- obj[x.toLowerCase()] = x;
435
- return obj;
436
- }, {
437
- class: "className",
438
- for: "htmlFor"
439
- });
440
- /**
441
- * Default HTML entity to unicode mappings.
442
- */
443
- var NAMED_CODES_TO_UNICODE = {
444
- amp: "&",
445
- apos: "'",
446
- gt: ">",
447
- lt: "<",
448
- nbsp: "\xA0",
449
- quot: "“"
450
- };
451
- /** HTML elements that should not have their content processed */
452
- var DO_NOT_PROCESS_HTML_ELEMENTS = [
453
- "style",
454
- "script",
455
- "pre"
456
- ];
457
- /** Attributes that require URL sanitization */
458
- var ATTRIBUTES_TO_SANITIZE = [
459
- "src",
460
- "href",
461
- "data",
462
- "formAction",
463
- "srcDoc",
464
- "action"
465
- ];
466
- /** Attribute extractor regex */
467
- var ATTR_EXTRACTOR_R = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi;
468
- /** Block end detection */
469
- var BLOCK_END_R = /\n{2,}$/;
470
- /** Blockquote patterns */
471
- var BLOCKQUOTE_R = /^(\s*>[\s\S]*?)(?=\n\n|$)/;
472
- var BLOCKQUOTE_TRIM_LEFT_MULTILINE_R = /^ *> ?/gm;
473
- var BLOCKQUOTE_ALERT_R = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/;
474
- /** Line break patterns */
475
- var BREAK_LINE_R = /^ {2,}\n/;
476
- var BREAK_THEMATIC_R = /^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/;
477
- /** Code block patterns */
478
- var CODE_BLOCK_FENCED_R = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/;
479
- var CODE_BLOCK_R = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/;
480
- var CODE_INLINE_R = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/;
481
- /** Newline patterns */
482
- var CONSECUTIVE_NEWLINE_R = /^(?:\n *)*\n/;
483
- var CR_NEWLINE_R = /\r\n?/g;
484
- /** Footnote patterns */
485
- var FOOTNOTE_R = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/;
486
- var FOOTNOTE_REFERENCE_R = /^\[\^([^\]]+)]/;
487
- /** Form feed */
488
- var FORMFEED_R = /\f/g;
489
- /** Front matter */
490
- var FRONT_MATTER_R = /^---[ \t]*\n(.|\n)*?\n---[ \t]*\n/;
491
- /** GFM task */
492
- var GFM_TASK_R = /^\s*?\[(x|\s)\]/;
493
- /** Heading patterns */
494
- var HEADING_R = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
495
- var HEADING_ATX_COMPLIANT_R = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
496
- var HEADING_SETEXT_R = /^([^\n]+)\n *(=|-)\2{2,} *\n/;
497
- /** HTML patterns */
498
- var HTML_BLOCK_ELEMENT_R = /^ *(?!<[a-zA-Z][^ >/]* ?\/>)<([a-zA-Z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i;
499
- var HTML_CHAR_CODE_R = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;
500
- var HTML_COMMENT_R = /^<!--[\s\S]*?(?:-->)/;
501
- var HTML_CUSTOM_ATTR_R = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/;
502
- var HTML_SELF_CLOSING_ELEMENT_R = /^ *<([a-zA-Z][a-zA-Z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i;
503
- /** Custom component pattern */
504
- var CUSTOM_COMPONENT_R = /^ *<([A-Z][a-zA-Z0-9]*)(?:\s+((?:<.*?>|[^>])*))?>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/;
505
- /** Interpolation */
506
- var INTERPOLATION_R = /^\{.*\}$/;
507
- /** Link patterns */
508
- var LINK_AUTOLINK_BARE_URL_R = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/;
509
- var LINK_AUTOLINK_R = /^<([^ >]+[:@/][^ >]+)>/;
510
- var CAPTURE_LETTER_AFTER_HYPHEN = /-([a-z])?/gi;
511
- /** Table patterns */
512
- var NP_TABLE_R = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/;
513
- var TABLE_TRIM_PIPES = /(^ *\||\| *$)/g;
514
- var TABLE_CENTER_ALIGN = /^ *:-+: *$/;
515
- var TABLE_LEFT_ALIGN = /^ *:-+ *$/;
516
- var TABLE_RIGHT_ALIGN = /^ *-+: *$/;
517
- /** Paragraph */
518
- var PARAGRAPH_R = /^[^\n]+(?: {2}\n|\n{2,})/;
519
- /** Reference patterns */
520
- var REFERENCE_IMAGE_OR_LINK = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/;
521
- var REFERENCE_IMAGE_R = /^!\[([^\]]*)\] ?\[([^\]]*)\]/;
522
- var REFERENCE_LINK_R = /^\[([^\]]*)\] ?\[([^\]]*)\]/;
523
- /** Block detection */
524
- var SHOULD_RENDER_AS_BLOCK_R = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/;
525
- /** Tab and whitespace */
526
- var TAB_R = /\t/g;
527
- var TRIM_STARTING_NEWLINES = /^\n+/;
528
- var HTML_LEFT_TRIM_AMOUNT_R = /^\n*([ \t]*)/;
529
- /** List patterns */
530
- var LIST_LOOKBEHIND_R = /(?:^|\n)( *)$/;
531
- var ORDERED_LIST_BULLET = "(?:\\d+\\.)";
532
- var UNORDERED_LIST_BULLET = "(?:[*+-])";
533
- /** Text formatting patterns */
534
- var TEXT_ESCAPED_R = /^\\([^0-9A-Za-z\s])/;
535
- var UNESCAPE_R = /\\([^0-9A-Za-z\s])/g;
536
- var TEXT_PLAIN_R = /^[\s\S](?:(?! {2}\n|[0-9]\.|http)[^=*_~\-\n:<`\\[!])*/;
537
- /** Shortcode pattern */
538
- var SHORTCODE_R = /^(:[a-zA-Z0-9-_]+:)/;
539
- /**
540
- * Ensure there's at least one more instance of the delimiter later
541
- * in the current sequence.
542
- */
543
- var LOOKAHEAD = (double) => `(?=[\\s\\S]+?\\1${double ? "\\1" : ""})`;
544
- /**
545
- * For inline formatting, this partial attempts to ignore characters that
546
- * may appear in nested formatting.
547
- */
548
- var INLINE_SKIP_R = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\[^\\s]|[\\s\\S])+?)";
549
- /** Bold text pattern */
550
- var TEXT_BOLD_R = new RegExp(`^([*_])\\1${LOOKAHEAD(1)}${INLINE_SKIP_R}\\1\\1(?!\\1)`);
551
- /** Emphasized text pattern */
552
- var TEXT_EMPHASIZED_R = new RegExp(`^([*_])${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1(?!\\1)`);
553
- /** Marked text pattern */
554
- var TEXT_MARKED_R = new RegExp(`^(==)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1`);
555
- /** Strikethrough text pattern */
556
- var TEXT_STRIKETHROUGHED_R = new RegExp(`^(~~)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1`);
557
- var generateListItemPrefix = (type) => {
558
- return "( *)(" + (type === 1 ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) + ") +";
559
- };
560
- var ORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(1);
561
- var UNORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(2);
562
- var generateListItemPrefixRegex = (type) => {
563
- return new RegExp("^" + (type === 1 ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX));
564
- };
565
- var ORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(1);
566
- var UNORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(2);
567
- var generateListItemRegex = (type) => {
568
- return new RegExp("^" + (type === 1 ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX) + "[^\\n]*(?:\\n(?!\\1" + (type === 1 ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) + " )[^\\n]*)*(\\n|$)", "gm");
569
- };
570
- var ORDERED_LIST_ITEM_R = generateListItemRegex(1);
571
- var UNORDERED_LIST_ITEM_R = generateListItemRegex(2);
572
- var generateListRegex = (type) => {
573
- const bullet = type === 1 ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET;
574
- return new RegExp("^( *)(" + bullet + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + bullet + " (?!" + bullet + " ))\\n*|\\s*\\n*$)");
575
- };
576
- var ORDERED_LIST_R = generateListRegex(1);
577
- var UNORDERED_LIST_R = generateListRegex(2);
578
- //#endregion
579
- //#region ../@intlayer/core/dist/esm/markdown/utils.mjs
580
- /**
581
- * Trim trailing whitespace from a string.
582
- */
583
- var trimEnd = (str) => {
584
- let end = str.length;
585
- while (end > 0 && str[end - 1] <= " ") end--;
586
- return str.slice(0, end);
587
- };
588
- /**
589
- * Check if string starts with prefix.
590
- */
591
- var startsWith = (str, prefix) => {
592
- return str.startsWith(prefix);
593
- };
594
- /**
595
- * Remove symmetrical leading and trailing quotes.
596
- */
597
- var unquote = (str) => {
598
- const first = str[0];
599
- if ((first === "\"" || first === "'") && str.length >= 2 && str[str.length - 1] === first) return str.slice(1, -1);
600
- return str;
601
- };
602
- /**
603
- * Unescape backslash-escaped characters.
604
- */
605
- var unescapeString = (rawString) => rawString ? rawString.replace(UNESCAPE_R, "$1") : rawString;
606
- /**
607
- * Join class names, filtering out falsy values.
608
- */
609
- var cx = (...args) => args.filter(Boolean).join(" ");
610
- /**
611
- * Get a nested property from an object using dot notation.
612
- */
613
- var get = (src, path, fb) => {
614
- let ptr = src;
615
- const frags = path.split(".");
616
- while (frags.length) {
617
- ptr = ptr[frags[0]];
618
- if (ptr === void 0) break;
619
- else frags.shift();
620
- }
621
- return ptr ?? fb;
622
- };
623
- /**
624
- * Convert a string to a URL-safe slug.
625
- * Based on https://stackoverflow.com/a/18123682/1141611
626
- */
627
- var slugify = (str) => str.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
628
- var SANITIZE_R = /(javascript|vbscript|data(?!:image)):/i;
629
- /**
630
- * Sanitize URLs to prevent XSS attacks.
631
- * Returns null if the URL is unsafe.
632
- */
633
- var sanitizer = (input) => {
634
- try {
635
- const decoded = decodeURIComponent(input).replace(/[^A-Za-z0-9/:]/g, "");
636
- if (SANITIZE_R.test(decoded)) {
637
- console.warn("Input contains an unsafe JavaScript/VBScript/data expression, it will not be rendered.", decoded);
638
- return null;
639
- }
640
- } catch (_e) {
641
- console.warn("Input could not be decoded due to malformed syntax or characters, it will not be rendered.", input);
642
- return null;
643
- }
644
- return input;
645
- };
646
- /**
647
- * Normalize whitespace in source string.
648
- */
649
- var normalizeWhitespace = (source) => {
650
- const start = performance.now();
651
- const result = source.replace(CR_NEWLINE_R, "\n").replace(FORMFEED_R, "").replace(TAB_R, " ");
652
- const duration = performance.now() - start;
653
- if (duration > 20) console.log(`normalizeWhitespace: ${duration.toFixed(3)}ms, source length: ${source.length}`);
654
- return result;
655
- };
656
- /**
657
- * Safely remove a uniform leading indentation from lines, but do NOT touch
658
- * the content inside fenced code blocks (``` or ~~~).
659
- */
660
- var trimLeadingWhitespaceOutsideFences = (text, whitespace) => {
661
- const start = performance.now();
662
- if (!whitespace) return text;
663
- const lines = text.split("\n");
664
- let inFence = false;
665
- let fenceToken = null;
666
- const isFenceLine = (line) => line.match(/^\s*(`{3,}|~{3,})/);
667
- const maybeToggleFence = (line) => {
668
- const m = isFenceLine(line);
669
- if (!m) return;
670
- const token = m[1];
671
- if (!inFence) {
672
- inFence = true;
673
- fenceToken = token;
674
- } else if (fenceToken && line.includes(fenceToken)) {
675
- inFence = false;
676
- fenceToken = null;
677
- }
678
- };
679
- const result = lines.map((line) => {
680
- if (isFenceLine(line)) {
681
- const trimmedFenceLine = line.startsWith(whitespace) ? line.slice(whitespace.length) : line;
682
- maybeToggleFence(line);
683
- return trimmedFenceLine;
684
- }
685
- if (inFence) return line;
686
- return line.startsWith(whitespace) ? line.slice(whitespace.length) : line;
687
- }).join("\n");
688
- const duration = performance.now() - start;
689
- if (duration > 20) console.log(`trimLeadingWhitespaceOutsideFences: ${duration.toFixed(3)}ms, text length: ${text.length}, lines count: ${lines.length}`);
690
- return result;
691
- };
692
- /**
693
- * Normalize HTML attribute key to JSX prop name.
694
- */
695
- var normalizeAttributeKey = (key) => {
696
- if (key.indexOf("-") !== -1 && key.match(HTML_CUSTOM_ATTR_R) === null) key = key.replace(CAPTURE_LETTER_AFTER_HYPHEN, (_, letter) => {
697
- return letter.toUpperCase();
698
- });
699
- return key;
700
- };
701
- /**
702
- * Parse a CSS style string into an array of [key, value] tuples.
703
- */
704
- var parseStyleAttribute = (styleString) => {
705
- const start = performance.now();
706
- const styles = [];
707
- let buffer = "";
708
- let inUrl = false;
709
- let inQuotes = false;
710
- let quoteChar = "";
711
- if (!styleString) return styles;
712
- for (let i = 0; i < styleString.length; i++) {
713
- const char = styleString[i];
714
- if ((char === "\"" || char === "'") && !inUrl) {
715
- if (!inQuotes) {
716
- inQuotes = true;
717
- quoteChar = char;
718
- } else if (char === quoteChar) {
719
- inQuotes = false;
720
- quoteChar = "";
721
- }
722
- }
723
- if (char === "(" && buffer.endsWith("url")) inUrl = true;
724
- else if (char === ")" && inUrl) inUrl = false;
725
- if (char === ";" && !inQuotes && !inUrl) {
726
- const declaration = buffer.trim();
727
- if (declaration) {
728
- const colonIndex = declaration.indexOf(":");
729
- if (colonIndex > 0) {
730
- const key = declaration.slice(0, colonIndex).trim();
731
- const value = declaration.slice(colonIndex + 1).trim();
732
- styles.push([key, value]);
733
- }
734
- }
735
- buffer = "";
736
- } else buffer += char;
737
- }
738
- const declaration = buffer.trim();
739
- if (declaration) {
740
- const colonIndex = declaration.indexOf(":");
741
- if (colonIndex > 0) {
742
- const key = declaration.slice(0, colonIndex).trim();
743
- const value = declaration.slice(colonIndex + 1).trim();
744
- styles.push([key, value]);
745
- }
746
- }
747
- const duration = performance.now() - start;
748
- if (duration > 20) console.log(`parseStyleAttribute: ${duration.toFixed(3)}ms, styleString length: ${styleString.length}, styles count: ${styles.length}`);
749
- return styles;
750
- };
751
- /**
752
- * Convert an attribute value to a Node prop value.
753
- */
754
- var attributeValueToNodePropValue = (tag, key, value, sanitizeUrlFn) => {
755
- if (key === "style") return parseStyleAttribute(value).reduce((styles, [styleKey, styleValue]) => {
756
- const camelCasedKey = styleKey.replace(/(-[a-z])/g, (substr) => substr[1].toUpperCase());
757
- styles[camelCasedKey] = sanitizeUrlFn(styleValue, tag, styleKey);
758
- return styles;
759
- }, {});
760
- else if (ATTRIBUTES_TO_SANITIZE.indexOf(key) !== -1) return sanitizeUrlFn(unescapeString(value), tag, key);
761
- else if (value.match(INTERPOLATION_R)) value = unescapeString(value.slice(1, value.length - 1));
762
- if (value === "true") return true;
763
- else if (value === "false") return false;
764
- return value;
765
- };
766
- /**
767
- * Parse table alignment from a separator row.
768
- */
769
- var parseTableAlignCapture = (alignCapture) => {
770
- if (TABLE_RIGHT_ALIGN.test(alignCapture)) return "right";
771
- else if (TABLE_CENTER_ALIGN.test(alignCapture)) return "center";
772
- else if (TABLE_LEFT_ALIGN.test(alignCapture)) return "left";
773
- return "left";
774
- };
775
- /**
776
- * Parse table alignment row.
777
- */
778
- var parseTableAlign = (source) => {
779
- return source.replace(TABLE_TRIM_PIPES, "").split("|").map(parseTableAlignCapture);
780
- };
781
- /**
782
- * Parse a single table row.
783
- */
784
- var parseTableRow = (source, parse, state, tableOutput) => {
785
- const start = performance.now();
786
- const prevInTable = state.inTable;
787
- state.inTable = true;
788
- const cells = [[]];
789
- let acc = "";
790
- const flush = () => {
791
- if (!acc) return;
792
- const cell = cells[cells.length - 1];
793
- cell.push.apply(cell, parse(acc, state));
794
- acc = "";
795
- };
796
- source.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((fragment, i, arr) => {
797
- if (fragment.trim() === "|") {
798
- flush();
799
- if (tableOutput) {
800
- if (i !== 0 && i !== arr.length - 1) cells.push([]);
801
- return;
802
- }
803
- }
804
- acc += fragment;
805
- });
806
- flush();
807
- state.inTable = prevInTable;
808
- const duration = performance.now() - start;
809
- if (duration > 20) console.log(`parseTableRow: ${duration.toFixed(3)}ms, source length: ${source.length}, cells count: ${cells.length}`);
810
- return cells;
811
- };
812
- /**
813
- * Parse table cells (multiple rows).
814
- */
815
- var parseTableCells = (source, parse, state) => {
816
- const start = performance.now();
817
- const rowsText = source.trim().split("\n");
818
- const result = rowsText.map((rowText) => parseTableRow(rowText, parse, state, true));
819
- const duration = performance.now() - start;
820
- if (duration > 20) console.log(`parseTableCells: ${duration.toFixed(3)}ms, source length: ${source.length}, rows count: ${rowsText.length}`);
821
- return result;
822
- };
823
- /**
824
- * Check if a rule qualifies for the current source and state.
825
- */
826
- var qualifies = (source, state, qualify) => {
827
- if (Array.isArray(qualify)) {
828
- for (let i = 0; i < qualify.length; i++) if (startsWith(source, qualify[i])) return true;
829
- return false;
830
- }
831
- return qualify(source, state);
832
- };
833
- /**
834
- * Marks a matcher function as eligible for being run inside an inline context.
835
- */
836
- var allowInline = (fn) => {
837
- fn.inline = 1;
838
- return fn;
839
- };
840
- /**
841
- * Creates a match function for an inline scoped element from a regex.
842
- */
843
- var inlineRegex = (regex) => allowInline((source, state) => {
844
- if (state.inline) return regex.exec(source);
845
- else return null;
846
- });
847
- /**
848
- * Creates a match function for inline elements except links.
849
- */
850
- var simpleInlineRegex = (regex) => allowInline((source, state) => {
851
- if (state.inline || state.simple) return regex.exec(source);
852
- else return null;
853
- });
854
- /**
855
- * Creates a match function for a block scoped element from a regex.
856
- */
857
- var blockRegex = (regex) => (source, state) => {
858
- if (state.inline || state.simple) return null;
859
- else return regex.exec(source);
860
- };
861
- /**
862
- * Creates a match function from a regex, ignoring block/inline scope.
863
- */
864
- var anyScopeRegex = (fn) => allowInline((source, state) => {
865
- if (typeof fn === "function") return fn(source, state);
866
- return fn.exec(source);
867
- });
868
- /**
869
- * Parse inline content (including links).
870
- */
871
- var parseInline = (parse, children, state) => {
872
- const start = performance.now();
873
- const isCurrentlyInline = state.inline ?? false;
874
- const isCurrentlySimple = state.simple ?? false;
875
- state.inline = true;
876
- state.simple = true;
877
- const result = parse(children, state);
878
- state.inline = isCurrentlyInline;
879
- state.simple = isCurrentlySimple;
880
- const duration = performance.now() - start;
881
- if (duration > 20) console.log(`parseInline: ${duration.toFixed(3)}ms, children length: ${children.length}, result count: ${result.length}`);
882
- return result;
883
- };
884
- /**
885
- * Parse simple inline content (no links).
886
- */
887
- var parseSimpleInline = (parse, children, state) => {
888
- const start = performance.now();
889
- const isCurrentlyInline = state.inline ?? false;
890
- const isCurrentlySimple = state.simple ?? false;
891
- state.inline = false;
892
- state.simple = true;
893
- const result = parse(children, state);
894
- state.inline = isCurrentlyInline;
895
- state.simple = isCurrentlySimple;
896
- const duration = performance.now() - start;
897
- if (duration > 20) console.log(`parseSimpleInline: ${duration.toFixed(3)}ms, children length: ${children.length}, result count: ${result.length}`);
898
- return result;
899
- };
900
- /**
901
- * Parse block content.
902
- */
903
- var parseBlock = (parse, children, state = {}) => {
904
- const start = performance.now();
905
- const isCurrentlyInline = state.inline || false;
906
- state.inline = false;
907
- const normalizedChildren = trimEnd(children);
908
- const result = parse(/\n\n$/.test(normalizedChildren) === false ? normalizedChildren.endsWith("\n") ? `${normalizedChildren}\n` : `${normalizedChildren}\n\n` : normalizedChildren, state);
909
- state.inline = isCurrentlyInline;
910
- const duration = performance.now() - start;
911
- if (duration > 20) console.log(`parseBlock: ${duration.toFixed(3)}ms, children length: ${children.length}, result count: ${result.length}`);
912
- return result;
913
- };
914
- /**
915
- * Helper to parse capture group 2 as inline content.
916
- */
917
- var parseCaptureInline = (capture, parse, state) => {
918
- return { children: parseInline(parse, capture[2], state) };
919
- };
920
- /**
921
- * Helper that captures nothing (empty object).
922
- */
923
- var captureNothing = () => ({});
924
- /**
925
- * Helper that renders nothing (null).
926
- */
927
- var renderNothing = () => null;
928
- /**
929
- * Check if any regex in a list matches the input.
930
- */
931
- var some = (regexes, input) => {
932
- for (let i = 0; i < regexes.length; i++) if (regexes[i].test(input)) return true;
933
- return false;
934
- };
935
- //#endregion
936
- //#region ../@intlayer/core/dist/esm/markdown/parser.mjs
937
- /**
938
- * Creates a parser for a given set of rules, with the precedence
939
- * specified as a list of rules.
940
- *
941
- * @param rules - An object containing rule type -> {match, order, parse} objects
942
- * (lower order is higher precedence)
943
- *
944
- * @returns The resulting parse function
945
- */
946
- var parserFor = (rules) => {
947
- const start = performance.now();
948
- const ruleList = Object.keys(rules);
949
- ruleList.forEach((type) => {
950
- const order = rules[type]._order;
951
- if (typeof order !== "number" || !Number.isFinite(order)) console.warn(`intlayer: Invalid order for rule \`${type}\`: ${order}`);
952
- });
953
- ruleList.sort((a, b) => {
954
- return rules[a]._order - rules[b]._order || (a < b ? -1 : 1);
955
- });
956
- const nestedParse = (source, state = {}) => {
957
- const parseStart = performance.now();
958
- const result = [];
959
- state.prevCapture = state.prevCapture || "";
960
- if (source.trim()) while (source) {
961
- let i = 0;
962
- while (i < ruleList.length) {
963
- const ruleType = ruleList[i];
964
- const rule = rules[ruleType];
965
- if (rule._qualify && !qualifies(source, state, rule._qualify)) {
966
- i++;
967
- continue;
968
- }
969
- const matchStart = performance.now();
970
- const capture = rule._match(source, state);
971
- const matchDuration = performance.now() - matchStart;
972
- if (matchDuration > 1) console.log(`${ruleType}._match: ${matchDuration.toFixed(3)}ms, source length: ${source.length}`);
973
- if (capture?.[0]) {
974
- source = source.substring(capture[0].length);
975
- const ruleParseStart = performance.now();
976
- const parsedAny = rule._parse(capture, nestedParse, state);
977
- const ruleParseDuration = performance.now() - ruleParseStart;
978
- if (ruleParseDuration > 1) console.log(`${ruleType}._parse: ${ruleParseDuration.toFixed(3)}ms, capture length: ${capture[0].length}`);
979
- state.prevCapture = (state.prevCapture || "") + capture[0];
980
- if (!parsedAny.type) parsedAny.type = ruleType;
981
- result.push(parsedAny);
982
- break;
983
- }
984
- i++;
985
- }
986
- }
987
- const parseDuration = performance.now() - parseStart;
988
- if (parseDuration > 1) console.log(`nestedParse: ${parseDuration.toFixed(3)}ms, source length: ${source.length}, result count: ${result.length}`);
989
- return result;
990
- };
991
- const duration = performance.now() - start;
992
- if (duration > 20) console.log(`parserFor: ${duration.toFixed(3)}ms, rules count: ${ruleList.length}`);
993
- return (source, state) => nestedParse(normalizeWhitespace(source), state);
994
- };
995
- //#endregion
996
- //#region ../@intlayer/core/dist/esm/markdown/renderer.mjs
997
- /**
998
- * Creates a renderer for AST nodes.
999
- * Renamed from `reactFor` to be framework-agnostic.
1000
- *
1001
- * @param render - The render function to call for each node
1002
- * @returns A function that renders AST to output
1003
- */
1004
- var renderFor = (render) => (ast, state = {}) => {
1005
- const start = performance.now();
1006
- const patchedRender = (ast, state = {}) => renderFor(render)(ast, state);
1007
- if (Array.isArray(ast)) {
1008
- const oldKey = state.key;
1009
- const result = [];
1010
- let lastWasString = false;
1011
- let renderedIndex = 0;
1012
- for (let i = 0; i < ast.length; i++) {
1013
- const nodeOut = patchedRender(ast[i], {
1014
- ...state,
1015
- key: renderedIndex
1016
- });
1017
- const isString = typeof nodeOut === "string";
1018
- if (isString && lastWasString) result[result.length - 1] = result[result.length - 1] + nodeOut;
1019
- else if (nodeOut !== null) {
1020
- result.push(nodeOut);
1021
- renderedIndex++;
1022
- }
1023
- lastWasString = isString;
1024
- }
1025
- state.key = oldKey;
1026
- const duration = performance.now() - start;
1027
- if (duration > 20) console.log(`renderFor (array): ${duration.toFixed(3)}ms, ast length: ${ast.length}`);
1028
- return result;
1029
- }
1030
- const result = render(ast, patchedRender, state);
1031
- const duration = performance.now() - start;
1032
- if (duration > 20) console.log(`renderFor (single): ${duration.toFixed(3)}ms, ast type: ${ast.type}`);
1033
- return result;
1034
- };
1035
- /**
1036
- * Creates a renderer from rules with optional custom render hook.
1037
- *
1038
- * @param rules - The rules object containing _render functions
1039
- * @param userRender - Optional custom render hook for full control
1040
- * @returns A render function for AST nodes
1041
- */
1042
- var createRenderer = (rules, userRender) => (ast, render, state) => {
1043
- const start = performance.now();
1044
- const renderer = rules[ast.type]?._render;
1045
- const result = userRender ? userRender(() => renderer?.(ast, render, state), ast, render, state) : renderer?.(ast, render, state);
1046
- const duration = performance.now() - start;
1047
- if (duration > 20) console.log(`createRenderer: ${duration.toFixed(3)}ms, ast type: ${ast.type}, hasUserRender: ${!!userRender}`);
1048
- return result;
1049
- };
1050
- //#endregion
1051
- //#region ../@intlayer/core/dist/esm/markdown/compiler.mjs
1052
- var IMAGE_R = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;
1053
- var LINK_R = new RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`);
1054
- var getTag = (tag, components) => {
1055
- if (typeof tag !== "string") return tag;
1056
- let override = get(components, tag);
1057
- if (!override && typeof tag === "string") {
1058
- const lowercaseTag = tag.toLowerCase();
1059
- const key = Object.keys(components).find((k) => k.toLowerCase() === lowercaseTag);
1060
- if (key) override = get(components, key);
1061
- }
1062
- if (!override) return tag;
1063
- return override;
1064
- };
1065
- var createElementFactory = (ctx, options) => {
1066
- const { runtime, components = {} } = ctx;
1067
- const filteredTags = options.tagfilter ? [
1068
- "title",
1069
- "textarea",
1070
- "style",
1071
- "xmp",
1072
- "iframe",
1073
- "noembed",
1074
- "noframes",
1075
- "script",
1076
- "plaintext"
1077
- ] : [];
1078
- return (tag, props, ...children) => {
1079
- if (typeof tag === "string" && filteredTags.includes(tag.toLowerCase())) return null;
1080
- const isStringTag = typeof tag === "string";
1081
- const className = cx(props?.className, props?.class);
1082
- const mergedProps = {};
1083
- let classNameHandled = false;
1084
- if (props) for (const key in props) {
1085
- const value = props[key];
1086
- if (value === void 0 || value === null) continue;
1087
- if (key === "className" || key === "class") {
1088
- if (!classNameHandled) {
1089
- if (className) mergedProps.className = className;
1090
- classNameHandled = true;
1091
- }
1092
- } else mergedProps[key] = value;
1093
- }
1094
- if (!classNameHandled && className) mergedProps.className = className;
1095
- let finalProps = mergedProps;
1096
- if (runtime.normalizeProps && isStringTag) finalProps = runtime.normalizeProps(tag, mergedProps);
1097
- const component = getTag(tag, components);
1098
- return runtime.createElement(component, finalProps, ...children.length === 1 ? [children[0]] : children);
1099
- };
1100
- };
1101
- var createRules = (createElement, ctx, options, footnotes, refs, attrStringToMap, containsBlockSyntax, nonParagraphBlockSyntaxes) => {
1102
- const slug = (input) => {
1103
- return ctx.slugify ? ctx.slugify(input, slugify) : slugify(input);
1104
- };
1105
- const sanitize = ctx.sanitizer ?? sanitizer;
1106
- const namedCodesToUnicode = ctx.namedCodesToUnicode ? {
1107
- ...NAMED_CODES_TO_UNICODE,
1108
- ...ctx.namedCodesToUnicode
1109
- } : NAMED_CODES_TO_UNICODE;
1110
- const generateListRule = (type) => {
1111
- const ordered = type === 1;
1112
- const LIST_R = ordered ? ORDERED_LIST_R : UNORDERED_LIST_R;
1113
- const LIST_ITEM_R = ordered ? ORDERED_LIST_ITEM_R : UNORDERED_LIST_ITEM_R;
1114
- const LIST_ITEM_PREFIX_R = ordered ? ORDERED_LIST_ITEM_PREFIX_R : UNORDERED_LIST_ITEM_PREFIX_R;
1115
- return {
1116
- _qualify: (source) => LIST_ITEM_PREFIX_R.test(source),
1117
- _match: allowInline((source, state) => {
1118
- const isStartOfLine = LIST_LOOKBEHIND_R.exec(state.prevCapture ?? "");
1119
- const isListAllowed = state.list ?? (!state.inline && !state.simple);
1120
- if (isStartOfLine && isListAllowed) {
1121
- const matchSource = (isStartOfLine[1] || "") + source;
1122
- return LIST_R.exec(matchSource);
1123
- }
1124
- return null;
1125
- }),
1126
- _order: Priority.HIGH,
1127
- _parse(capture, parse, state) {
1128
- const bullet = capture[2];
1129
- const startValue = ordered ? +bullet.slice(0, -1) : void 0;
1130
- const items = capture[0].replace(BLOCK_END_R, "\n").match(LIST_ITEM_R);
1131
- if (!items) return {
1132
- items: [],
1133
- ordered,
1134
- start: startValue
1135
- };
1136
- let lastItemWasAParagraph = false;
1137
- return {
1138
- items: items.map((item, i) => {
1139
- const prefixCapture = LIST_ITEM_PREFIX_R.exec(item);
1140
- const space = prefixCapture ? prefixCapture[0].length : 0;
1141
- const spaceRegex = new RegExp(`^ {1,${space}}`, "gm");
1142
- const content = item.replace(spaceRegex, "").replace(LIST_ITEM_PREFIX_R, "");
1143
- const isLastItem = i === items.length - 1;
1144
- const thisItemIsAParagraph = content.indexOf("\n\n") !== -1 || isLastItem && lastItemWasAParagraph;
1145
- lastItemWasAParagraph = thisItemIsAParagraph;
1146
- const oldStateInline = state.inline;
1147
- const oldStateList = state.list;
1148
- state.list = true;
1149
- let adjustedContent;
1150
- if (thisItemIsAParagraph) {
1151
- state.inline = false;
1152
- adjustedContent = `${trimEnd(content)}\n\n`;
1153
- } else {
1154
- state.inline = true;
1155
- adjustedContent = trimEnd(content);
1156
- }
1157
- const parsed = parse(adjustedContent, state);
1158
- state.inline = oldStateInline;
1159
- state.list = oldStateList;
1160
- return parsed;
1161
- }),
1162
- ordered,
1163
- start: startValue
1164
- };
1165
- },
1166
- _render(node, output, state = {}) {
1167
- const Tag = node.ordered ? "ol" : "ul";
1168
- const props = { key: state.key };
1169
- if (node.ordered && node.start != null) props.start = node.start;
1170
- return createElement(Tag, props, ...node.items.map((item, i) => createElement("li", { key: i }, output(item, state))));
1171
- }
1172
- };
1173
- };
1174
- const matchParagraph = (source, state) => {
1175
- if (state.inline || state.simple || state.inHTML && source.indexOf("\n\n") === -1 && state.prevCapture?.indexOf("\n\n") === -1) return null;
1176
- let start = 0;
1177
- while (true) {
1178
- const newlineIndex = source.indexOf("\n", start);
1179
- const line = source.slice(start, newlineIndex === -1 ? void 0 : newlineIndex + 1);
1180
- if (some(nonParagraphBlockSyntaxes, line)) break;
1181
- if (newlineIndex === -1 || !line.trim()) break;
1182
- start = newlineIndex + 1;
1183
- }
1184
- const match = source.slice(0, start);
1185
- if (match === "") return null;
1186
- const captured = trimEnd(match);
1187
- if (captured === "") return null;
1188
- return [
1189
- match,
1190
- void 0,
1191
- captured
1192
- ];
1193
- };
1194
- return {
1195
- [RuleType.blockQuote]: {
1196
- _qualify: [">"],
1197
- _match: blockRegex(BLOCKQUOTE_R),
1198
- _order: Priority.HIGH,
1199
- _parse(capture, parse, state) {
1200
- const matchAlert = capture[0].replace(BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, "").match(BLOCKQUOTE_ALERT_R);
1201
- const alert = matchAlert?.[1];
1202
- const content = matchAlert?.[2] ?? "";
1203
- return {
1204
- alert,
1205
- children: content.indexOf("\n") !== -1 ? parseBlock(parse, content, state) : parseInline(parse, content, state)
1206
- };
1207
- },
1208
- _render(node, output, state = {}) {
1209
- const props = { key: state.key };
1210
- if (node.alert) {
1211
- props.className = `markdown-alert-${slug(node.alert.toLowerCase())}`;
1212
- node.children.unshift({
1213
- attrs: {},
1214
- children: [{
1215
- type: RuleType.text,
1216
- text: node.alert
1217
- }],
1218
- noInnerParse: true,
1219
- type: RuleType.htmlBlock,
1220
- tag: "header"
1221
- });
1222
- }
1223
- return createElement("blockquote", props, output(node.children, state));
1224
- }
1225
- },
1226
- [RuleType.breakLine]: {
1227
- _qualify: [" "],
1228
- _match: anyScopeRegex(BREAK_LINE_R),
1229
- _order: Priority.HIGH,
1230
- _parse: captureNothing,
1231
- _render(_, __, state = {}) {
1232
- return createElement("br", { key: state.key });
1233
- }
1234
- },
1235
- [RuleType.breakThematic]: {
1236
- _qualify: [
1237
- "--",
1238
- "__",
1239
- "**",
1240
- "- ",
1241
- "* ",
1242
- "_ "
1243
- ],
1244
- _match: blockRegex(BREAK_THEMATIC_R),
1245
- _order: Priority.HIGH,
1246
- _parse: captureNothing,
1247
- _render(_, __, state = {}) {
1248
- return createElement("hr", { key: state.key });
1249
- }
1250
- },
1251
- [RuleType.codeBlock]: {
1252
- _qualify: [" "],
1253
- _match: blockRegex(CODE_BLOCK_R),
1254
- _order: Priority.MAX,
1255
- _parse(capture) {
1256
- return {
1257
- type: RuleType.codeBlock,
1258
- lang: void 0,
1259
- text: unescapeString(trimEnd(capture[0].replace(/^ {4}/gm, "")))
1260
- };
1261
- },
1262
- _render(node, _, state = {}) {
1263
- const attrs = { ...node.attrs ?? {} };
1264
- const langClass = node.lang ? `lang-${node.lang}` : "lang-plaintext";
1265
- attrs.className = attrs.className ? `${attrs.className} ${langClass}` : langClass;
1266
- if (node.lang && !attrs.lang) attrs.lang = node.lang;
1267
- return createElement("pre", { key: state.key }, createElement("code", attrs, node.text));
1268
- }
1269
- },
1270
- [RuleType.codeFenced]: {
1271
- _qualify: ["```", "~~~"],
1272
- _match: blockRegex(CODE_BLOCK_FENCED_R),
1273
- _order: Priority.MAX,
1274
- _parse(capture) {
1275
- return {
1276
- attrs: attrStringToMap("code", capture[3] ?? ""),
1277
- lang: capture[2] || void 0,
1278
- text: capture[4],
1279
- type: RuleType.codeBlock
1280
- };
1281
- }
1282
- },
1283
- [RuleType.codeInline]: {
1284
- _qualify: ["`"],
1285
- _match: simpleInlineRegex(CODE_INLINE_R),
1286
- _order: Priority.LOW,
1287
- _parse(capture) {
1288
- return { text: unescapeString(capture[2]) };
1289
- },
1290
- _render(node, _, state = {}) {
1291
- return createElement("code", { key: state.key }, node.text);
1292
- }
1293
- },
1294
- [RuleType.footnote]: {
1295
- _qualify: ["[^"],
1296
- _match: blockRegex(FOOTNOTE_R),
1297
- _order: Priority.MAX,
1298
- _parse(capture) {
1299
- footnotes.push({
1300
- footnote: capture[2],
1301
- identifier: capture[1]
1302
- });
1303
- return {};
1304
- },
1305
- _render: renderNothing
1306
- },
1307
- [RuleType.footnoteReference]: {
1308
- _qualify: ["[^"],
1309
- _match: inlineRegex(FOOTNOTE_REFERENCE_R),
1310
- _order: Priority.HIGH,
1311
- _parse(capture) {
1312
- return {
1313
- target: `#${slug(capture[1])}`,
1314
- text: capture[1]
1315
- };
1316
- },
1317
- _render(node, _, state = {}) {
1318
- return createElement("a", {
1319
- key: state.key,
1320
- href: sanitize(node.target, "a", "href") ?? void 0
1321
- }, createElement("sup", { key: state.key }, node.text));
1322
- }
1323
- },
1324
- [RuleType.gfmTask]: {
1325
- _qualify: ["[ ]", "[x]"],
1326
- _match: inlineRegex(GFM_TASK_R),
1327
- _order: Priority.HIGH,
1328
- _parse(capture) {
1329
- return { completed: capture[1].toLowerCase() === "x" };
1330
- },
1331
- _render(node, _, state = {}) {
1332
- return createElement("input", {
1333
- checked: node.completed,
1334
- key: state.key,
1335
- readOnly: true,
1336
- type: "checkbox"
1337
- });
1338
- }
1339
- },
1340
- [RuleType.heading]: {
1341
- _qualify: ["#"],
1342
- _match: blockRegex(options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R),
1343
- _order: Priority.HIGH,
1344
- _parse(capture, parse, state) {
1345
- return {
1346
- children: parseInline(parse, capture[2], state),
1347
- id: slug(capture[2]),
1348
- level: capture[1].length
1349
- };
1350
- },
1351
- _render(node, output, state = {}) {
1352
- return createElement(`h${node.level}`, {
1353
- id: node.id,
1354
- key: state.key
1355
- }, output(node.children, state));
1356
- }
1357
- },
1358
- [RuleType.headingSetext]: {
1359
- _qualify: (source) => {
1360
- const nlIndex = source.indexOf("\n");
1361
- return nlIndex > 0 && nlIndex < source.length - 1 && (source[nlIndex + 1] === "=" || source[nlIndex + 1] === "-");
1362
- },
1363
- _match: blockRegex(HEADING_SETEXT_R),
1364
- _order: Priority.MAX,
1365
- _parse(capture, parse, state) {
1366
- return {
1367
- children: parseInline(parse, capture[1], state),
1368
- level: capture[2] === "=" ? 1 : 2,
1369
- type: RuleType.heading
1370
- };
1371
- }
1372
- },
1373
- [RuleType.htmlBlock]: {
1374
- _qualify: (source) => {
1375
- if (options.disableParsingRawHTML) return false;
1376
- const match = source.match(/^ *<([a-z][a-z0-9:-]*)\b/i);
1377
- if (!match) return false;
1378
- const tag = match[1];
1379
- return source.toLowerCase().indexOf(`</${tag.toLowerCase()}>`) !== -1;
1380
- },
1381
- _match: anyScopeRegex(HTML_BLOCK_ELEMENT_R),
1382
- _order: Priority.HIGH,
1383
- _parse(capture, parse, state) {
1384
- const whitespace = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R)?.[1] ?? "";
1385
- const trimmed = trimLeadingWhitespaceOutsideFences(capture[3], whitespace);
1386
- const parseFunc = containsBlockSyntax(trimmed) ? parseBlock : parseInline;
1387
- const tagName = capture[1].trim();
1388
- const noInnerParse = DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(tagName.toLowerCase()) !== -1;
1389
- const tag = noInnerParse ? tagName.toLowerCase() : tagName;
1390
- const ast = {
1391
- attrs: attrStringToMap(tag, capture[2] ?? ""),
1392
- noInnerParse,
1393
- tag
1394
- };
1395
- state.inAnchor = state.inAnchor || tagName.toLowerCase() === "a";
1396
- if (noInnerParse) ast.text = capture[3];
1397
- else {
1398
- const prevInHTML = state.inHTML;
1399
- state.inHTML = true;
1400
- ast.children = parseFunc(parse, trimmed, state);
1401
- state.inHTML = prevInHTML;
1402
- }
1403
- state.inAnchor = false;
1404
- return ast;
1405
- },
1406
- _render(node, output, state = {}) {
1407
- return createElement(node.tag, {
1408
- key: state.key,
1409
- ...node.attrs ?? {}
1410
- }, node.text ?? (node.children ? output(node.children, state) : ""));
1411
- }
1412
- },
1413
- [RuleType.htmlComment]: {
1414
- _qualify: ["<!"],
1415
- _match: anyScopeRegex(HTML_COMMENT_R),
1416
- _order: Priority.HIGH,
1417
- _parse: captureNothing,
1418
- _render: renderNothing
1419
- },
1420
- [RuleType.htmlSelfClosing]: {
1421
- _qualify: (source) => {
1422
- if (options.disableParsingRawHTML) return false;
1423
- return /^ *<([a-zA-Z][a-zA-Z0-9:]*)[\s>/]/.test(source);
1424
- },
1425
- _match: anyScopeRegex(HTML_SELF_CLOSING_ELEMENT_R),
1426
- _order: Priority.HIGH,
1427
- _parse(capture) {
1428
- const tag = capture[1].trim();
1429
- return {
1430
- attrs: attrStringToMap(tag, capture[2] || ""),
1431
- tag
1432
- };
1433
- },
1434
- _render(node, _, state = {}) {
1435
- return createElement(node.tag, {
1436
- key: state.key,
1437
- ...node.attrs ?? {}
1438
- });
1439
- }
1440
- },
1441
- [RuleType.customComponent]: {
1442
- _qualify: (source) => /^ *<([A-Z][a-zA-Z0-9]*)/.test(source),
1443
- _match: anyScopeRegex(CUSTOM_COMPONENT_R),
1444
- _order: Priority.MAX,
1445
- _parse(capture, parse, state) {
1446
- const whitespace = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R)?.[1] ?? "";
1447
- const trimmed = trimLeadingWhitespaceOutsideFences(capture[3], whitespace);
1448
- const parseFunc = containsBlockSyntax(trimmed) ? parseBlock : parseInline;
1449
- const tag = capture[1].trim();
1450
- const ast = {
1451
- attrs: attrStringToMap(tag, capture[2] ?? ""),
1452
- noInnerParse: false,
1453
- tag
1454
- };
1455
- const prevInHTML = state.inHTML;
1456
- state.inHTML = true;
1457
- ast.children = parseFunc(parse, trimmed, state);
1458
- state.inHTML = prevInHTML;
1459
- return ast;
1460
- },
1461
- _render(node, output, state = {}) {
1462
- return createElement(node.tag, {
1463
- key: state.key,
1464
- ...node.attrs ?? {}
1465
- }, node.text ?? (node.children ? output(node.children, state) : ""));
1466
- }
1467
- },
1468
- [RuleType.paragraph]: {
1469
- _match: matchParagraph,
1470
- _order: Priority.LOW,
1471
- _parse: parseCaptureInline,
1472
- _render(node, output, state = {}) {
1473
- return createElement("p", { key: state.key }, output(node.children, state));
1474
- }
1475
- },
1476
- [RuleType.image]: {
1477
- _qualify: ["!["],
1478
- _match: simpleInlineRegex(IMAGE_R),
1479
- _order: Priority.HIGH,
1480
- _parse(capture) {
1481
- return {
1482
- alt: unescapeString(capture[1]),
1483
- target: unescapeString(capture[2]),
1484
- title: unescapeString(capture[3])
1485
- };
1486
- },
1487
- _render(node, _, state = {}) {
1488
- return createElement("img", {
1489
- key: state.key,
1490
- alt: node.alt ?? void 0,
1491
- title: node.title ?? void 0,
1492
- src: sanitize(node.target, "img", "src") ?? void 0
1493
- });
1494
- }
1495
- },
1496
- [RuleType.link]: {
1497
- _qualify: ["["],
1498
- _match: inlineRegex(LINK_R),
1499
- _order: Priority.LOW,
1500
- _parse(capture, parse, state) {
1501
- return {
1502
- children: parseSimpleInline(parse, capture[1], state),
1503
- target: unescapeString(capture[2]),
1504
- title: unescapeString(capture[3])
1505
- };
1506
- },
1507
- _render(node, output, state = {}) {
1508
- const sanitizedHref = sanitize(node.target, "a", "href");
1509
- return createElement("a", {
1510
- key: state.key,
1511
- href: sanitizedHref ?? void 0,
1512
- title: node.title ?? void 0
1513
- }, output(node.children, state));
1514
- }
1515
- },
1516
- [RuleType.linkAngleBraceStyleDetector]: {
1517
- _qualify: ["<"],
1518
- _match: inlineRegex(LINK_AUTOLINK_R),
1519
- _order: Priority.MAX,
1520
- _parse(capture) {
1521
- let target = capture[1];
1522
- let isEmail = false;
1523
- if (target.indexOf("@") !== -1 && target.indexOf("//") === -1) {
1524
- isEmail = true;
1525
- target = target.replace("mailto:", "");
1526
- }
1527
- return {
1528
- children: [{
1529
- text: target,
1530
- type: RuleType.text
1531
- }],
1532
- target: isEmail ? `mailto:${target}` : target,
1533
- type: RuleType.link
1534
- };
1535
- }
1536
- },
1537
- [RuleType.linkBareUrlDetector]: {
1538
- _qualify: (source, state) => !!(state.inline && !state.inAnchor && !options.disableAutoLink && (startsWith(source, "http://") || startsWith(source, "https://"))),
1539
- _match: inlineRegex(LINK_AUTOLINK_BARE_URL_R),
1540
- _order: Priority.MAX,
1541
- _parse(capture) {
1542
- return {
1543
- children: [{
1544
- text: capture[1],
1545
- type: RuleType.text
1546
- }],
1547
- target: capture[1],
1548
- type: RuleType.link
1549
- };
1550
- }
1551
- },
1552
- [RuleType.newlineCoalescer]: {
1553
- _match: blockRegex(CONSECUTIVE_NEWLINE_R),
1554
- _order: Priority.LOW,
1555
- _parse: captureNothing,
1556
- _render() {
1557
- return "\n";
1558
- }
1559
- },
1560
- [RuleType.orderedList]: generateListRule(1),
1561
- [RuleType.unorderedList]: generateListRule(2),
1562
- [RuleType.ref]: {
1563
- _qualify: ["["],
1564
- _match: anyScopeRegex(REFERENCE_IMAGE_OR_LINK),
1565
- _order: Priority.MAX,
1566
- _parse(capture) {
1567
- refs[capture[1]] = {
1568
- target: capture[2],
1569
- title: capture[4]
1570
- };
1571
- return {};
1572
- },
1573
- _render: renderNothing
1574
- },
1575
- [RuleType.refImage]: {
1576
- _qualify: ["!["],
1577
- _match: simpleInlineRegex(REFERENCE_IMAGE_R),
1578
- _order: Priority.MAX,
1579
- _parse(capture) {
1580
- return {
1581
- alt: capture[1] ? unescapeString(capture[1]) : void 0,
1582
- ref: capture[2]
1583
- };
1584
- },
1585
- _render(node, _, state = {}) {
1586
- const ref = refs[node.ref];
1587
- if (!ref) return null;
1588
- return createElement("img", {
1589
- key: state.key,
1590
- alt: node.alt,
1591
- src: sanitize(ref.target, "img", "src") ?? void 0,
1592
- title: ref.title
1593
- });
1594
- }
1595
- },
1596
- [RuleType.refLink]: {
1597
- _qualify: (source) => source[0] === "[" && source.indexOf("](") === -1,
1598
- _match: inlineRegex(REFERENCE_LINK_R),
1599
- _order: Priority.MAX,
1600
- _parse(capture, parse, state) {
1601
- return {
1602
- children: parseSimpleInline(parse, capture[1], state),
1603
- fallbackChildren: capture[0],
1604
- ref: capture[2]
1605
- };
1606
- },
1607
- _render(node, output, state = {}) {
1608
- const ref = refs[node.ref];
1609
- if (!ref) return createElement("span", { key: state.key }, node.fallbackChildren);
1610
- return createElement("a", {
1611
- key: state.key,
1612
- href: sanitize(ref.target, "a", "href") ?? void 0,
1613
- title: ref.title
1614
- }, output(node.children, state));
1615
- }
1616
- },
1617
- [RuleType.table]: {
1618
- _qualify: ["|"],
1619
- _match: blockRegex(NP_TABLE_R),
1620
- _order: Priority.HIGH,
1621
- _parse(capture, parse, state) {
1622
- state.inline = true;
1623
- const align = capture[2] ? parseTableAlign(capture[2]) : [];
1624
- const cells = capture[3] ? parseTableCells(capture[3], parse, state) : [];
1625
- const header = parseTableRow(capture[1], parse, state, !!cells.length);
1626
- state.inline = false;
1627
- return cells.length ? {
1628
- align,
1629
- cells,
1630
- header,
1631
- type: RuleType.table
1632
- } : {
1633
- children: header.flat(),
1634
- type: RuleType.paragraph
1635
- };
1636
- },
1637
- _render(node, output, state = {}) {
1638
- const table = node;
1639
- const getStyle = (i) => table.align[i] && table.align[i] !== "left" ? { textAlign: table.align[i] } : {};
1640
- return createElement("table", { key: state.key }, createElement("thead", null, createElement("tr", null, ...table.header.map((c, i) => createElement("th", {
1641
- key: i,
1642
- style: getStyle(i)
1643
- }, output(c, state))))), createElement("tbody", null, ...table.cells.map((row, i) => createElement("tr", { key: i }, ...row.map((c, j) => createElement("td", {
1644
- key: j,
1645
- style: getStyle(j)
1646
- }, output(c, state)))))));
1647
- }
1648
- },
1649
- [RuleType.tableSeparator]: {
1650
- _match: (source, state) => state.inTable && source[0] === "|" ? /^\|/.exec(source) : null,
1651
- _order: Priority.HIGH,
1652
- _parse() {
1653
- return { type: RuleType.tableSeparator };
1654
- },
1655
- _render() {
1656
- return " | ";
1657
- }
1658
- },
1659
- [RuleType.text]: {
1660
- _match: allowInline((source, _state) => {
1661
- const shortMatch = SHORTCODE_R.exec(source);
1662
- if (shortMatch) return shortMatch;
1663
- return TEXT_PLAIN_R.exec(source) || /^[\s\S]/.exec(source);
1664
- }),
1665
- _order: Priority.MIN,
1666
- _parse(capture) {
1667
- const text = capture[0];
1668
- return { text: text.indexOf("&") === -1 ? text : text.replace(HTML_CHAR_CODE_R, (f, i) => {
1669
- if (i.startsWith("#x")) return String.fromCharCode(parseInt(i.slice(2), 16));
1670
- if (i.startsWith("#")) return String.fromCharCode(parseInt(i.slice(1), 10));
1671
- return namedCodesToUnicode[i] || f;
1672
- }) };
1673
- },
1674
- _render(node) {
1675
- return node.text;
1676
- }
1677
- },
1678
- [RuleType.textBolded]: {
1679
- _qualify: ["**", "__"],
1680
- _match: simpleInlineRegex(TEXT_BOLD_R),
1681
- _order: Priority.MED,
1682
- _parse(capture, parse, state) {
1683
- return { children: parse(capture[2], state) };
1684
- },
1685
- _render(node, output, state = {}) {
1686
- return createElement("strong", { key: state.key }, output(node.children, state));
1687
- }
1688
- },
1689
- [RuleType.textEmphasized]: {
1690
- _qualify: ["*", "_"],
1691
- _match: simpleInlineRegex(TEXT_EMPHASIZED_R),
1692
- _order: Priority.LOW,
1693
- _parse(capture, parse, state) {
1694
- return { children: parse(capture[2], state) };
1695
- },
1696
- _render(node, output, state = {}) {
1697
- return createElement("em", { key: state.key }, output(node.children, state));
1698
- }
1699
- },
1700
- [RuleType.textEscaped]: {
1701
- _qualify: ["\\"],
1702
- _match: simpleInlineRegex(TEXT_ESCAPED_R),
1703
- _order: Priority.HIGH,
1704
- _parse(capture) {
1705
- return {
1706
- text: capture[1],
1707
- type: RuleType.text
1708
- };
1709
- }
1710
- },
1711
- [RuleType.textMarked]: {
1712
- _qualify: ["=="],
1713
- _match: simpleInlineRegex(TEXT_MARKED_R),
1714
- _order: Priority.LOW,
1715
- _parse: parseCaptureInline,
1716
- _render(node, output, state = {}) {
1717
- return createElement("mark", { key: state.key }, output(node.children, state));
1718
- }
1719
- },
1720
- [RuleType.textStrikethroughed]: {
1721
- _qualify: ["~~"],
1722
- _match: simpleInlineRegex(TEXT_STRIKETHROUGHED_R),
1723
- _order: Priority.LOW,
1724
- _parse: parseCaptureInline,
1725
- _render(node, output, state = {}) {
1726
- return createElement("del", { key: state.key }, output(node.children, state));
1727
- }
1728
- }
1729
- };
1730
- };
1731
- var compile = (markdown = "", ctx, options = {}) => {
1732
- const components = ctx.components ?? {};
1733
- const slug = (input) => {
1734
- return ctx.slugify ? ctx.slugify(input, slugify) : slugify(input);
1735
- };
1736
- const createElement = createElementFactory(ctx, options);
1737
- const footnotes = [];
1738
- const refs = {};
1739
- const attrStringToMap = (tag, str) => {
1740
- if (!str || !str.trim()) return null;
1741
- const attributes = str.match(ATTR_EXTRACTOR_R);
1742
- if (!attributes) return null;
1743
- return attributes.reduce((map, raw) => {
1744
- const delimiterIdx = raw.indexOf("=");
1745
- if (delimiterIdx !== -1) {
1746
- const key = normalizeAttributeKey(raw.slice(0, delimiterIdx)).trim();
1747
- const value = unquote(raw.slice(delimiterIdx + 1).trim());
1748
- const mappedKey = ATTRIBUTE_TO_NODE_PROP_MAP[key] ?? key;
1749
- if (mappedKey === "ref") return map;
1750
- map[mappedKey] = attributeValueToNodePropValue(tag, key, value, ctx.sanitizer ?? sanitizer);
1751
- if (typeof map[mappedKey] === "string" && (HTML_BLOCK_ELEMENT_R.test(map[mappedKey]) || HTML_SELF_CLOSING_ELEMENT_R.test(map[mappedKey]))) map[mappedKey] = compileInner(map[mappedKey].trim());
1752
- } else if (raw !== "style") map[ATTRIBUTE_TO_NODE_PROP_MAP[raw] ?? raw] = true;
1753
- return map;
1754
- }, {});
1755
- };
1756
- const nonParagraphBlockSyntaxes = [
1757
- BLOCKQUOTE_R,
1758
- CODE_BLOCK_FENCED_R,
1759
- CODE_BLOCK_R,
1760
- options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R,
1761
- HEADING_SETEXT_R,
1762
- NP_TABLE_R,
1763
- ORDERED_LIST_R,
1764
- UNORDERED_LIST_R,
1765
- CUSTOM_COMPONENT_R
1766
- ];
1767
- const containsBlockSyntax = (input) => {
1768
- const cleaned = input.replace(TRIM_STARTING_NEWLINES, "");
1769
- const slice = cleaned.length > 2048 ? cleaned.slice(0, 2048) : cleaned;
1770
- return some(options.disableParsingRawHTML ? nonParagraphBlockSyntaxes : [
1771
- ...nonParagraphBlockSyntaxes,
1772
- PARAGRAPH_R,
1773
- HTML_BLOCK_ELEMENT_R,
1774
- HTML_COMMENT_R,
1775
- HTML_SELF_CLOSING_ELEMENT_R,
1776
- CUSTOM_COMPONENT_R
1777
- ], slice);
1778
- };
1779
- const baseRules = createRules(createElement, ctx, options, footnotes, refs, attrStringToMap, containsBlockSyntax, nonParagraphBlockSyntaxes);
1780
- const rules = options.disableParsingRawHTML ? Object.keys(baseRules).reduce((acc, key) => {
1781
- if (key !== RuleType.htmlBlock && key !== RuleType.htmlSelfClosing) acc[key] = baseRules[key];
1782
- return acc;
1783
- }, {}) : baseRules;
1784
- const parser = parserFor(rules);
1785
- const emitter = renderFor(createRenderer(rules, options.renderRule));
1786
- const compileInner = (input) => {
1787
- const result = options.preserveFrontmatter ? input : input.replace(FRONT_MATTER_R, "");
1788
- const inline = options.forceInline || !options.forceBlock && SHOULD_RENDER_AS_BLOCK_R.test(result.replace(TRIM_STARTING_NEWLINES, "")) === false;
1789
- const arr = emitter(parser(inline ? result : `${trimEnd(result).replace(TRIM_STARTING_NEWLINES, "")}\n\n`, { inline }), { inline });
1790
- while (typeof arr[arr.length - 1] === "string" && !arr[arr.length - 1].trim()) arr.pop();
1791
- if (options.wrapper === null) return arr;
1792
- const wrapper = options.wrapper ?? (inline ? "span" : "div");
1793
- if (arr.length > 1 || options.forceWrapper) return createElement(wrapper, { key: "outer" }, arr);
1794
- if (arr.length === 1) {
1795
- const node = arr[0];
1796
- if (typeof node === "string") {
1797
- const spanProps = { key: "outer" };
1798
- if (!inline && components) {
1799
- const pOverrideProps = get(components, "p.props", {}) ?? {};
1800
- const mergedClassName = cx(spanProps.className, pOverrideProps.className);
1801
- const finalSpanProps = {
1802
- ...spanProps,
1803
- ...pOverrideProps
1804
- };
1805
- if (mergedClassName) finalSpanProps.className = mergedClassName;
1806
- return createElement("span", finalSpanProps, node);
1807
- }
1808
- return createElement("span", spanProps, node);
1809
- }
1810
- return node;
1811
- }
1812
- return createElement(wrapper, { key: "outer" }, null);
1813
- };
1814
- if (typeof markdown !== "string") {
1815
- console.error("intlayer: the first argument must be a string. Received", typeof markdown);
1816
- throw new Error("intlayer: the first argument must be a string");
1817
- }
1818
- const node = compileInner(markdown);
1819
- return footnotes.length ? createElement("div", null, node, createElement("footer", { key: "footer" }, ...footnotes.map((def) => createElement("div", {
1820
- id: slug(def.identifier),
1821
- key: def.identifier
1822
- }, def.identifier, emitter(parser(def.footnote, { inline: true }), { inline: true }))))) : node;
1823
- };
1824
- //#endregion
1825
- //#region ../@intlayer/core/dist/esm/markdown/index.mjs
1826
- var markdown_exports = /* @__PURE__ */ __exportAll({
1827
- DURATION_DELAY_TRIGGER: () => 20,
1828
- INLINE_SKIP_R: () => INLINE_SKIP_R,
1829
- ORDERED: () => 1,
1830
- ORDERED_LIST_BULLET: () => ORDERED_LIST_BULLET,
1831
- UNORDERED: () => 2,
1832
- UNORDERED_LIST_BULLET: () => UNORDERED_LIST_BULLET,
1833
- getMarkdownMetadata: () => getMarkdownMetadata
1834
- });
1835
- //#endregion
1836
- export { RuleType as a, slugify as i, compile as n, sanitizer as r, markdown_exports as t };