@lowlighter/markdown 1.2.3 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +31 -33
  2. package/mod.d.ts +34 -0
  3. package/mod.js +22 -0
  4. package/package.json +117 -40
  5. package/plugins/anchors.d.ts +11 -0
  6. package/plugins/anchors.js +39 -0
  7. package/plugins/callouts.d.ts +14 -0
  8. package/plugins/callouts.js +31 -0
  9. package/plugins/directives.d.ts +24 -0
  10. package/plugins/directives.js +76 -0
  11. package/plugins/emojis.d.ts +11 -0
  12. package/plugins/emojis.js +15 -0
  13. package/plugins/frontmatter.d.ts +20 -0
  14. package/plugins/frontmatter.js +49 -0
  15. package/plugins/gfm.d.ts +18 -0
  16. package/plugins/gfm.js +43 -0
  17. package/plugins/{highlighting.ts → highlighting.d.ts} +2 -11
  18. package/plugins/highlighting.js +24 -0
  19. package/plugins/markers.d.ts +15 -0
  20. package/plugins/markers.js +30 -0
  21. package/plugins/math.d.ts +21 -0
  22. package/plugins/math.js +75 -0
  23. package/plugins/mermaid.d.ts +25 -0
  24. package/plugins/mermaid.js +32 -0
  25. package/plugins/mod.d.ts +15 -0
  26. package/plugins/mod.js +14 -0
  27. package/plugins/{ruby.ts → ruby.d.ts} +2 -11
  28. package/plugins/ruby.js +28 -0
  29. package/plugins/uncomments.d.ts +13 -0
  30. package/plugins/uncomments.js +28 -0
  31. package/plugins/wikilinks.d.ts +26 -0
  32. package/plugins/wikilinks.js +45 -0
  33. package/presets/default.d.ts +3 -0
  34. package/presets/default.js +9 -0
  35. package/presets/svg.d.ts +3 -0
  36. package/presets/svg.js +11 -0
  37. package/presets/text.d.ts +3 -0
  38. package/presets/text.js +11 -0
  39. package/presets/web.d.ts +3 -0
  40. package/presets/web.js +12 -0
  41. package/renderer.d.ts +62 -0
  42. package/renderer.js +70 -0
  43. package/types.d.ts +85 -0
  44. package/types.js +10 -0
  45. package/deno.jsonc +0 -124
  46. package/deno.lock +0 -2393
  47. package/mod.mjs +0 -1
  48. package/mod.ts +0 -2
  49. package/mod_test.ts +0 -1
  50. package/plugins/anchors.mjs +0 -1
  51. package/plugins/anchors.ts +0 -21
  52. package/plugins/anchors_test.ts +0 -8
  53. package/plugins/directives.mjs +0 -1
  54. package/plugins/directives.ts +0 -112
  55. package/plugins/directives_test.ts +0 -13
  56. package/plugins/emojis.mjs +0 -1
  57. package/plugins/emojis.ts +0 -20
  58. package/plugins/emojis_test.ts +0 -8
  59. package/plugins/frontmatter.mjs +0 -1
  60. package/plugins/frontmatter.ts +0 -43
  61. package/plugins/frontmatter_test.ts +0 -18
  62. package/plugins/gfm.mjs +0 -1
  63. package/plugins/gfm.ts +0 -14
  64. package/plugins/gfm_test.ts +0 -28
  65. package/plugins/highlighting.mjs +0 -1
  66. package/plugins/highlighting_test.ts +0 -8
  67. package/plugins/linebreaks.mjs +0 -1
  68. package/plugins/linebreaks.ts +0 -21
  69. package/plugins/linebreaks_test.ts +0 -8
  70. package/plugins/markers.mjs +0 -1
  71. package/plugins/markers.ts +0 -25
  72. package/plugins/markers_test.ts +0 -13
  73. package/plugins/math.mjs +0 -1
  74. package/plugins/math.ts +0 -25
  75. package/plugins/math_test.ts +0 -8
  76. package/plugins/mermaid.mjs +0 -1
  77. package/plugins/mermaid.ts +0 -41
  78. package/plugins/mermaid_test.ts +0 -8
  79. package/plugins/mod.mjs +0 -1
  80. package/plugins/mod.ts +0 -14
  81. package/plugins/ruby.mjs +0 -1
  82. package/plugins/ruby_test.ts +0 -8
  83. package/plugins/sanitize.mjs +0 -1
  84. package/plugins/sanitize.ts +0 -26
  85. package/plugins/sanitize_test.ts +0 -15
  86. package/plugins/uncomments.mjs +0 -1
  87. package/plugins/uncomments.ts +0 -20
  88. package/plugins/uncomments_test.ts +0 -8
  89. package/plugins/wikilinks.mjs +0 -1
  90. package/plugins/wikilinks.ts +0 -40
  91. package/plugins/wikilinks_test.ts +0 -14
  92. package/renderer.mjs +0 -1
  93. package/renderer.ts +0 -138
  94. package/renderer_test.ts +0 -19
