@temelj/mdx 0.14.0 → 0.16.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 (381) hide show
  1. package/README.md +470 -82
  2. package/dist/character-entities.d.mts +4 -0
  3. package/dist/character-entities.d.mts.map +1 -0
  4. package/dist/character-entities.mjs +2132 -0
  5. package/dist/character-entities.mjs.map +1 -0
  6. package/dist/character-reference.d.mts +6 -0
  7. package/dist/character-reference.d.mts.map +1 -0
  8. package/dist/character-reference.mjs +18 -0
  9. package/dist/character-reference.mjs.map +1 -0
  10. package/dist/compile-analysis.d.mts +28 -0
  11. package/dist/compile-analysis.d.mts.map +1 -0
  12. package/dist/compile-analysis.mjs +74 -0
  13. package/dist/compile-analysis.mjs.map +1 -0
  14. package/dist/compile-emit.d.mts +9 -0
  15. package/dist/compile-emit.d.mts.map +1 -0
  16. package/dist/compile-emit.mjs +187 -0
  17. package/dist/compile-emit.mjs.map +1 -0
  18. package/dist/compile-esm.d.mts +34 -0
  19. package/dist/compile-esm.d.mts.map +1 -0
  20. package/dist/compile-esm.mjs +187 -0
  21. package/dist/compile-esm.mjs.map +1 -0
  22. package/dist/compile-names.d.mts +13 -0
  23. package/dist/compile-names.d.mts.map +1 -0
  24. package/dist/compile-names.mjs +32 -0
  25. package/dist/compile-names.mjs.map +1 -0
  26. package/dist/compiler.d.mts +69 -85
  27. package/dist/compiler.d.mts.map +1 -1
  28. package/dist/compiler.mjs +167 -420
  29. package/dist/compiler.mjs.map +1 -1
  30. package/dist/diagnostics.d.mts +37 -0
  31. package/dist/diagnostics.d.mts.map +1 -0
  32. package/dist/diagnostics.mjs +57 -0
  33. package/dist/diagnostics.mjs.map +1 -0
  34. package/dist/errors.d.mts +157 -0
  35. package/dist/errors.d.mts.map +1 -0
  36. package/dist/errors.mjs +263 -0
  37. package/dist/errors.mjs.map +1 -0
  38. package/dist/footnote-numbering.d.mts +27 -0
  39. package/dist/footnote-numbering.d.mts.map +1 -0
  40. package/dist/footnote-numbering.mjs +49 -0
  41. package/dist/footnote-numbering.mjs.map +1 -0
  42. package/dist/format-context.d.mts +46 -0
  43. package/dist/format-context.d.mts.map +1 -0
  44. package/dist/format-context.mjs +26 -0
  45. package/dist/format-context.mjs.map +1 -0
  46. package/dist/format-directive.d.mts +9 -0
  47. package/dist/format-directive.d.mts.map +1 -0
  48. package/dist/format-directive.mjs +99 -0
  49. package/dist/format-directive.mjs.map +1 -0
  50. package/dist/format-jsx.d.mts +8 -0
  51. package/dist/format-jsx.d.mts.map +1 -0
  52. package/dist/format-jsx.mjs +47 -0
  53. package/dist/format-jsx.mjs.map +1 -0
  54. package/dist/format-math.d.mts +9 -0
  55. package/dist/format-math.d.mts.map +1 -0
  56. package/dist/format-math.mjs +79 -0
  57. package/dist/format-math.mjs.map +1 -0
  58. package/dist/format-safe.d.mts +25 -0
  59. package/dist/format-safe.d.mts.map +1 -0
  60. package/dist/format-safe.mjs +366 -0
  61. package/dist/format-safe.mjs.map +1 -0
  62. package/dist/format-table.d.mts +8 -0
  63. package/dist/format-table.d.mts.map +1 -0
  64. package/dist/format-table.mjs +55 -0
  65. package/dist/format-table.mjs.map +1 -0
  66. package/dist/format-track.d.mts +18 -0
  67. package/dist/format-track.d.mts.map +1 -0
  68. package/dist/format-track.mjs +34 -0
  69. package/dist/format-track.mjs.map +1 -0
  70. package/dist/format.d.mts +7 -0
  71. package/dist/format.d.mts.map +1 -0
  72. package/dist/format.mjs +549 -0
  73. package/dist/format.mjs.map +1 -0
  74. package/dist/frontmatter-decode.d.mts +15 -0
  75. package/dist/frontmatter-decode.d.mts.map +1 -0
  76. package/dist/frontmatter-decode.mjs +187 -0
  77. package/dist/frontmatter-decode.mjs.map +1 -0
  78. package/dist/frontmatter-schema.d.mts +8 -0
  79. package/dist/frontmatter-schema.d.mts.map +1 -0
  80. package/dist/frontmatter-schema.mjs +28 -0
  81. package/dist/frontmatter-schema.mjs.map +1 -0
  82. package/dist/frontmatter.d.mts +40 -0
  83. package/dist/frontmatter.d.mts.map +1 -0
  84. package/dist/frontmatter.mjs +109 -0
  85. package/dist/frontmatter.mjs.map +1 -0
  86. package/dist/heading.d.mts +6 -0
  87. package/dist/heading.d.mts.map +1 -0
  88. package/dist/heading.mjs +19 -0
  89. package/dist/heading.mjs.map +1 -0
  90. package/dist/html-format.d.mts +32 -0
  91. package/dist/html-format.d.mts.map +1 -0
  92. package/dist/html-format.mjs +127 -0
  93. package/dist/html-format.mjs.map +1 -0
  94. package/dist/html-lower.d.mts +78 -0
  95. package/dist/html-lower.d.mts.map +1 -0
  96. package/dist/html-lower.mjs +583 -0
  97. package/dist/html-lower.mjs.map +1 -0
  98. package/dist/html-stream.d.mts +13 -0
  99. package/dist/html-stream.d.mts.map +1 -0
  100. package/dist/html-stream.mjs +32 -0
  101. package/dist/html-stream.mjs.map +1 -0
  102. package/dist/html.d.mts +120 -0
  103. package/dist/html.d.mts.map +1 -0
  104. package/dist/html.mjs +77 -0
  105. package/dist/html.mjs.map +1 -0
  106. package/dist/identifier.d.mts +4 -0
  107. package/dist/identifier.d.mts.map +1 -0
  108. package/dist/identifier.mjs +8 -0
  109. package/dist/identifier.mjs.map +1 -0
  110. package/dist/javascript-ast.d.mts +16 -0
  111. package/dist/javascript-ast.d.mts.map +1 -0
  112. package/dist/javascript-ast.mjs +39 -0
  113. package/dist/javascript-ast.mjs.map +1 -0
  114. package/dist/javascript-jsx.d.mts +24 -0
  115. package/dist/javascript-jsx.d.mts.map +1 -0
  116. package/dist/javascript-jsx.mjs +189 -0
  117. package/dist/javascript-jsx.mjs.map +1 -0
  118. package/dist/javascript.d.mts +9 -0
  119. package/dist/javascript.d.mts.map +1 -0
  120. package/dist/javascript.mjs +31 -0
  121. package/dist/javascript.mjs.map +1 -0
  122. package/dist/jsx-reference.d.mts +15 -0
  123. package/dist/jsx-reference.d.mts.map +1 -0
  124. package/dist/jsx-reference.mjs +31 -0
  125. package/dist/jsx-reference.mjs.map +1 -0
  126. package/dist/mod.d.mts +26 -9
  127. package/dist/mod.mjs +20 -8
  128. package/dist/model.d.mts +196 -0
  129. package/dist/model.d.mts.map +1 -0
  130. package/dist/model.mjs +113 -0
  131. package/dist/model.mjs.map +1 -0
  132. package/dist/parser/block-container-recognizers.d.mts +40 -0
  133. package/dist/parser/block-container-recognizers.d.mts.map +1 -0
  134. package/dist/parser/block-container-recognizers.mjs +90 -0
  135. package/dist/parser/block-container-recognizers.mjs.map +1 -0
  136. package/dist/parser/block-directive-recognizers.d.mts +22 -0
  137. package/dist/parser/block-directive-recognizers.d.mts.map +1 -0
  138. package/dist/parser/block-directive-recognizers.mjs +77 -0
  139. package/dist/parser/block-directive-recognizers.mjs.map +1 -0
  140. package/dist/parser/block-leaf-recognizers.d.mts +53 -0
  141. package/dist/parser/block-leaf-recognizers.d.mts.map +1 -0
  142. package/dist/parser/block-leaf-recognizers.mjs +386 -0
  143. package/dist/parser/block-leaf-recognizers.mjs.map +1 -0
  144. package/dist/parser/block-parser.d.mts +38 -0
  145. package/dist/parser/block-parser.d.mts.map +1 -0
  146. package/dist/parser/block-parser.mjs +895 -0
  147. package/dist/parser/block-parser.mjs.map +1 -0
  148. package/dist/parser/block-syntax.d.mts +240 -0
  149. package/dist/parser/block-syntax.d.mts.map +1 -0
  150. package/dist/parser/characters.d.mts +19 -0
  151. package/dist/parser/characters.d.mts.map +1 -0
  152. package/dist/parser/characters.mjs +52 -0
  153. package/dist/parser/characters.mjs.map +1 -0
  154. package/dist/parser/config.d.mts +16 -0
  155. package/dist/parser/config.d.mts.map +1 -0
  156. package/dist/parser/config.mjs +25 -0
  157. package/dist/parser/config.mjs.map +1 -0
  158. package/dist/parser/directive-attributes.d.mts +9 -0
  159. package/dist/parser/directive-attributes.d.mts.map +1 -0
  160. package/dist/parser/directive-attributes.mjs +24 -0
  161. package/dist/parser/directive-attributes.mjs.map +1 -0
  162. package/dist/parser/embedded-scanner.d.mts +18 -0
  163. package/dist/parser/embedded-scanner.d.mts.map +1 -0
  164. package/dist/parser/embedded-scanner.mjs +199 -0
  165. package/dist/parser/embedded-scanner.mjs.map +1 -0
  166. package/dist/parser/inline-autolink.d.mts +7 -0
  167. package/dist/parser/inline-autolink.d.mts.map +1 -0
  168. package/dist/parser/inline-autolink.mjs +42 -0
  169. package/dist/parser/inline-autolink.mjs.map +1 -0
  170. package/dist/parser/inline-character-reference.d.mts +7 -0
  171. package/dist/parser/inline-character-reference.d.mts.map +1 -0
  172. package/dist/parser/inline-character-reference.mjs +22 -0
  173. package/dist/parser/inline-character-reference.mjs.map +1 -0
  174. package/dist/parser/inline-code.d.mts +7 -0
  175. package/dist/parser/inline-code.d.mts.map +1 -0
  176. package/dist/parser/inline-code.mjs +29 -0
  177. package/dist/parser/inline-code.mjs.map +1 -0
  178. package/dist/parser/inline-directive.d.mts +9 -0
  179. package/dist/parser/inline-directive.d.mts.map +1 -0
  180. package/dist/parser/inline-directive.mjs +45 -0
  181. package/dist/parser/inline-directive.mjs.map +1 -0
  182. package/dist/parser/inline-embedded.d.mts +19 -0
  183. package/dist/parser/inline-embedded.d.mts.map +1 -0
  184. package/dist/parser/inline-embedded.mjs +92 -0
  185. package/dist/parser/inline-embedded.mjs.map +1 -0
  186. package/dist/parser/inline-emphasis.d.mts +11 -0
  187. package/dist/parser/inline-emphasis.d.mts.map +1 -0
  188. package/dist/parser/inline-emphasis.mjs +79 -0
  189. package/dist/parser/inline-emphasis.mjs.map +1 -0
  190. package/dist/parser/inline-input.d.mts +46 -0
  191. package/dist/parser/inline-input.d.mts.map +1 -0
  192. package/dist/parser/inline-input.mjs +137 -0
  193. package/dist/parser/inline-input.mjs.map +1 -0
  194. package/dist/parser/inline-link.d.mts +12 -0
  195. package/dist/parser/inline-link.d.mts.map +1 -0
  196. package/dist/parser/inline-link.mjs +187 -0
  197. package/dist/parser/inline-link.mjs.map +1 -0
  198. package/dist/parser/inline-math.d.mts +10 -0
  199. package/dist/parser/inline-math.d.mts.map +1 -0
  200. package/dist/parser/inline-math.mjs +46 -0
  201. package/dist/parser/inline-math.mjs.map +1 -0
  202. package/dist/parser/inline-output.d.mts +34 -0
  203. package/dist/parser/inline-output.d.mts.map +1 -0
  204. package/dist/parser/inline-output.mjs +62 -0
  205. package/dist/parser/inline-output.mjs.map +1 -0
  206. package/dist/parser/inline-parser.d.mts +14 -0
  207. package/dist/parser/inline-parser.d.mts.map +1 -0
  208. package/dist/parser/inline-parser.mjs +328 -0
  209. package/dist/parser/inline-parser.mjs.map +1 -0
  210. package/dist/parser/inline-pending.d.mts +23 -0
  211. package/dist/parser/inline-pending.d.mts.map +1 -0
  212. package/dist/parser/inline-pending.mjs +100 -0
  213. package/dist/parser/inline-pending.mjs.map +1 -0
  214. package/dist/parser/inline-syntax.d.mts +118 -0
  215. package/dist/parser/inline-syntax.d.mts.map +1 -0
  216. package/dist/parser/inline-syntax.mjs +1 -0
  217. package/dist/parser/javascript-boundary.d.mts +16 -0
  218. package/dist/parser/javascript-boundary.d.mts.map +1 -0
  219. package/dist/parser/javascript-boundary.mjs +42 -0
  220. package/dist/parser/javascript-boundary.mjs.map +1 -0
  221. package/dist/parser/javascript-scanner.d.mts +22 -0
  222. package/dist/parser/javascript-scanner.d.mts.map +1 -0
  223. package/dist/parser/javascript-scanner.mjs +122 -0
  224. package/dist/parser/javascript-scanner.mjs.map +1 -0
  225. package/dist/parser/materialize-cache.d.mts +34 -0
  226. package/dist/parser/materialize-cache.d.mts.map +1 -0
  227. package/dist/parser/materialize-cache.mjs +12 -0
  228. package/dist/parser/materialize-cache.mjs.map +1 -0
  229. package/dist/parser/materialize-jsx.d.mts +14 -0
  230. package/dist/parser/materialize-jsx.d.mts.map +1 -0
  231. package/dist/parser/materialize-jsx.mjs +76 -0
  232. package/dist/parser/materialize-jsx.mjs.map +1 -0
  233. package/dist/parser/materialize.d.mts +61 -0
  234. package/dist/parser/materialize.d.mts.map +1 -0
  235. package/dist/parser/materialize.mjs +736 -0
  236. package/dist/parser/materialize.mjs.map +1 -0
  237. package/dist/parser/recognizer.d.mts +20 -0
  238. package/dist/parser/recognizer.d.mts.map +1 -0
  239. package/dist/parser/recognizer.mjs +24 -0
  240. package/dist/parser/recognizer.mjs.map +1 -0
  241. package/dist/parser/session.d.mts +42 -0
  242. package/dist/parser/session.d.mts.map +1 -0
  243. package/dist/parser/session.mjs +89 -0
  244. package/dist/parser/session.mjs.map +1 -0
  245. package/dist/parser.d.mts +25 -0
  246. package/dist/parser.d.mts.map +1 -0
  247. package/dist/parser.mjs +37 -0
  248. package/dist/parser.mjs.map +1 -0
  249. package/dist/plugin-internal.d.mts +25 -0
  250. package/dist/plugin-internal.d.mts.map +1 -0
  251. package/dist/plugin-internal.mjs +99 -0
  252. package/dist/plugin-internal.mjs.map +1 -0
  253. package/dist/plugin.d.mts +37 -0
  254. package/dist/plugin.d.mts.map +1 -0
  255. package/dist/plugin.mjs +1 -0
  256. package/dist/plugins/code-block-metadata.d.mts +42 -0
  257. package/dist/plugins/code-block-metadata.d.mts.map +1 -0
  258. package/dist/plugins/code-block-metadata.mjs +133 -0
  259. package/dist/plugins/code-block-metadata.mjs.map +1 -0
  260. package/dist/plugins/heading-id.d.mts +15 -0
  261. package/dist/plugins/heading-id.d.mts.map +1 -0
  262. package/dist/plugins/heading-id.mjs +45 -0
  263. package/dist/plugins/heading-id.mjs.map +1 -0
  264. package/dist/plugins/lower-heading.d.mts +16 -0
  265. package/dist/plugins/lower-heading.d.mts.map +1 -0
  266. package/dist/plugins/lower-heading.mjs +28 -0
  267. package/dist/plugins/lower-heading.mjs.map +1 -0
  268. package/dist/plugins/math-render.d.mts +26 -0
  269. package/dist/plugins/math-render.d.mts.map +1 -0
  270. package/dist/plugins/math-render.mjs +51 -0
  271. package/dist/plugins/math-render.mjs.map +1 -0
  272. package/dist/plugins/mod.d.mts +9 -6
  273. package/dist/plugins/mod.mjs +8 -6
  274. package/dist/plugins/remove-esm.d.mts +10 -0
  275. package/dist/plugins/remove-esm.d.mts.map +1 -0
  276. package/dist/plugins/remove-esm.mjs +12 -0
  277. package/dist/plugins/remove-esm.mjs.map +1 -0
  278. package/dist/plugins/shiki.d.mts +21 -0
  279. package/dist/plugins/shiki.d.mts.map +1 -0
  280. package/dist/plugins/shiki.mjs +144 -0
  281. package/dist/plugins/shiki.mjs.map +1 -0
  282. package/dist/plugins/syntax-highlight.d.mts +38 -0
  283. package/dist/plugins/syntax-highlight.d.mts.map +1 -0
  284. package/dist/plugins/syntax-highlight.mjs +106 -0
  285. package/dist/plugins/syntax-highlight.mjs.map +1 -0
  286. package/dist/processor.d.mts +60 -0
  287. package/dist/processor.d.mts.map +1 -0
  288. package/dist/processor.mjs +106 -0
  289. package/dist/processor.mjs.map +1 -0
  290. package/dist/ranges.d.mts +10 -0
  291. package/dist/ranges.d.mts.map +1 -0
  292. package/dist/ranges.mjs +22 -0
  293. package/dist/ranges.mjs.map +1 -0
  294. package/dist/source-map.d.mts +28 -0
  295. package/dist/source-map.d.mts.map +1 -0
  296. package/dist/source-map.mjs +90 -0
  297. package/dist/source-map.mjs.map +1 -0
  298. package/dist/source-text.d.mts +35 -0
  299. package/dist/source-text.d.mts.map +1 -0
  300. package/dist/source-text.mjs +136 -0
  301. package/dist/source-text.mjs.map +1 -0
  302. package/dist/source.d.mts +86 -0
  303. package/dist/source.d.mts.map +1 -0
  304. package/dist/source.mjs +264 -0
  305. package/dist/source.mjs.map +1 -0
  306. package/dist/stream-events.d.mts +59 -0
  307. package/dist/stream-events.d.mts.map +1 -0
  308. package/dist/stream-events.mjs +115 -0
  309. package/dist/stream-events.mjs.map +1 -0
  310. package/dist/stream-session.d.mts +79 -0
  311. package/dist/stream-session.d.mts.map +1 -0
  312. package/dist/stream-session.mjs +904 -0
  313. package/dist/stream-session.mjs.map +1 -0
  314. package/dist/stream-tail.d.mts +84 -0
  315. package/dist/stream-tail.d.mts.map +1 -0
  316. package/dist/stream-tail.mjs +359 -0
  317. package/dist/stream-tail.mjs.map +1 -0
  318. package/dist/stream-types.d.mts +89 -0
  319. package/dist/stream-types.d.mts.map +1 -0
  320. package/dist/stream-types.mjs +1 -0
  321. package/dist/stream.d.mts +28 -0
  322. package/dist/stream.d.mts.map +1 -0
  323. package/dist/stream.mjs +68 -0
  324. package/dist/stream.mjs.map +1 -0
  325. package/dist/syntax-options.d.mts +21 -0
  326. package/dist/syntax-options.d.mts.map +1 -0
  327. package/dist/syntax-options.mjs +26 -0
  328. package/dist/syntax-options.mjs.map +1 -0
  329. package/dist/traversal.d.mts +25 -0
  330. package/dist/traversal.d.mts.map +1 -0
  331. package/dist/traversal.mjs +136 -0
  332. package/dist/traversal.mjs.map +1 -0
  333. package/dist/tree.d.mts +18 -0
  334. package/dist/tree.d.mts.map +1 -0
  335. package/dist/tree.mjs +43 -0
  336. package/dist/tree.mjs.map +1 -0
  337. package/dist/unified/adapter.d.mts +24 -0
  338. package/dist/unified/adapter.d.mts.map +1 -0
  339. package/dist/unified/adapter.mjs +44 -0
  340. package/dist/unified/adapter.mjs.map +1 -0
  341. package/dist/unified/mod.d.mts +2 -0
  342. package/dist/unified/mod.mjs +1 -0
  343. package/dist/unified/runtime.d.mts +10 -0
  344. package/dist/unified/runtime.d.mts.map +1 -0
  345. package/dist/unified/runtime.mjs +115 -0
  346. package/dist/unified/runtime.mjs.map +1 -0
  347. package/dist/unified/tree-bridge.d.mts +63 -0
  348. package/dist/unified/tree-bridge.d.mts.map +1 -0
  349. package/dist/unified/tree-bridge.mjs +876 -0
  350. package/dist/unified/tree-bridge.mjs.map +1 -0
  351. package/dist/uri.d.mts +5 -0
  352. package/dist/uri.d.mts.map +1 -0
  353. package/dist/uri.mjs +32 -0
  354. package/dist/uri.mjs.map +1 -0
  355. package/package.json +56 -30
  356. package/dist/plugins/heading-id/plugin.d.mts +0 -17
  357. package/dist/plugins/heading-id/plugin.d.mts.map +0 -1
  358. package/dist/plugins/heading-id/plugin.mjs +0 -23
  359. package/dist/plugins/heading-id/plugin.mjs.map +0 -1
  360. package/dist/plugins/katex/plugin.d.mts +0 -39
  361. package/dist/plugins/katex/plugin.d.mts.map +0 -1
  362. package/dist/plugins/katex/plugin.mjs +0 -107
  363. package/dist/plugins/katex/plugin.mjs.map +0 -1
  364. package/dist/plugins/remove-imports-exports.d.mts +0 -10
  365. package/dist/plugins/remove-imports-exports.d.mts.map +0 -1
  366. package/dist/plugins/remove-imports-exports.mjs +0 -15
  367. package/dist/plugins/remove-imports-exports.mjs.map +0 -1
  368. package/dist/plugins/syntax-highlight/code-meta.d.mts +0 -22
  369. package/dist/plugins/syntax-highlight/code-meta.d.mts.map +0 -1
  370. package/dist/plugins/syntax-highlight/code-meta.mjs +0 -38
  371. package/dist/plugins/syntax-highlight/code-meta.mjs.map +0 -1
  372. package/dist/plugins/syntax-highlight/plugin.d.mts +0 -57
  373. package/dist/plugins/syntax-highlight/plugin.d.mts.map +0 -1
  374. package/dist/plugins/syntax-highlight/plugin.mjs +0 -93
  375. package/dist/plugins/syntax-highlight/plugin.mjs.map +0 -1
  376. package/dist/plugins/tree-processor/plugin.d.mts +0 -19
  377. package/dist/plugins/tree-processor/plugin.d.mts.map +0 -1
  378. package/dist/plugins/tree-processor/plugin.mjs +0 -21
  379. package/dist/plugins/tree-processor/plugin.mjs.map +0 -1
  380. package/dist/types.d.mts +0 -2
  381. /package/dist/{types.mjs → parser/block-syntax.mjs} +0 -0