package/mod.ts DELETED
@@ -1,2 +0,0 @@
1
- export { Renderer } from "./renderer.ts"
2
- export type * from "./renderer.ts"
package/mod_test.ts DELETED
@@ -1 +0,0 @@
1
- import "./mod.ts"
@@ -1 +0,0 @@
1
- var u=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,D=Object.hasOwnProperty;function F(u){const D="element"===u.type?u.tagName.toLowerCase():"",F=2===D.length&&104===D.charCodeAt(0)?D.charCodeAt(1):0;return F>48&&F<55?F-48:void 0}function e(u){return"text"===u.type?u.value:"children"in u?t(u):""}function t(u){let D=-1;const F=[];for(;++D<u.children.length;)F[D]=e(u.children[D]);return F.join("")}var n=function(u){if(null==u)return C;if("function"==typeof u)return r(u);if("object"==typeof u)return Array.isArray(u)?function(u){const D=[];let F=-1;for(;++F<u.length;)D[F]=n(u[F]);return r(e);function e(...u){let F=-1;for(;++F<D.length;)if(D[F].apply(this,u))return!0;return!1}}(u):function(u){const D=u;return r(F);function F(F){const e=F;let t;for(t in u)if(e[t]!==D[t])return!1;return!0}}(u);if("string"==typeof u)return function(u){return r(D);function D(D){return D&&D.type===u}}(u);throw new Error("Expected function, string, or object as test")};function r(u){return function(D,F,e){return Boolean(function(u){return null!==u&&"object"==typeof u&&"type"in u}(D)&&u.call(this,D,"number"==typeof F?F:void 0,e||void 0))}}function C(){return!0}var E=[],A=!0,o=!1,B="skip";function c(u,D,F,e){let t;"function"==typeof D&&"function"!=typeof F?(e=F,F=D):t=D;const r=n(t),C=e?-1:1;!function u(t,n,c){const i=t&&"object"==typeof t?t:{};if("string"==typeof i.type){const u="string"==typeof i.tagName?i.tagName:"string"==typeof i.name?i.name:void 0;Object.defineProperty(s,"name",{value:"node ("+t.type+(u?"<"+u+">":"")+")"})}return s;function s(){let i,s,f,a=E;if((!D||r(t,n,c[c.length-1]||void 0))&&(a=function(u){if(Array.isArray(u))return u;if("number"==typeof u)return[A,u];return null==u?E:[u]}(F(t,c)),a[0]===o))return a;if("children"in t&&t.children){const D=t;if(D.children&&a[0]!==B)for(s=(e?D.children.length:-1)+C,f=c.concat(D);s>-1&&s<D.children.length;){const F=D.children[s];if(i=u(F,s,f)(),i[0]===o)return i;s="number"==typeof i[1]?i[1]:s+C}}return a}}(u,void 0,[])()}function i(u,D,F,e){let t,n,r;"function"==typeof D&&"function"!=typeof F?(n=void 0,r=D,t=F):(n=D,r=F,t=e),c(u,n,(function(u,D){const F=D[D.length-1],e=F?F.children.indexOf(u):void 0;return r(u,e,F)}),t)}var s={},f=new class{constructor(){this.occurrences,this.reset()}slug(F,e){const t=this;let n=function(D,F){if("string"!=typeof D)return"";F||(D=D.toLowerCase());return D.replace(u,"").replace(/ /g,"-")}(F,!0===e);const r=n;for(;D.call(t.occurrences,n);)t.occurrences[r]++,n=r+"-"+t.occurrences[r];return t.occurrences[n]=0,n}reset(){this.occurrences=Object.create(null)}};function a(u){const D=(u||s).prefix||"";return function(u){f.reset(),i(u,"element",(function(u){F(u)&&!u.properties.id&&(u.properties.id=D+f.slug(function(u){return"children"in u?t(u):"value"in u?u.value:""}(u)))}))}}var l="object"==typeof self?self:globalThis,p=u=>((u,D)=>{const F=(D,F)=>(u.set(F,D),D),e=t=>{if(u.has(t))return u.get(t);const[n,r]=D[t];switch(n){case 0:case-1:return F(r,t);case 1:{const u=F([],t);for(const D of r)u.push(e(D));return u}case 2:{const u=F({},t);for(const[D,F]of r)u[e(D)]=e(F);return u}case 3:return F(new Date(r),t);case 4:{const{source:u,flags:D}=r;return F(new RegExp(u,D),t)}case 5:{const u=F(new Map,t);for(const[D,F]of r)u.set(e(D),e(F));return u}case 6:{const u=F(new Set,t);for(const D of r)u.add(e(D));return u}case 7:{const{name:u,message:D}=r;return F(new l[u](D),t)}case 8:return F(BigInt(r),t);case"BigInt":return F(Object(BigInt(r)),t)}return F(new l[n](r),t)};return e})(new Map,u)(0),y="",{toString:h}={},{keys:g}=Object,d=u=>{const D=typeof u;if("object"!==D||!u)return[0,D];const F=h.call(u).slice(8,-1);switch(F){case"Array":return[1,y];case"Object":return[2,y];case"Date":return[3,y];case"RegExp":return[4,y];case"Map":return[5,y];case"Set":return[6,y]}return F.includes("Array")?[1,F]:F.includes("Error")?[7,F]:[2,F]},b=([u,D])=>0===u&&("function"===D||"symbol"===D),m=(u,{json:D,lossy:F}={})=>{const e=[];return((u,D,F,e)=>{const t=(u,D)=>{const t=e.push(u)-1;return F.set(D,t),t},n=e=>{if(F.has(e))return F.get(e);let[r,C]=d(e);switch(r){case 0:{let D=e;switch(C){case"bigint":r=8,D=e.toString();break;case"function":case"symbol":if(u)throw new TypeError("unable to serialize "+C);D=null;break;case"undefined":return t([-1],e)}return t([r,D],e)}case 1:{if(C)return t([C,[...e]],e);const u=[],D=t([r,u],e);for(const D of e)u.push(n(D));return D}case 2:{if(C)switch(C){case"BigInt":return t([C,e.toString()],e);case"Boolean":case"Number":case"String":return t([C,e.valueOf()],e)}if(D&&"toJSON"in e)return n(e.toJSON());const F=[],E=t([r,F],e);for(const D of g(e))!u&&b(d(e[D]))||F.push([n(D),n(e[D])]);return E}case 3:return t([r,e.toISOString()],e);case 4:{const{source:u,flags:D}=e;return t([r,{source:u,flags:D}],e)}case 5:{const D=[],F=t([r,D],e);for(const[F,t]of e)(u||!b(d(F))&&!b(d(t)))&&D.push([n(F),n(t)]);return F}case 6:{const D=[],F=t([r,D],e);for(const F of e)!u&&b(d(F))||D.push(n(F));return F}}const{message:E}=e;return t([r,{name:C,message:E}],e)};return n})(!(D||F),!!D,new Map,e)(u),e},w="function"==typeof structuredClone?(u,D)=>D&&("json"in D||"lossy"in D)?p(m(u,D)):structuredClone(u):(u,D)=>p(m(u,D)),v=function(u){if(null==u)return x;if("string"==typeof u)return function(u){return j(D);function D(D){return D.tagName===u}}(u);if("object"==typeof u)return function(u){const D=[];let F=-1;for(;++F<u.length;)D[F]=v(u[F]);return j(e);function e(...u){let F=-1;for(;++F<D.length;)if(D[F].apply(this,u))return!0;return!1}}(u);if("function"==typeof u)return j(u);throw new Error("Expected function, string, or array as `test`")};function j(u){return function(D,F,e){return Boolean(function(u){return null!==u&&"object"==typeof u&&"type"in u&&"tagName"in u}(D)&&u.call(this,D,"number"==typeof F?F:void 0,e||void 0))}}function x(u){return Boolean(u&&"object"==typeof u&&"type"in u&&"element"===u.type&&"tagName"in u&&"string"==typeof u.tagName)}var N={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]},O={};function S(u){const D=u||O;let e=D.properties;const t=D.headingProperties,n=D.behavior||"prepend",r=D.content,C=D.group,E=v(D.test);let A;return"after"===n||"before"===n?A=function(u,D,F){if("number"!=typeof D||!F)return;const t=M(r||N,u),E=k(u,J(e,u),t);let A="before"===n?[E,u]:[u,E];if(C){const D=P(C,u);D&&!Array.isArray(D)&&"element"===D.type&&(D.children=A,A=[D])}return F.children.splice(D,1,...A),[B,D+A.length]}:"wrap"===n?A=function(u){let D=u.children,F=[];"function"==typeof r?(D=[],F=r(u)):r&&(F=I(r));return u.children=[k(u,J(e,u),Array.isArray(F)?[...D,...F]:[...D,F])],[B]}:(A=function(u){const D=M(r||N,u);return u.children["prepend"===n?"unshift":"push"](k(u,J(e,u),D)),[B]},e||(e={ariaHidden:"true",tabIndex:-1})),function(u){i(u,"element",(function(u,D,e){if(F(u)&&u.properties.id&&E(u,D,e))return Object.assign(u.properties,J(t,u)),A(u,D,e)}))}}function I(u){return w(u)}function k(u,D,F){return{type:"element",tagName:"a",properties:{...D,href:"#"+u.properties.id},children:F}}function M(u,D){const F=P(u,D);return Array.isArray(F)?F:[F]}function P(u,D){return"function"==typeof u?u(D):I(u)}function J(u,D){return"function"==typeof u?u(D):u?I(u):{}}var L={rehype:u=>u.use(a).use(S,{behavior:"wrap"})};export{L as default};
@@ -1,21 +0,0 @@
1
- // Imports
2
- import type { Plugin } from "../renderer.ts"
3
- import rehypeSlug from "rehype-slug"
4
- import rehypeAutolinkHeadings from "rehype-autolink-headings"
5
-
6
- /**
7
- * Add anchors to headings and autolink them.
8
- *
9
- * @example
10
- * ```md
11
- * # foo
12
- * ```
13
- * ```html
14
- * <h1 id="foo"><a href="#foo">foo</a></h1>
15
- * ```
16
- */
17
- export default {
18
- rehype(processor) {
19
- return processor.use(rehypeSlug).use(rehypeAutolinkHeadings, { behavior: "wrap" })
20
- },
21
- } as Plugin
@@ -1,8 +0,0 @@
1
- import { expect, test } from "@libs/testing"
2
- import { Renderer } from "../renderer.ts"
3
- import plugin from "./anchors.ts"
4
-
5
- test("deno")("Plugin.anchors renders headers with anchored links", async () => {
6
- const markdown = new Renderer({ plugins: [plugin] })
7
- await expect(markdown.render("# foo")).resolves.toMatch(/<h1 id="foo"><a.*href="#foo">foo<\/a><\/h1>/)
8
- })
@@ -1 +0,0 @@
1
- var e=Object.defineProperty;var n=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],t={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function l(e){const n="string"==typeof e?e.charCodeAt(0):e;return n>=48&&n<=57}function r(e){const n="string"==typeof e?e.charCodeAt(0):e;return n>=97&&n<=102||n>=65&&n<=70||n>=48&&n<=57}function i(e){return function(e){const n="string"==typeof e?e.charCodeAt(0):e;return n>=97&&n<=122||n>=65&&n<=90}(e)||l(e)}var o=document.createElement("i");function a(e){const n="&"+e+";";o.innerHTML=n;const t=o.textContent;return(59!==t.charCodeAt(t.length-1)||"semi"===e)&&(t!==n&&t)}var u=String.fromCharCode,c=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function s(e,o={}){const s="string"==typeof o.additional?o.additional.charCodeAt(0):o.additional,f=[];let p,h,g=0,m=-1,v="";o.position&&("start"in o.position||"indent"in o.position?(h=o.position.indent,p=o.position.start):p=o.position);let y,b=(p?p.line:0)||1,x=(p?p.column:0)||1,C=A();for(g--;++g<=e.length;)if(10===y&&(x=(h?h[m]:0)||1),y=e.charCodeAt(g),38===y){const c=e.charCodeAt(g+1);if(9===c||10===c||12===c||32===c||38===c||60===c||Number.isNaN(c)||s&&c===s){v+=u(y),x++;continue}const p=g+1;let h,m=p,b=p;if(35===c){b=++m;const n=e.charCodeAt(b);88===n||120===n?(h="hexadecimal",b=++m):h="decimal"}else h="named";let D="",w="",M="";const P="named"===h?i:"decimal"===h?l:r;for(b--;++b<=e.length;){const t=e.charCodeAt(b);if(!P(t))break;M+=u(t),"named"===h&&n.includes(M)&&(D=M,w=a(M))}let T=59===e.charCodeAt(b);if(T){b++;const e="named"===h&&a(M);e&&(D=M,w=e)}let O=1+b-p,E="";if(T||!1!==o.nonTerminated)if(M)if("named"===h){if(T&&!w)S(5,1);else if(D!==M&&(b=m+D.length,O=1+b-m,T=!1),!T){const n=D?1:3;if(o.attribute){const t=e.charCodeAt(b);61===t?(S(n,O),w=""):i(t)?w="":S(n,O)}else S(n,O)}E=w}else{T||S(2,O);let e=Number.parseInt(M,"hexadecimal"===h?16:10);if((k=e)>=55296&&k<=57343||k>1114111)S(7,O),E=u(65533);else if(e in t)S(6,O),E=t[e];else{let n="";d(e)&&S(6,O),e>65535&&(e-=65536,n+=u(e>>>10|55296),e=56320|1023&e),E=n+u(e)}}else"named"!==h&&S(4,O);else;if(E){L(),C=A(),g=b-1,x+=b-p+1,f.push(E);const n=A();n.offset++,o.reference&&o.reference.call(o.referenceContext,E,{start:C,end:n},e.slice(p-1,b)),C=n}else M=e.slice(p-1,b),v+=M,x+=M.length,g=b-1}else 10===y&&(b++,m++,x=0),Number.isNaN(y)?L():(v+=u(y),x++);var k;return f.join("");function A(){return{line:b,column:x,offset:g+((p?p.offset:0)||0)}}function S(e,n){let t;o.warning&&(t=A(),t.column+=n,t.offset+=n,o.warning.call(o.warningContext,c[e],t,e))}function L(){v&&(f.push(v),o.text&&o.text.call(o.textContext,v,{start:C,end:A()}),v="")}}function d(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||!(65535&~e)||65534==(65535&e)}var f=/["&'<>`]/g,p=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,h=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,g=/[|\\{}()[\]^$+*?.]/g,m=new WeakMap;function v(e,n){return e=e.replace(n.subset?function(e){let n=m.get(e);n||(n=function(e){const n=[];let t=-1;for(;++t<e.length;)n.push(e[t].replace(g,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}(e),m.set(e,n));return n}(n.subset):f,t),n.subset||n.escapeOnly?e:e.replace(p,(function(e,t,l){return n.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,l.charCodeAt(t+2),n)})).replace(h,t);function t(e,t,l){return n.format(e.charCodeAt(0),l.charCodeAt(t+1),n)}}function y(e){return"&#x"+e.toString(16).toUpperCase()+";"}var b=function(e){if(null==e)return C;if("function"==typeof e)return x(e);if("object"==typeof e)return Array.isArray(e)?function(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=b(e[t]);return x(l);function l(...e){let t=-1;for(;++t<n.length;)if(n[t].apply(this,e))return!0;return!1}}(e):function(e){const n=e;return x(t);function t(t){const l=t;let r;for(r in e)if(l[r]!==n[r])return!1;return!0}}(e);if("string"==typeof e)return function(e){return x(n);function n(n){return n&&n.type===e}}(e);throw new Error("Expected function, string, or object as test")};function x(e){return function(n,t,l){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(n)&&e.call(this,n,"number"==typeof t?t:void 0,l||void 0))}}function C(){return!0}var k=[],A=!0,S=!1;function L(e,n,t,l){let r;"function"==typeof n&&"function"!=typeof t?(l=t,t=n):r=n;const i=b(r),o=l?-1:1;!function e(r,a,u){const c=r&&"object"==typeof r?r:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(s,"name",{value:"node ("+r.type+(e?"<"+e+">":"")+")"})}return s;function s(){let c,s,d,f=k;if((!n||i(r,a,u[u.length-1]||void 0))&&(f=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[A,e];return null==e?k:[e]}(t(r,u)),f[0]===S))return f;if("children"in r&&r.children){const n=r;if(n.children&&"skip"!==f[0])for(s=(l?n.children.length:-1)+o,d=u.concat(n);s>-1&&s<n.children.length;){const t=n.children[s];if(c=e(t,s,d)(),c[0]===S)return c;s="number"==typeof c[1]?c[1]:s+o}}return f}}(e,void 0,[])()}var D={}.hasOwnProperty,w=/^[^\t\n\r "#'.<=>`}]+$/;function M(e){O.call(this,"containerDirective",e)}function P(e){O.call(this,"leafDirective",e)}function T(e){O.call(this,"textDirective",e)}function O(e,n){this.enter({type:e,name:"",attributes:{},children:[]},n)}function E(e){const n=this.stack[this.stack.length-1];"containerDirective"===n.type||"leafDirective"===n.type||n.type,n.name=this.sliceSerialize(e)}function N(e){this.enter({type:"paragraph",data:{directiveLabel:!0},children:[]},e)}function z(e){this.exit(e)}function R(){this.data.directiveAttributes=[],this.buffer()}function I(e){const n=this.data.directiveAttributes;n.push(["id",s(this.sliceSerialize(e),{attribute:!0})])}function F(e){const n=this.data.directiveAttributes;n.push(["class",s(this.sliceSerialize(e),{attribute:!0})])}function U(e){const n=this.data.directiveAttributes;n[n.length-1][1]=s(this.sliceSerialize(e),{attribute:!0})}function V(e){const n=this.data.directiveAttributes;n.push([this.sliceSerialize(e),""])}function B(){const e=this.data.directiveAttributes,n={};let t=-1;for(;++t<e.length;){const l=e[t];"class"===l[0]&&n.class?n.class+=" "+l[1]:n[l[0]]=l[1]}this.data.directiveAttributes=void 0,this.resume();const l=this.stack[this.stack.length-1];"containerDirective"===l.type||"leafDirective"===l.type||l.type,l.attributes=n}function j(e){this.exit(e)}function H(e,n,t,l){const r=t.createTracker(l),i=function(e){let n=0;"containerDirective"===e.type?(L(e,(function(e,t){if("containerDirective"===e.type){let e=t.length,l=0;for(;e--;)"containerDirective"===t[e].type&&l++;l>n&&(n=l)}})),n+=3):n="leafDirective"===e.type?2:1;return":".repeat(n)}(e),o=t.enter(e.type);let a,u=r.move(i+(e.name||""));if("containerDirective"===e.type){const n=(e.children||[])[0];a=q(n)?n:void 0}else a=e;if(a&&a.children&&a.children.length>0){const n=t.enter("label"),l=`${e.type}Label`,i=t.enter(l);u+=r.move("["),u+=r.move(t.containerPhrasing(a,{...r.current(),before:u,after:"]"})),u+=r.move("]"),i(),n()}if(u+=r.move(function(e,n){const t=n.options.quote||'"',l="textDirective"===e.type?[t]:[t,"\n","\r"],r=e.attributes||{},i=[];let o,a,u,c;for(c in r)if(D.call(r,c)&&void 0!==r[c]&&null!==r[c]){const e=String(r[c]);if("id"===c)u=w.test(e)?"#"+e:s("id",e);else if("class"===c){const n=e.split(/[\t\n\r ]+/g),t=[],l=[];let r=-1;for(;++r<n.length;)(w.test(n[r])?l:t).push(n[r]);o=t.length>0?s("class",t.join(" ")):"",a=l.length>0?"."+l.join("."):""}else i.push(s(c,e))}o&&i.unshift(o);a&&i.unshift(a);u&&i.unshift(u);return i.length>0?"{"+i.join(" ")+"}":"";function s(e,n){return e+(n?"="+t+function(e,n){return v(e,Object.assign({format:y},n))}(n,{subset:l})+t:"")}}(e,t)),"containerDirective"===e.type){let n=e;q((e.children||[])[0])&&(n=Object.assign({},e,{children:e.children.slice(1)})),n&&n.children&&n.children.length>0&&(u+=r.move("\n"),u+=r.move(t.containerFlow(n,r.current()))),u+=r.move("\n"+i)}return o(),u}function q(e){return Boolean(e&&"paragraph"===e.type&&e.data&&e.data.directiveLabel)}H.peek=function(){return":"};var W=Z(/[A-Za-z]/),K=Z(/[\dA-Za-z]/);Z(/[#-'*+\--9=?A-Z^-~]/),Z(/\d/),Z(/[\dA-Fa-f]/),Z(/[!-/:-@[-`{-~]/);function Y(e){return null!==e&&e<-2}function G(e){return null!==e&&(e<0||32===e)}function X(e){return-2===e||-1===e||32===e}Z(/\p{P}|\p{S}/u),Z(/\s/);function Z(e){return function(n){return null!==n&&n>-1&&e.test(String.fromCharCode(n))}}function $(e,n,t,l){const r=l?l-1:Number.POSITIVE_INFINITY;let i=0;return function(l){if(X(l))return e.enter(t),o(l);return n(l)};function o(l){return X(l)&&i++<r?(e.consume(l),o):(e.exit(t),n(l))}}function J(e,n){let t;return function l(r){if(Y(r))return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t=!0,l;if(X(r))return $(e,l,t?"linePrefix":"lineSuffix")(r);return n(r)}}function Q(e,n,t,l,r,i,o,a,u,c,s,d,f,p,h){let g,m;return function(n){return e.enter(l),e.enter(r),e.consume(n),e.exit(r),v};function v(n){return 35===n?(g=o,y(n)):46===n?(g=a,y(n)):58===n||95===n||W(n)?(e.enter(i),e.enter(u),e.consume(n),C):h&&X(n)?$(e,v,"whitespace")(n):!h&&G(n)?J(e,v)(n):P(n)}function y(n){const t=g+"Marker";return e.enter(i),e.enter(g),e.enter(t),e.consume(n),e.exit(t),b}function b(n){if(null===n||34===n||35===n||39===n||46===n||60===n||61===n||62===n||96===n||125===n||G(n))return t(n);const l=g+"Value";return e.enter(l),e.consume(n),x}function x(n){if(null===n||34===n||39===n||60===n||61===n||62===n||96===n)return t(n);if(35===n||46===n||125===n||G(n)){const t=g+"Value";return e.exit(t),e.exit(g),e.exit(i),v(n)}return e.consume(n),x}function C(n){return 45===n||46===n||58===n||95===n||K(n)?(e.consume(n),C):(e.exit(u),h&&X(n)?$(e,k,"whitespace")(n):!h&&G(n)?J(e,k)(n):k(n))}function k(n){return 61===n?(e.enter(c),e.consume(n),e.exit(c),A):(e.exit(i),v(n))}function A(n){return null===n||60===n||61===n||62===n||96===n||125===n||h&&Y(n)?t(n):34===n||39===n?(e.enter(s),e.enter(f),e.consume(n),e.exit(f),m=n,L):h&&X(n)?$(e,A,"whitespace")(n):!h&&G(n)?J(e,A)(n):(e.enter(d),e.enter(p),e.consume(n),m=void 0,S)}function S(n){return null===n||34===n||39===n||60===n||61===n||62===n||96===n?t(n):125===n||G(n)?(e.exit(p),e.exit(d),e.exit(i),v(n)):(e.consume(n),S)}function L(n){return n===m?(e.enter(f),e.consume(n),e.exit(f),e.exit(s),e.exit(i),M):(e.enter(d),D(n))}function D(n){return n===m?(e.exit(d),L(n)):null===n?t(n):Y(n)?h?t(n):J(e,D)(n):(e.enter(p),e.consume(n),w)}function w(n){return n===m||null===n||Y(n)?(e.exit(p),D(n)):(e.consume(n),w)}function M(e){return 125===e||G(e)?v(e):P(e)}function P(i){return 125===i?(e.enter(r),e.consume(i),e.exit(r),e.exit(l),n):t(i)}}function _(e,n,t,l,r,i,o){let a,u=0,c=0;return function(n){return e.enter(l),e.enter(r),e.consume(n),e.exit(r),s};function s(t){return 93===t?(e.enter(r),e.consume(t),e.exit(r),e.exit(l),n):(e.enter(i),d(t))}function d(n){if(93===n&&!c)return h(n);const t=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=t),a=t,f(n)}function f(n){return null===n||u>999||91===n&&++c>32?t(n):93!==n||c--?Y(n)?o?t(n):(e.consume(n),e.exit("chunkText"),d):(e.consume(n),92===n?p:f):(e.exit("chunkText"),h(n))}function p(n){return 91===n||92===n||93===n?(e.consume(n),u++,f):f(n)}function h(t){return e.exit(i),e.enter(r),e.consume(t),e.exit(r),e.exit(l),n}}function ee(e,n,t,l){const r=this;return function(n){if(W(n))return e.enter(l),e.consume(n),i;return t(n)};function i(o){return 45===o||95===o||K(o)?(e.consume(o),i):(e.exit(l),45===r.previous||95===r.previous?t(o):n(o))}}var ne={tokenize:function(e,n,t){const l=this,r=l.events[l.events.length-1],i=r&&"linePrefix"===r[1].type?r[2].sliceSerialize(r[1],!0).length:0;let o,a=0;return function(n){return e.enter("directiveContainer"),e.enter("directiveContainerFence"),e.enter("directiveContainerSequence"),u(n)};function u(n){return 58===n?(e.consume(n),a++,u):a<3?t(n):(e.exit("directiveContainerSequence"),ee.call(l,e,c,t,"directiveContainerName")(n))}function c(n){return 91===n?e.attempt(te,s,s)(n):s(n)}function s(n){return 123===n?e.attempt(le,d,d)(n):d(n)}function d(n){return $(e,f,"whitespace")(n)}function f(r){return e.exit("directiveContainerFence"),null===r?p(r):Y(r)?l.interrupt?n(r):e.attempt(re,h,p)(r):t(r)}function p(t){return e.exit("directiveContainer"),n(t)}function h(t){return null===t?(e.exit("directiveContainer"),n(t)):(e.enter("directiveContainerContent"),g(t))}function g(n){return null===n?x(n):e.attempt({tokenize:C,partial:!0},x,i?$(e,m,"linePrefix",i+1):m)(n)}function m(n){if(null===n)return x(n);const t=e.enter("chunkDocument",{contentType:"document",previous:o});return o&&(o.next=t),o=t,v(n)}function v(n){if(null===n){const t=e.exit("chunkDocument");return l.parser.lazy[t.start.line]=!1,x(n)}return Y(n)?e.check(re,y,b)(n):(e.consume(n),v)}function y(n){e.consume(n);const t=e.exit("chunkDocument");return l.parser.lazy[t.start.line]=!1,g}function b(n){const t=e.exit("chunkDocument");return l.parser.lazy[t.start.line]=!1,x(n)}function x(t){return e.exit("directiveContainerContent"),e.exit("directiveContainer"),n(t)}function C(e,n,t){let r=0;return $(e,(function(n){return e.enter("directiveContainerFence"),e.enter("directiveContainerSequence"),i(n)}),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function i(n){return 58===n?(e.consume(n),r++,i):r<a?t(n):(e.exit("directiveContainerSequence"),$(e,o,"whitespace")(n))}function o(l){return null===l||Y(l)?(e.exit("directiveContainerFence"),n(l)):t(l)}}},concrete:!0},te={tokenize:function(e,n,t){return _(e,n,t,"directiveContainerLabel","directiveContainerLabelMarker","directiveContainerLabelString",!0)},partial:!0},le={tokenize:function(e,n,t){return Q(e,n,t,"directiveContainerAttributes","directiveContainerAttributesMarker","directiveContainerAttribute","directiveContainerAttributeId","directiveContainerAttributeClass","directiveContainerAttributeName","directiveContainerAttributeInitializerMarker","directiveContainerAttributeValueLiteral","directiveContainerAttributeValue","directiveContainerAttributeValueMarker","directiveContainerAttributeValueData",!0)},partial:!0},re={tokenize:function(e,n,t){const l=this;return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),r};function r(e){return l.parser.lazy[l.now().line]?t(e):n(e)}},partial:!0};var ie={tokenize:function(e,n,t){const l=this;return function(n){return e.enter("directiveLeaf"),e.enter("directiveLeafSequence"),e.consume(n),r};function r(n){return 58===n?(e.consume(n),e.exit("directiveLeafSequence"),ee.call(l,e,i,t,"directiveLeafName")):t(n)}function i(n){return 91===n?e.attempt(oe,o,o)(n):o(n)}function o(n){return 123===n?e.attempt(ae,a,a)(n):a(n)}function a(n){return $(e,u,"whitespace")(n)}function u(l){return null===l||Y(l)?(e.exit("directiveLeaf"),n(l)):t(l)}}},oe={tokenize:function(e,n,t){return _(e,n,t,"directiveLeafLabel","directiveLeafLabelMarker","directiveLeafLabelString",!0)},partial:!0},ae={tokenize:function(e,n,t){return Q(e,n,t,"directiveLeafAttributes","directiveLeafAttributesMarker","directiveLeafAttribute","directiveLeafAttributeId","directiveLeafAttributeClass","directiveLeafAttributeName","directiveLeafAttributeInitializerMarker","directiveLeafAttributeValueLiteral","directiveLeafAttributeValue","directiveLeafAttributeValueMarker","directiveLeafAttributeValueData",!0)},partial:!0};var ue={tokenize:function(e,n,t){const l=this;return function(n){return e.enter("directiveText"),e.enter("directiveTextMarker"),e.consume(n),e.exit("directiveTextMarker"),ee.call(l,e,r,t,"directiveTextName")};function r(n){return 58===n?t(n):91===n?e.attempt(ce,i,i)(n):i(n)}function i(n){return 123===n?e.attempt(se,o,o)(n):o(n)}function o(t){return e.exit("directiveText"),n(t)}},previous:function(e){return 58!==e||"characterEscape"===this.events[this.events.length-1][1].type}},ce={tokenize:function(e,n,t){return _(e,n,t,"directiveTextLabel","directiveTextLabelMarker","directiveTextLabelString")},partial:!0},se={tokenize:function(e,n,t){return Q(e,n,t,"directiveTextAttributes","directiveTextAttributesMarker","directiveTextAttribute","directiveTextAttributeId","directiveTextAttributeClass","directiveTextAttributeName","directiveTextAttributeInitializerMarker","directiveTextAttributeValueLiteral","directiveTextAttributeValue","directiveTextAttributeValueMarker","directiveTextAttributeValueData")},partial:!0};function de(){const e=this.data(),n=e.micromarkExtensions||(e.micromarkExtensions=[]),t=e.fromMarkdownExtensions||(e.fromMarkdownExtensions=[]),l=e.toMarkdownExtensions||(e.toMarkdownExtensions=[]);n.push({text:{58:ue},flow:{58:[ne,ie]}}),t.push({canContainEols:["textDirective"],enter:{directiveContainer:M,directiveContainerAttributes:R,directiveContainerLabel:N,directiveLeaf:P,directiveLeafAttributes:R,directiveText:T,directiveTextAttributes:R},exit:{directiveContainer:j,directiveContainerAttributeClassValue:F,directiveContainerAttributeIdValue:I,directiveContainerAttributeName:V,directiveContainerAttributeValue:U,directiveContainerAttributes:B,directiveContainerLabel:z,directiveContainerName:E,directiveLeaf:j,directiveLeafAttributeClassValue:F,directiveLeafAttributeIdValue:I,directiveLeafAttributeName:V,directiveLeafAttributeValue:U,directiveLeafAttributes:B,directiveLeafName:E,directiveText:j,directiveTextAttributeClassValue:F,directiveTextAttributeIdValue:I,directiveTextAttributeName:V,directiveTextAttributeValue:U,directiveTextAttributes:B,directiveTextName:E}}),l.push({unsafe:[{character:"\r",inConstruct:["leafDirectiveLabel","containerDirectiveLabel"]},{character:"\n",inConstruct:["leafDirectiveLabel","containerDirectiveLabel"]},{before:"[^:]",character:":",after:"[A-Za-z]",inConstruct:["phrasing"]},{atBreak:!0,character:":",after:":"}],handlers:{containerDirective:H,leafDirective:H,textDirective:H}})}var fe=class{constructor(e,n,t){this.property=e,this.normal=n,t&&(this.space=t)}};function pe(e,n){const t={},l={};let r=-1;for(;++r<e.length;)Object.assign(t,e[r].property),Object.assign(l,e[r].normal);return new fe(t,l,n)}function he(e){return e.toLowerCase()}fe.prototype.property={},fe.prototype.normal={},fe.prototype.space=null;var ge=class{constructor(e,n){this.property=e,this.attribute=n}};ge.prototype.space=null,ge.prototype.boolean=!1,ge.prototype.booleanish=!1,ge.prototype.overloadedBoolean=!1,ge.prototype.number=!1,ge.prototype.commaSeparated=!1,ge.prototype.spaceSeparated=!1,ge.prototype.commaOrSpaceSeparated=!1,ge.prototype.mustUseProperty=!1,ge.prototype.defined=!1;var me={};((n,t)=>{for(var l in t)e(n,l,{get:t[l],enumerable:!0})})(me,{boolean:()=>ye,booleanish:()=>be,commaOrSpaceSeparated:()=>Se,commaSeparated:()=>Ae,number:()=>Ce,overloadedBoolean:()=>xe,spaceSeparated:()=>ke});var ve=0,ye=Le(),be=Le(),xe=Le(),Ce=Le(),ke=Le(),Ae=Le(),Se=Le();function Le(){return 2**++ve}var De=Object.keys(me),we=class extends ge{constructor(e,n,t,l){let r=-1;if(super(e,n),Me(this,"space",l),"number"==typeof t)for(;++r<De.length;){const e=De[r];Me(this,De[r],(t&me[e])===me[e])}}};function Me(e,n,t){t&&(e[n]=t)}we.prototype.defined=!0;var Pe={}.hasOwnProperty;function Te(e){const n={},t={};let l;for(l in e.properties)if(Pe.call(e.properties,l)){const r=e.properties[l],i=new we(l,e.transform(e.attributes||{},l),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(i.mustUseProperty=!0),n[l]=i,t[he(l)]=l,t[he(i.attribute)]=l}return new fe(n,t,e.space)}var Oe=Te({space:"xlink",transform:(e,n)=>"xlink:"+n.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),Ee=Te({space:"xml",transform:(e,n)=>"xml:"+n.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Ne(e,n){return n in e?e[n]:n}function ze(e,n){return Ne(e,n.toLowerCase())}var Re=Te({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:ze,properties:{xmlns:null,xmlnsXLink:null}}),Ie=Te({transform:(e,n)=>"role"===n?n:"aria-"+n.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:be,ariaAutoComplete:null,ariaBusy:be,ariaChecked:be,ariaColCount:Ce,ariaColIndex:Ce,ariaColSpan:Ce,ariaControls:ke,ariaCurrent:null,ariaDescribedBy:ke,ariaDetails:null,ariaDisabled:be,ariaDropEffect:ke,ariaErrorMessage:null,ariaExpanded:be,ariaFlowTo:ke,ariaGrabbed:be,ariaHasPopup:null,ariaHidden:be,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ke,ariaLevel:Ce,ariaLive:null,ariaModal:be,ariaMultiLine:be,ariaMultiSelectable:be,ariaOrientation:null,ariaOwns:ke,ariaPlaceholder:null,ariaPosInSet:Ce,ariaPressed:be,ariaReadOnly:be,ariaRelevant:null,ariaRequired:be,ariaRoleDescription:ke,ariaRowCount:Ce,ariaRowIndex:Ce,ariaRowSpan:Ce,ariaSelected:be,ariaSetSize:Ce,ariaSort:null,ariaValueMax:Ce,ariaValueMin:Ce,ariaValueNow:Ce,ariaValueText:null,role:null}}),Fe=Te({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:ze,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ae,acceptCharset:ke,accessKey:ke,action:null,allow:null,allowFullScreen:ye,allowPaymentRequest:ye,allowUserMedia:ye,alt:null,as:null,async:ye,autoCapitalize:null,autoComplete:ke,autoFocus:ye,autoPlay:ye,blocking:ke,capture:null,charSet:null,checked:ye,cite:null,className:ke,cols:Ce,colSpan:null,content:null,contentEditable:be,controls:ye,controlsList:ke,coords:Ce|Ae,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ye,defer:ye,dir:null,dirName:null,disabled:ye,download:xe,draggable:be,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ye,formTarget:null,headers:ke,height:Ce,hidden:ye,high:Ce,href:null,hrefLang:null,htmlFor:ke,httpEquiv:ke,id:null,imageSizes:null,imageSrcSet:null,inert:ye,inputMode:null,integrity:null,is:null,isMap:ye,itemId:null,itemProp:ke,itemRef:ke,itemScope:ye,itemType:ke,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ye,low:Ce,manifest:null,max:null,maxLength:Ce,media:null,method:null,min:null,minLength:Ce,multiple:ye,muted:ye,name:null,nonce:null,noModule:ye,noValidate:ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ye,optimum:Ce,pattern:null,ping:ke,placeholder:null,playsInline:ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ye,referrerPolicy:null,rel:ke,required:ye,reversed:ye,rows:Ce,rowSpan:Ce,sandbox:ke,scope:null,scoped:ye,seamless:ye,selected:ye,shadowRootClonable:ye,shadowRootDelegatesFocus:ye,shadowRootMode:null,shape:null,size:Ce,sizes:null,slot:null,span:Ce,spellCheck:be,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ce,step:null,style:null,tabIndex:Ce,target:null,title:null,translate:null,type:null,typeMustMatch:ye,useMap:null,value:be,width:Ce,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ke,axis:null,background:null,bgColor:null,border:Ce,borderColor:null,bottomMargin:Ce,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ye,declare:ye,event:null,face:null,frame:null,frameBorder:null,hSpace:Ce,leftMargin:Ce,link:null,longDesc:null,lowSrc:null,marginHeight:Ce,marginWidth:Ce,noResize:ye,noHref:ye,noShade:ye,noWrap:ye,object:null,profile:null,prompt:null,rev:null,rightMargin:Ce,rules:null,scheme:null,scrolling:be,standby:null,summary:null,text:null,topMargin:Ce,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ce,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ye,disableRemotePlayback:ye,prefix:null,property:null,results:Ce,security:null,unselectable:null}}),Ue=Te({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Ne,properties:{about:Se,accentHeight:Ce,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ce,amplitude:Ce,arabicForm:null,ascent:Ce,attributeName:null,attributeType:null,azimuth:Ce,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ce,by:null,calcMode:null,capHeight:Ce,className:ke,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ce,diffuseConstant:Ce,direction:null,display:null,dur:null,divisor:Ce,dominantBaseline:null,download:ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ce,enableBackground:null,end:null,event:null,exponent:Ce,externalResourcesRequired:null,fill:null,fillOpacity:Ce,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ae,g2:Ae,glyphName:Ae,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ce,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ce,horizOriginX:Ce,horizOriginY:Ce,id:null,ideographic:Ce,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ce,k:Ce,k1:Ce,k2:Ce,k3:Ce,k4:Ce,kernelMatrix:Se,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ce,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ce,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ce,overlineThickness:Ce,paintOrder:null,panose1:null,path:null,pathLength:Ce,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ke,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ce,pointsAtY:Ce,pointsAtZ:Ce,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Se,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Se,rev:Se,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Se,requiredFeatures:Se,requiredFonts:Se,requiredFormats:Se,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ce,specularExponent:Ce,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ce,strikethroughThickness:Ce,string:null,stroke:null,strokeDashArray:Se,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ce,strokeOpacity:Ce,strokeWidth:null,style:null,surfaceScale:Ce,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Se,tabIndex:Ce,tableValues:null,target:null,targetX:Ce,targetY:Ce,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Se,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ce,underlineThickness:Ce,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ce,values:null,vAlphabetic:Ce,vMathematical:Ce,vectorEffect:null,vHanging:Ce,vIdeographic:Ce,version:null,vertAdvY:Ce,vertOriginX:Ce,vertOriginY:Ce,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ce,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),Ve=/^data[-\w.:]+$/i,Be=/-[a-z]/g,je=/[A-Z]/g;function He(e){return"-"+e.toLowerCase()}function qe(e){return e.charAt(1).toUpperCase()}var We=pe([Ee,Oe,Re,Ie,Fe],"html"),Ke=pe([Ee,Oe,Re,Ie,Ue],"svg");function Ye(e){const n=[],t=String(e||"");let l=t.indexOf(","),r=0,i=!1;for(;!i;){-1===l&&(l=t.length,i=!0);const e=t.slice(r,l).trim();!e&&i||n.push(e),r=l+1,l=t.indexOf(",",r)}return n}var Ge=/[#.]/g;function Xe(e){const n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}var Ze={}.hasOwnProperty;function $e(e,n,t){const l=t&&function(e){const n={};let t=-1;for(;++t<e.length;)n[e[t].toLowerCase()]=e[t];return n}(t);return function(t,r,...i){let o,a=-1;if(null==t){o={type:"root",children:[]};const e=r;i.unshift(e)}else if(o=function(e,n){const t=e||"",l={};let r,i,o=0;for(;o<t.length;){Ge.lastIndex=o;const e=Ge.exec(t),n=t.slice(o,e?e.index:t.length);n&&(r?"#"===r?l.id=n:Array.isArray(l.className)?l.className.push(n):l.className=[n]:i=n,o+=n.length),e&&(r=e[0],o++)}return{type:"element",tagName:i||n||"div",properties:l,children:[]}}(t,n),o.tagName=o.tagName.toLowerCase(),l&&Ze.call(l,o.tagName)&&(o.tagName=l[o.tagName]),function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!0;if("string"!=typeof e.type)return!1;const n=e,t=Object.keys(e);for(const e of t){const t=n[e];if(t&&"object"==typeof t){if(!Array.isArray(t))return!0;const e=t;for(const n of e)if("number"!=typeof n&&"string"!=typeof n)return!0}}if("children"in e&&Array.isArray(e.children))return!0;return!1}(r))i.unshift(r);else{let n;for(n in r)Ze.call(r,n)&&Je(e,o.properties,n,r[n])}for(;++a<i.length;)Qe(o.children,i[a]);return"element"===o.type&&"template"===o.tagName&&(o.content={type:"root",children:o.children},o.children=[]),o}}function Je(e,n,t,l){const r=function(e,n){const t=he(n);let l=n,r=ge;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&"data"===t.slice(0,4)&&Ve.test(n)){if("-"===n.charAt(4)){const e=n.slice(5).replace(Be,qe);l="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=n.slice(4);if(!Be.test(e)){let t=e.replace(je,He);"-"!==t.charAt(0)&&(t="-"+t),n="data"+t}}r=we}return new r(l,n)}(e,t);let i,o=-1;if(null!=l){if("number"==typeof l){if(Number.isNaN(l))return;i=l}else i="boolean"==typeof l?l:"string"==typeof l?r.spaceSeparated?Xe(l):r.commaSeparated?Ye(l):r.commaOrSpaceSeparated?Xe(Ye(l).join(" ")):_e(r,r.property,l):Array.isArray(l)?l.concat():"style"===r.property?function(e){const n=[];let t;for(t in e)Ze.call(e,t)&&n.push([t,e[t]].join(": "));return n.join("; ")}(l):String(l);if(Array.isArray(i)){const e=[];for(;++o<i.length;){const n=_e(r,r.property,i[o]);e[o]=n}i=e}if("className"===r.property&&Array.isArray(n.className)){const e=i;i=n.className.concat(e)}n[r.property]=i}}function Qe(e,n){let t=-1;if(null==n);else if("string"==typeof n||"number"==typeof n)e.push({type:"text",value:String(n)});else if(Array.isArray(n))for(;++t<n.length;)Qe(e,n[t]);else{if("object"!=typeof n||!("type"in n))throw new Error("Expected node, nodes, or string, got `"+n+"`");"root"===n.type?Qe(e,n.children):e.push(n)}}function _e(e,n,t){if("string"==typeof t){if(e.number&&t&&!Number.isNaN(Number(t)))return Number(t);if((e.boolean||e.overloadedBoolean)&&(""===t||he(t)===he(n)))return!0}return t}var en=$e(We,"div"),nn=($e(Ke,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]),{remark:e=>e.use(de)});function tn(e){return{remark:n=>n.use((function(){return function(n){!function(e,n,t,l){let r,i,o;"function"==typeof n&&"function"!=typeof t?(i=void 0,o=n,r=t):(i=n,o=t,r=l),L(e,i,(function(e,n){const t=n[n.length-1],l=t?t.children.indexOf(e):void 0;return o(e,l,t)}),r)}(n,(n=>{/(?:container|leaf|text)Directive/.test(n.type)&&e(n)}))}}))}}export{nn as default,tn as directive,en as h};
@@ -1,112 +0,0 @@
1
- // Imports
2
- import type { Plugin } from "../renderer.ts"
3
- import type { Arg, Nullable, Optional } from "@libs/typing/types"
4
- import remarkDirective from "remark-directive"
5
- import { visit } from "unist-util-visit"
6
- export { h } from "hastscript"
7
- import type { Data, ElementContent, Properties } from "hast"
8
-
9
- /**
10
- * Add support for custom directives.
11
- *
12
- * {@link https://github.com/remarkjs/remark-directive?tab=readme-ov-file#examples | See remark-directive for more information}.
13
- */
14
- export default {
15
- remark(processor) {
16
- return processor.use(remarkDirective)
17
- },
18
- } as Plugin
19
-
20
- /**
21
- * Create a new custom directive.
22
- *
23
- * @example
24
- * ```ts
25
- * import { Renderer } from "../renderer.ts"
26
- * import directives, { directive, h } from "./directives.ts"
27
- *
28
- * const foo = directive((node) => {
29
- * node.data ??= {}
30
- * node.data.hName = "div"
31
- * node.data.hProperties = h(node.data.hName, { bar: "qux" }).properties
32
- * })
33
- *
34
- * const markdown = new Renderer({ plugins: [directives, foo] })
35
- * await markdown.render(`
36
- * :::foo
37
- * baz
38
- * :::
39
- * `.trim())
40
- * ```
41
- */
42
- export function directive(callback: (node: AugmentedNode) => void): Plugin {
43
- return {
44
- remark(processor) {
45
- return processor.use(function () {
46
- return function (tree: Arg<typeof visit>) {
47
- visit(tree, (node) => {
48
- if (!/(?:container|leaf|text)Directive/.test(node.type)) {
49
- return
50
- }
51
- callback(node as AugmentedNode)
52
- })
53
- }
54
- })
55
- },
56
- } as Plugin
57
- }
58
-
59
- /**
60
- * Node.
61
- *
62
- * Augmented from {@link https://github.com/syntax-tree/mdast-util-directive/blob/main/index.d.ts | mdast-util-directive}.
63
- */
64
- interface AugmentedNode extends Arg<typeof visit> {
65
- /**
66
- * Directive name.
67
- */
68
- name: string
69
- /**
70
- * Directive attributes.
71
- */
72
- attributes?: Nullable<Record<string, Optional<Nullable<string>>>>
73
-
74
- /**
75
- * Info from the ecosystem.
76
- */
77
- data?: AugmentedData
78
-
79
- /**
80
- * Children of the directive.
81
- */
82
- children: AugmentedNode[]
83
- }
84
-
85
- /**
86
- * Info associated with hast nodes by the ecosystem.
87
- *
88
- * Augmented from {@link https://github.com/syntax-tree/mdast-util-to-hast/blob/main/index.d.ts | mdast-util-to-hast}.
89
- */
90
- interface AugmentedData extends Data {
91
- /**
92
- * Signal that a node should result in something with these children.
93
- *
94
- * When this is defined, when a parent is created, these children will be used.
95
- */
96
- hChildren?: ElementContent[]
97
-
98
- /**
99
- * Signal that a node should result in a particular element, instead of its default behavior.
100
- *
101
- * When this is defined, an element with the given tag name is created.
102
- * For example, when setting `hName` to `'b'`, a `<b>` element is created.
103
- */
104
- hName?: string
105
-
106
- /**
107
- * Signal that a node should result in an element with these properties.
108
- *
109
- * When this is defined, when an element is created, these properties will be used.
110
- */
111
- hProperties?: Properties
112
- }
@@ -1,13 +0,0 @@
1
- import { expect, test } from "@libs/testing"
2
- import { Renderer } from "../renderer.ts"
3
- import plugin, { directive, h } from "./directives.ts"
4
-
5
- test("deno")("Plugin.directives renders custom directive blocks", async () => {
6
- const custom = directive((node) => {
7
- node.data ??= {}
8
- node.data.hName = "div"
9
- node.data.hProperties = h(node.data.hName, { bar: "qux" }).properties
10
- })
11
- const markdown = new Renderer({ plugins: [plugin, custom] })
12
- await expect(markdown.render(":::foo\nbaz\n:::")).resolves.toMatch(/<div bar="qux"><p>baz<\/p><\/div>/)
13
- })