@@ -0,0 +1,127 @@
1
+ import { encodeNumericCharacterReference } from "./character-reference.mjs";
2
+ import { InputError } from "./errors.mjs";
3
+ import { htmlFallback, pendingFallback } from "./html.mjs";
4
+ import { isNumber } from "@temelj/value";
5
+ //#region src/html-format.ts
6
+ /** Serializes an HTML tree. JSX renders as its escaped authored fallback. */
7
+ function formatHtml(node, options = {}) {
8
+ return new HtmlFormatter(options).format(node);
9
+ }
10
+ const TAG_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9:-]*$/u;
11
+ const ATTRIBUTE_NAME_PATTERN = /[\0\t\n\f\r "&'/<=>`]/gu;
12
+ const UNQUOTED_ATTRIBUTE_PATTERN = /[\0\t\n\f\r "&'<=>`]/gu;
13
+ const DOUBLE_QUOTED_ATTRIBUTE_PATTERN = /[\0"&]/gu;
14
+ const SINGE_QUOTED_ATTRIBUTE_PATTERN = /[\0'&]/gu;
15
+ const HTML_VOID_ELEMENTS = /* @__PURE__ */ new Set([
16
+ "area",
17
+ "base",
18
+ "basefont",
19
+ "bgsound",
20
+ "link",
21
+ "meta",
22
+ "input",
23
+ "embed",
24
+ "param",
25
+ "hr",
26
+ "image",
27
+ "img",
28
+ "br",
29
+ "wbr",
30
+ "col",
31
+ "source",
32
+ "track",
33
+ "keygen"
34
+ ]);
35
+ var HtmlFormatter = class {
36
+ options;
37
+ voids;
38
+ constructor(options) {
39
+ this.options = options;
40
+ this.voids = options.voidElements === void 0 ? HTML_VOID_ELEMENTS : new Set(options.voidElements.map((name) => name.toLowerCase()));
41
+ }
42
+ format(node) {
43
+ switch (node.kind) {
44
+ case "jsx":
45
+ case "expression": return escapeHtmlText(node.fallback);
46
+ case "text": return escapeHtmlText(node.value);
47
+ case "raw": return this.options.rawHtml === "trusted" ? node.value : escapeHtmlText(node.value);
48
+ case "comment": return formatComment(node.value);
49
+ case "doctype": return "<!doctype html>";
50
+ case "element": return this.element(node.tagName, node.attributes, this.children(node.children));
51
+ case "root": return this.children(node.children);
52
+ case "codeBlock":
53
+ case "math":
54
+ case "footnoteReference":
55
+ case "footnoteSection": return this.format(htmlFallback(node));
56
+ case "pending":
57
+ case "unresolvedReference": return this.children(pendingFallback(node));
58
+ default: return node;
59
+ }
60
+ }
61
+ element(tagName, values, content) {
62
+ if (!TAG_NAME_PATTERN.test(tagName)) throw InputError.invalidHtmlTagName(tagName);
63
+ let opening = `<${tagName}`;
64
+ for (const name in values) if (Object.hasOwn(values, name)) {
65
+ const attribute = this.attribute(name, values[name]);
66
+ if (attribute.length > 0) opening += ` ${attribute}`;
67
+ }
68
+ if (this.voids.has(tagName.toLowerCase()) && content.length === 0) {
69
+ if (this.options.closeSelfClosing !== true) return `${opening}>`;
70
+ return `${opening}${this.options.tightSelfClosing === true ? "/" : " /"}>`;
71
+ }
72
+ return `${opening}>${content}</${tagName}>`;
73
+ }
74
+ children(nodes) {
75
+ let content = "";
76
+ for (const node of nodes) content += this.format(node);
77
+ return content;
78
+ }
79
+ attribute(name, value) {
80
+ if (value === false || isNumber(value) && Number.isNaN(value)) return "";
81
+ const encodedName = escapeAttribute(name, ATTRIBUTE_NAME_PATTERN);
82
+ if (value === true) return encodedName;
83
+ const serialized = Array.isArray(value) ? value.join(" ") : String(value);
84
+ if (this.options.collapseEmptyAttributes === true && serialized.length === 0) return encodedName;
85
+ if (this.options.preferUnquotedAttributes === true && serialized.length > 0 && !/[\0\t\n\f\r "'`=<>]/u.test(serialized)) return `${encodedName}=${escapeAttribute(serialized, UNQUOTED_ATTRIBUTE_PATTERN)}`;
86
+ const preferred = this.options.quote ?? "\"";
87
+ const alternative = preferred === "\"" ? "'" : "\"";
88
+ const quote = this.options.quoteSmart === true && count(serialized, alternative) < count(serialized, preferred) ? alternative : preferred;
89
+ return `${encodedName}=${quote}${escapeAttribute(serialized, quote === "\"" ? DOUBLE_QUOTED_ATTRIBUTE_PATTERN : SINGE_QUOTED_ATTRIBUTE_PATTERN)}${quote}`;
90
+ }
91
+ };
92
+ /** Internal formatter for immutable nodes owned by one stream. */
93
+ var CachedHtmlFormatter = class extends HtmlFormatter {
94
+ #cache = /* @__PURE__ */ new WeakMap();
95
+ format(node) {
96
+ const hit = this.#cache.get(node);
97
+ if (hit !== void 0) return hit;
98
+ const html = super.format(node);
99
+ this.#cache.set(node, html);
100
+ return html;
101
+ }
102
+ };
103
+ function formatComment(value) {
104
+ return `<!--${value.replace(/^>|^->|<!--|-->|--!>|<!-$/gu, (match) => escapeComment(match))}-->`;
105
+ }
106
+ function escapeComment(value) {
107
+ return value.replace(/[<>]/gu, (character) => character === "<" ? "&lt;" : "&gt;");
108
+ }
109
+ function escapeHtmlText(value) {
110
+ return /[&<]/u.test(value) ? value.replace(/[&<]/gu, (character) => character === "&" ? "&amp;" : "&lt;") : value;
111
+ }
112
+ function escapeAttribute(value, pattern) {
113
+ pattern.lastIndex = 0;
114
+ return pattern.test(value) ? value.replace(pattern, encodeCharacterReference) : value;
115
+ }
116
+ function encodeCharacterReference(character) {
117
+ return character === "\0" ? "&#xFFFD;" : encodeNumericCharacterReference(character.codePointAt(0) ?? 0);
118
+ }
119
+ function count(value, character) {
120
+ let result = 0;
121
+ for (const candidate of value) if (candidate === character) result++;
122
+ return result;
123
+ }
124
+ //#endregion
125
+ export { CachedHtmlFormatter, formatHtml };
126
+
127
+ //# sourceMappingURL=html-format.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-format.mjs","names":["exhaustive"],"sources":["../src/html-format.ts"],"sourcesContent":["import { isNumber } from \"@temelj/value\";\n\nimport type { HtmlAttributes, HtmlAttributeValue, HtmlNode } from \"./html.ts\";\n\nimport { encodeNumericCharacterReference } from \"./character-reference.ts\";\nimport { InputError } from \"./errors.ts\";\nimport { htmlFallback, pendingFallback } from \"./html.ts\";\n\nexport interface HtmlFormatOptions {\n readonly closeSelfClosing?: boolean;\n readonly collapseEmptyAttributes?: boolean;\n readonly preferUnquotedAttributes?: boolean;\n readonly quote?: '\"' | \"'\";\n readonly quoteSmart?: boolean;\n /** Raw HTML is escaped unless it is explicitly trusted. */\n readonly rawHtml?: \"escape\" | \"trusted\";\n readonly tightSelfClosing?: boolean;\n readonly voidElements?: readonly string[];\n}\n\n/** Serializes an HTML tree. JSX renders as its escaped authored fallback. */\nexport function formatHtml(node: HtmlNode, options: HtmlFormatOptions = {}): string {\n return new HtmlFormatter(options).format(node);\n}\n\nconst TAG_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9:-]*$/u;\n\nconst ATTRIBUTE_NAME_PATTERN = /[\\0\\t\\n\\f\\r \"&'/<=>`]/gu;\n\nconst UNQUOTED_ATTRIBUTE_PATTERN = /[\\0\\t\\n\\f\\r \"&'<=>`]/gu;\n\nconst DOUBLE_QUOTED_ATTRIBUTE_PATTERN = /[\\0\"&]/gu;\n\nconst SINGE_QUOTED_ATTRIBUTE_PATTERN = /[\\0'&]/gu;\n\nconst HTML_VOID_ELEMENTS: ReadonlySet<string> = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"bgsound\",\n \"link\",\n \"meta\",\n \"input\",\n \"embed\",\n \"param\",\n \"hr\",\n \"image\",\n \"img\",\n \"br\",\n \"wbr\",\n \"col\",\n \"source\",\n \"track\",\n \"keygen\",\n]);\n\nclass HtmlFormatter {\n private readonly options: HtmlFormatOptions;\n private readonly voids: ReadonlySet<string>;\n\n public constructor(options: HtmlFormatOptions) {\n this.options = options;\n this.voids =\n options.voidElements === undefined\n ? HTML_VOID_ELEMENTS\n : new Set(options.voidElements.map((name) => name.toLowerCase()));\n }\n\n public format(node: HtmlNode): string {\n switch (node.kind) {\n case \"jsx\":\n case \"expression\":\n return escapeHtmlText(node.fallback);\n case \"text\":\n return escapeHtmlText(node.value);\n case \"raw\":\n return this.options.rawHtml === \"trusted\" ? node.value : escapeHtmlText(node.value);\n case \"comment\":\n return formatComment(node.value);\n case \"doctype\":\n return \"<!doctype html>\";\n case \"element\":\n return this.element(node.tagName, node.attributes, this.children(node.children));\n case \"root\":\n return this.children(node.children);\n case \"codeBlock\":\n case \"math\":\n case \"footnoteReference\":\n case \"footnoteSection\":\n return this.format(htmlFallback(node));\n case \"pending\":\n case \"unresolvedReference\":\n return this.children(pendingFallback(node));\n default: {\n const exhaustive: never = node;\n\n return exhaustive;\n }\n }\n }\n\n public element(tagName: string, values: HtmlAttributes, content: string): string {\n if (!TAG_NAME_PATTERN.test(tagName)) {\n throw InputError.invalidHtmlTagName(tagName);\n }\n\n let opening = `<${tagName}`;\n\n for (const name in values) {\n if (Object.hasOwn(values, name)) {\n const attribute = this.attribute(name, values[name]);\n\n if (attribute.length > 0) {\n opening += ` ${attribute}`;\n }\n }\n }\n\n const isVoid = this.voids.has(tagName.toLowerCase()) && content.length === 0;\n\n if (isVoid) {\n if (this.options.closeSelfClosing !== true) {\n return `${opening}>`;\n }\n\n return `${opening}${this.options.tightSelfClosing === true ? \"/\" : \" /\"}>`;\n }\n\n return `${opening}>${content}</${tagName}>`;\n }\n\n private children(nodes: readonly HtmlNode[]): string {\n let content = \"\";\n\n for (const node of nodes) {\n content += this.format(node);\n }\n\n return content;\n }\n\n private attribute(name: string, value: HtmlAttributeValue): string {\n if (value === false || (isNumber(value) && Number.isNaN(value))) {\n return \"\";\n }\n\n const encodedName = escapeAttribute(name, ATTRIBUTE_NAME_PATTERN);\n\n if (value === true) {\n return encodedName;\n }\n\n const serialized = Array.isArray(value) ? value.join(\" \") : String(value);\n\n if (this.options.collapseEmptyAttributes === true && serialized.length === 0) {\n return encodedName;\n }\n\n if (\n this.options.preferUnquotedAttributes === true &&\n serialized.length > 0 &&\n !/[\\0\\t\\n\\f\\r \"'`=<>]/u.test(serialized)\n ) {\n return `${encodedName}=${escapeAttribute(serialized, UNQUOTED_ATTRIBUTE_PATTERN)}`;\n }\n\n const preferred = this.options.quote ?? '\"';\n const alternative = preferred === '\"' ? \"'\" : '\"';\n\n const quote =\n this.options.quoteSmart === true &&\n count(serialized, alternative) < count(serialized, preferred)\n ? alternative\n : preferred;\n\n const pattern =\n quote === '\"' ? DOUBLE_QUOTED_ATTRIBUTE_PATTERN : SINGE_QUOTED_ATTRIBUTE_PATTERN;\n\n return `${encodedName}=${quote}${escapeAttribute(serialized, pattern)}${quote}`;\n }\n}\n\n/** Internal formatter for immutable nodes owned by one stream. */\nexport class CachedHtmlFormatter extends HtmlFormatter {\n readonly #cache = new WeakMap<HtmlNode, string>();\n\n public override format(node: HtmlNode): string {\n const hit = this.#cache.get(node);\n\n if (hit !== undefined) {\n return hit;\n }\n\n const html = super.format(node);\n\n this.#cache.set(node, html);\n\n return html;\n }\n}\n\nfunction formatComment(value: string): string {\n return `<!--${value.replace(/^>|^->|<!--|-->|--!>|<!-$/gu, (match) => escapeComment(match))}-->`;\n}\n\nfunction escapeComment(value: string): string {\n return value.replace(/[<>]/gu, (character) => (character === \"<\" ? \"&lt;\" : \"&gt;\"));\n}\n\nfunction escapeHtmlText(value: string): string {\n return /[&<]/u.test(value)\n ? value.replace(/[&<]/gu, (character) => (character === \"&\" ? \"&amp;\" : \"&lt;\"))\n : value;\n}\n\nfunction escapeAttribute(value: string, pattern: RegExp): string {\n // Shared global patterns must start at the beginning for each attribute.\n pattern.lastIndex = 0;\n\n return pattern.test(value) ? value.replace(pattern, encodeCharacterReference) : value;\n}\n\nfunction encodeCharacterReference(character: string): string {\n return character === \"\\0\"\n ? \"&#xFFFD;\"\n : encodeNumericCharacterReference(character.codePointAt(0) ?? 0);\n}\n\nfunction count(value: string, character: string): number {\n let result = 0;\n\n for (const candidate of value) {\n if (candidate === character) {\n result++;\n }\n }\n\n return result;\n}\n"],"mappings":"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"}
@@ -0,0 +1,78 @@
1
+ import { FootnoteNumbering, FootnoteOccurrence } from "./footnote-numbering.mjs";
2
+ import { DefinitionNode, DocumentNode, FootnoteDefinitionNode, FootnoteReferenceNode, ListItemNode, MdxNode } from "./model.mjs";
3
+ import { HtmlFootnoteSectionNode, HtmlNode, HtmlRootNode } from "./html.mjs";
4
+ import { SourceFile } from "./source.mjs";
5
+ //#region src/html-lower.d.ts
6
+ export interface HtmlRenderOptions {
7
+ readonly allowUnsafeUrls?: boolean;
8
+ readonly clobberPrefix?: string;
9
+ readonly footnoteBackLabel?: string | ((referenceIndex: number, rereferenceIndex: number) => string);
10
+ readonly footnoteLabel?: string;
11
+ readonly footnoteLabelTagName?: string;
12
+ /** The file that node origins refer to. Inert fallbacks then keep authored text. */
13
+ readonly source?: SourceFile;
14
+ /**
15
+ * Rewrites link and image URLs. `sanitized` is the default policy result, or
16
+ * `undefined` when the default removes the URL; returning `undefined` removes it.
17
+ */
18
+ readonly urlTransform?: (url: string, kind: "image" | "link", sanitized: string | undefined) => string | undefined;
19
+ }
20
+ /**
21
+ * Lowered HTML by node identity, separately for tight and loose list context. A
22
+ * cache is valid while link definitions are unchanged. Subtrees that depend on
23
+ * footnote numbering or a replacement are never cached.
24
+ */
25
+ export interface HtmlLoweringCache {
26
+ readonly loose: WeakMap<MdxNode, LoweredHtml>;
27
+ readonly tight: WeakMap<MdxNode, LoweredHtml>;
28
+ /** A growing list's lowered children, by the item they end with. */
29
+ readonly lists: WeakMap<ListItemNode, ListPrefix>;
30
+ }
31
+ /** The wrapped children of a list's first `index + 1` items. */
32
+ interface ListPrefix {
33
+ readonly index: number;
34
+ readonly loose: boolean;
35
+ readonly spread: boolean;
36
+ readonly tasks: boolean;
37
+ readonly children: SequencePrefix;
38
+ }
39
+ export declare function createHtmlLoweringCache(): HtmlLoweringCache;
40
+ /**
41
+ * What lowering resolves against. Batch lowering derives a scope from one
42
+ * document; a stream assembles one from its settled blocks and open tail.
43
+ */
44
+ export interface LoweringScope {
45
+ readonly definition: (identifier: string) => DefinitionNode | undefined;
46
+ readonly footnote: (identifier: string) => FootnoteDefinitionNode | undefined;
47
+ readonly options: HtmlRenderOptions;
48
+ /** The numbering of a reference to a defined footnote. */
49
+ readonly occurrence: (node: FootnoteReferenceNode) => FootnoteOccurrence | undefined;
50
+ /** Missing references lower to `unresolvedReference` nodes instead of authored text. */
51
+ readonly provisional?: boolean;
52
+ readonly cache?: HtmlLoweringCache;
53
+ /** Lowers one node differently, such as the open leaf of a stream. */
54
+ readonly replace?: (node: MdxNode) => readonly HtmlNode[] | undefined;
55
+ }
56
+ type LoweredHtml = HtmlNode | readonly HtmlNode[] | undefined;
57
+ export declare function lowerHtml(document: DocumentNode, options?: HtmlRenderOptions): HtmlRootNode;
58
+ /**
59
+ * Lowers sibling nodes in one scope. `previous` is the sibling before them,
60
+ * because text after a hard break drops its leading spaces.
61
+ */
62
+ export declare function lowerNodes(nodes: readonly MdxNode[], scope: LoweringScope, previous?: MdxNode): HtmlNode[];
63
+ /** Separates top-level blocks with line endings, like a document root. */
64
+ export declare function joinBlocks(nodes: readonly HtmlNode[]): HtmlNode[];
65
+ /** Footnote reference nodes in document order. */
66
+ export declare function footnoteReferences(node: MdxNode): FootnoteReferenceNode[];
67
+ /** The generated section for the numbered footnotes, or `undefined` when none is referenced. */
68
+ export declare function lowerFootnoteSection(numbering: FootnoteNumbering, scope: LoweringScope): HtmlFootnoteSectionNode | undefined;
69
+ /** A prefix of a child sequence: full fragments, then the nodes after them. */
70
+ interface SequencePrefix {
71
+ readonly fragments: readonly HtmlRootNode[];
72
+ readonly rest: readonly HtmlNode[];
73
+ readonly size: number;
74
+ }
75
+ export declare function sanitizeUrl(value: string, options: HtmlRenderOptions, use: "image" | "link"): string | undefined;
76
+ //#endregion
77
+ export {};
78
+ //# sourceMappingURL=html-lower.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-lower.d.mts","names":[],"sources":["../src/html-lower.ts"],"mappings":";;;;;iBAsCiB;WACN;WACA;WACA,+BAEH,wBAAwB;WACrB;WACA;;WAEA,SAAS;;;;;WAKT,gBACP,aACA,wBACA;;;;;;;iBASa;WACN,OAAO,QAAQ,SAAS;WACxB,OAAO,QAAQ,SAAS;;WAExB,OAAO,QAAQ,cAAc;;;UAI9B;WACC;WACA;WACA;WACA;WACA,UAAU;;wBAGL,2BAA2B;;;;;iBAQ1B;WACN,aAAa,uBAAuB;WACpC,WAAW,uBAAuB;WAClC,SAAS;;WAET,aAAa,MAAM,0BAA0B;;WAE7C;WACA,QAAQ;;WAER,WAAW,MAAM,qBAAqB;;KAU5C,cAAc,oBAAoB;wBAYvB,UAAU,UAAU,cAAc,UAAS,oBAAyB;;;;;wBAgCpE,WACd,gBAAgB,WAChB,OAAO,eACP,WAAW,UACV;;wBAKa,WAAW,gBAAgB,aAAa;;wBAKxC,mBAAmB,MAAM,UAAU;;wBA8TnC,qBACd,WAAW,mBACX,OAAO,gBACN;;UAwQO;WACC,oBAAoB;WACpB,eAAe;WACf;;wBAwQK,YACd,eACA,SAAS,mBACT"}