pulpweaver4 0.0.0-stage → 0.0.88

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 (1085) hide show
  1. package/dist/ast/djot.d.ts +123 -0
  2. package/dist/ast/djot.js +458 -0
  3. package/dist/ast/djot.js.map +1 -0
  4. package/dist/ast/index.d.ts +10 -0
  5. package/dist/ast/index.js +11 -0
  6. package/dist/ast/index.js.map +1 -0
  7. package/dist/ast/locator.d.ts +27 -0
  8. package/dist/ast/locator.js +77 -0
  9. package/dist/ast/locator.js.map +1 -0
  10. package/dist/ast/nodes.d.ts +534 -0
  11. package/dist/ast/nodes.js +48 -0
  12. package/dist/ast/nodes.js.map +1 -0
  13. package/dist/ast/position.d.ts +88 -0
  14. package/dist/ast/position.js +98 -0
  15. package/dist/ast/position.js.map +1 -0
  16. package/dist/ast/traverse.d.ts +12 -0
  17. package/dist/ast/traverse.js +37 -0
  18. package/dist/ast/traverse.js.map +1 -0
  19. package/dist/bibliography/biblatex.d.ts +13 -0
  20. package/dist/bibliography/biblatex.js +849 -0
  21. package/dist/bibliography/biblatex.js.map +1 -0
  22. package/dist/bibliography/bibtex.d.ts +39 -0
  23. package/dist/bibliography/bibtex.js +259 -0
  24. package/dist/bibliography/bibtex.js.map +1 -0
  25. package/dist/bibliography/csl.d.ts +9 -0
  26. package/dist/bibliography/csl.js +241 -0
  27. package/dist/bibliography/csl.js.map +1 -0
  28. package/dist/bibliography/dates.d.ts +33 -0
  29. package/dist/bibliography/dates.js +223 -0
  30. package/dist/bibliography/dates.js.map +1 -0
  31. package/dist/bibliography/index.d.ts +8 -0
  32. package/dist/bibliography/index.js +9 -0
  33. package/dist/bibliography/index.js.map +1 -0
  34. package/dist/bibliography/item.d.ts +142 -0
  35. package/dist/bibliography/item.js +181 -0
  36. package/dist/bibliography/item.js.map +1 -0
  37. package/dist/bibliography/latex.d.ts +21 -0
  38. package/dist/bibliography/latex.js +586 -0
  39. package/dist/bibliography/latex.js.map +1 -0
  40. package/dist/bibliography/names.d.ts +23 -0
  41. package/dist/bibliography/names.js +244 -0
  42. package/dist/bibliography/names.js.map +1 -0
  43. package/dist/bibliography/read.d.ts +24 -0
  44. package/dist/bibliography/read.js +50 -0
  45. package/dist/bibliography/read.js.map +1 -0
  46. package/dist/citations/book.d.ts +91 -0
  47. package/dist/citations/book.js +206 -0
  48. package/dist/citations/book.js.map +1 -0
  49. package/dist/citations/collect.d.ts +52 -0
  50. package/dist/citations/collect.js +125 -0
  51. package/dist/citations/collect.js.map +1 -0
  52. package/dist/citations/hast.d.ts +12 -0
  53. package/dist/citations/hast.js +49 -0
  54. package/dist/citations/hast.js.map +1 -0
  55. package/dist/citations/index.d.ts +14 -0
  56. package/dist/citations/index.js +15 -0
  57. package/dist/citations/index.js.map +1 -0
  58. package/dist/citations/lint.d.ts +70 -0
  59. package/dist/citations/lint.js +92 -0
  60. package/dist/citations/lint.js.map +1 -0
  61. package/dist/citations/notes.d.ts +11 -0
  62. package/dist/citations/notes.js +120 -0
  63. package/dist/citations/notes.js.map +1 -0
  64. package/dist/citations/positions.d.ts +34 -0
  65. package/dist/citations/positions.js +90 -0
  66. package/dist/citations/positions.js.map +1 -0
  67. package/dist/citations/project.d.ts +7 -0
  68. package/dist/citations/project.js +24 -0
  69. package/dist/citations/project.js.map +1 -0
  70. package/dist/colour/cmyk.d.ts +71 -0
  71. package/dist/colour/cmyk.js +210 -0
  72. package/dist/colour/cmyk.js.map +1 -0
  73. package/dist/colour/images.d.ts +36 -0
  74. package/dist/colour/images.js +106 -0
  75. package/dist/colour/images.js.map +1 -0
  76. package/dist/colour/index.d.ts +7 -0
  77. package/dist/colour/index.js +8 -0
  78. package/dist/colour/index.js.map +1 -0
  79. package/dist/colour/ink-limit.d.ts +68 -0
  80. package/dist/colour/ink-limit.js +109 -0
  81. package/dist/colour/ink-limit.js.map +1 -0
  82. package/dist/colour/intents.d.ts +135 -0
  83. package/dist/colour/intents.js +183 -0
  84. package/dist/colour/intents.js.map +1 -0
  85. package/dist/colour/lcms.d.ts +79 -0
  86. package/dist/colour/lcms.js +229 -0
  87. package/dist/colour/lcms.js.map +1 -0
  88. package/dist/colour/previews.d.ts +49 -0
  89. package/dist/colour/previews.js +116 -0
  90. package/dist/colour/previews.js.map +1 -0
  91. package/dist/colour/wasm/LICENSE-lcms2 +22 -0
  92. package/dist/colour/wasm/lcms2.wasm +0 -0
  93. package/dist/config/config.d.ts +109 -0
  94. package/dist/config/config.js +295 -0
  95. package/dist/config/config.js.map +1 -0
  96. package/dist/config/index.d.ts +6 -0
  97. package/dist/config/index.js +7 -0
  98. package/dist/config/index.js.map +1 -0
  99. package/dist/config/page.d.ts +42 -0
  100. package/dist/config/page.js +95 -0
  101. package/dist/config/page.js.map +1 -0
  102. package/dist/config/project-schema.d.ts +23 -0
  103. package/dist/config/project-schema.js +209 -0
  104. package/dist/config/project-schema.js.map +1 -0
  105. package/dist/config/schema.d.ts +68 -0
  106. package/dist/config/schema.js +333 -0
  107. package/dist/config/schema.js.map +1 -0
  108. package/dist/config/toml.d.ts +54 -0
  109. package/dist/config/toml.js +238 -0
  110. package/dist/config/toml.js.map +1 -0
  111. package/dist/contents/index.d.ts +8 -0
  112. package/dist/contents/index.js +9 -0
  113. package/dist/contents/index.js.map +1 -0
  114. package/dist/contents/transform.d.ts +64 -0
  115. package/dist/contents/transform.js +149 -0
  116. package/dist/contents/transform.js.map +1 -0
  117. package/dist/csl/affix.d.ts +16 -0
  118. package/dist/csl/affix.js +74 -0
  119. package/dist/csl/affix.js.map +1 -0
  120. package/dist/csl/data/chicago-author-date.d.ts +2 -0
  121. package/dist/csl/data/chicago-author-date.js +3 -0
  122. package/dist/csl/data/chicago-author-date.js.map +1 -0
  123. package/dist/csl/data/chicago-notes-bibliography.d.ts +2 -0
  124. package/dist/csl/data/chicago-notes-bibliography.js +3 -0
  125. package/dist/csl/data/chicago-notes-bibliography.js.map +1 -0
  126. package/dist/csl/data/locales-en-GB.d.ts +2 -0
  127. package/dist/csl/data/locales-en-GB.js +3 -0
  128. package/dist/csl/data/locales-en-GB.js.map +1 -0
  129. package/dist/csl/data/locales-en-US.d.ts +2 -0
  130. package/dist/csl/data/locales-en-US.js +3 -0
  131. package/dist/csl/data/locales-en-US.js.map +1 -0
  132. package/dist/csl/dates.d.ts +30 -0
  133. package/dist/csl/dates.js +223 -0
  134. package/dist/csl/dates.js.map +1 -0
  135. package/dist/csl/format.d.ts +29 -0
  136. package/dist/csl/format.js +157 -0
  137. package/dist/csl/format.js.map +1 -0
  138. package/dist/csl/index.d.ts +26 -0
  139. package/dist/csl/index.js +16 -0
  140. package/dist/csl/index.js.map +1 -0
  141. package/dist/csl/ir.d.ts +103 -0
  142. package/dist/csl/ir.js +549 -0
  143. package/dist/csl/ir.js.map +1 -0
  144. package/dist/csl/load.d.ts +98 -0
  145. package/dist/csl/load.js +163 -0
  146. package/dist/csl/load.js.map +1 -0
  147. package/dist/csl/locale.d.ts +90 -0
  148. package/dist/csl/locale.js +251 -0
  149. package/dist/csl/locale.js.map +1 -0
  150. package/dist/csl/names.d.ts +41 -0
  151. package/dist/csl/names.js +203 -0
  152. package/dist/csl/names.js.map +1 -0
  153. package/dist/csl/numbers.d.ts +48 -0
  154. package/dist/csl/numbers.js +170 -0
  155. package/dist/csl/numbers.js.map +1 -0
  156. package/dist/csl/processor.d.ts +177 -0
  157. package/dist/csl/processor.js +759 -0
  158. package/dist/csl/processor.js.map +1 -0
  159. package/dist/csl/project.d.ts +21 -0
  160. package/dist/csl/project.js +78 -0
  161. package/dist/csl/project.js.map +1 -0
  162. package/dist/csl/render.d.ts +130 -0
  163. package/dist/csl/render.js +748 -0
  164. package/dist/csl/render.js.map +1 -0
  165. package/dist/csl/style.d.ts +168 -0
  166. package/dist/csl/style.js +262 -0
  167. package/dist/csl/style.js.map +1 -0
  168. package/dist/csl/xml.d.ts +28 -0
  169. package/dist/csl/xml.js +162 -0
  170. package/dist/csl/xml.js.map +1 -0
  171. package/dist/djot/djot.js/LICENSE +20 -0
  172. package/dist/djot/djot.js/src/ast.d.ts +324 -0
  173. package/dist/djot/djot.js/src/ast.js +61 -0
  174. package/dist/djot/djot.js/src/ast.js.map +1 -0
  175. package/dist/djot/djot.js/src/attributes.d.ts +31 -0
  176. package/dist/djot/djot.js/src/attributes.js +300 -0
  177. package/dist/djot/djot.js/src/attributes.js.map +1 -0
  178. package/dist/djot/djot.js/src/block.d.ts +87 -0
  179. package/dist/djot/djot.js/src/block.js +1201 -0
  180. package/dist/djot/djot.js/src/block.js.map +1 -0
  181. package/dist/djot/djot.js/src/djot-renderer.d.ts +8 -0
  182. package/dist/djot/djot.js/src/djot-renderer.js +755 -0
  183. package/dist/djot/djot.js/src/djot-renderer.js.map +1 -0
  184. package/dist/djot/djot.js/src/event.d.ts +6 -0
  185. package/dist/djot/djot.js/src/event.js +2 -0
  186. package/dist/djot/djot.js/src/event.js.map +1 -0
  187. package/dist/djot/djot.js/src/filter.d.ts +13 -0
  188. package/dist/djot/djot.js/src/filter.js +159 -0
  189. package/dist/djot/djot.js/src/filter.js.map +1 -0
  190. package/dist/djot/djot.js/src/find.d.ts +7 -0
  191. package/dist/djot/djot.js/src/find.js +33 -0
  192. package/dist/djot/djot.js/src/find.js.map +1 -0
  193. package/dist/djot/djot.js/src/html.d.ts +40 -0
  194. package/dist/djot/djot.js/src/html.js +656 -0
  195. package/dist/djot/djot.js/src/html.js.map +1 -0
  196. package/dist/djot/djot.js/src/index.d.ts +9 -0
  197. package/dist/djot/djot.js/src/index.js +9 -0
  198. package/dist/djot/djot.js/src/index.js.map +1 -0
  199. package/dist/djot/djot.js/src/inline.d.ts +62 -0
  200. package/dist/djot/djot.js/src/inline.js +1019 -0
  201. package/dist/djot/djot.js/src/inline.js.map +1 -0
  202. package/dist/djot/djot.js/src/options.d.ts +13 -0
  203. package/dist/djot/djot.js/src/options.js +27 -0
  204. package/dist/djot/djot.js/src/options.js.map +1 -0
  205. package/dist/djot/djot.js/src/pandoc.d.ts +20 -0
  206. package/dist/djot/djot.js/src/pandoc.js +1040 -0
  207. package/dist/djot/djot.js/src/pandoc.js.map +1 -0
  208. package/dist/djot/djot.js/src/parse.d.ts +19 -0
  209. package/dist/djot/djot.js/src/parse.js +1436 -0
  210. package/dist/djot/djot.js/src/parse.js.map +1 -0
  211. package/dist/djot/djot.js/src/version.d.ts +1 -0
  212. package/dist/djot/djot.js/src/version.js +2 -0
  213. package/dist/djot/djot.js/src/version.js.map +1 -0
  214. package/dist/djot/index.d.ts +5 -0
  215. package/dist/djot/index.js +6 -0
  216. package/dist/djot/index.js.map +1 -0
  217. package/dist/djot/read.d.ts +57 -0
  218. package/dist/djot/read.js +146 -0
  219. package/dist/djot/read.js.map +1 -0
  220. package/dist/fonts/css.d.ts +82 -0
  221. package/dist/fonts/css.js +329 -0
  222. package/dist/fonts/css.js.map +1 -0
  223. package/dist/fonts/faces.d.ts +101 -0
  224. package/dist/fonts/faces.js +226 -0
  225. package/dist/fonts/faces.js.map +1 -0
  226. package/dist/fonts/index.d.ts +12 -0
  227. package/dist/fonts/index.js +13 -0
  228. package/dist/fonts/index.js.map +1 -0
  229. package/dist/fonts/lint.d.ts +58 -0
  230. package/dist/fonts/lint.js +209 -0
  231. package/dist/fonts/lint.js.map +1 -0
  232. package/dist/fonts/match.d.ts +36 -0
  233. package/dist/fonts/match.js +104 -0
  234. package/dist/fonts/match.js.map +1 -0
  235. package/dist/fonts/names.d.ts +9 -0
  236. package/dist/fonts/names.js +50 -0
  237. package/dist/fonts/names.js.map +1 -0
  238. package/dist/fonts/subset.d.ts +72 -0
  239. package/dist/fonts/subset.js +169 -0
  240. package/dist/fonts/subset.js.map +1 -0
  241. package/dist/fonts/walk.d.ts +33 -0
  242. package/dist/fonts/walk.js +120 -0
  243. package/dist/fonts/walk.js.map +1 -0
  244. package/dist/fonts/wasm/LICENSE-harfbuzzjs +19 -0
  245. package/dist/fonts/wasm/harfbuzz-subset.wasm +0 -0
  246. package/dist/html/check.d.ts +62 -0
  247. package/dist/html/check.js +186 -0
  248. package/dist/html/check.js.map +1 -0
  249. package/dist/html/counters.d.ts +32 -0
  250. package/dist/html/counters.js +72 -0
  251. package/dist/html/counters.js.map +1 -0
  252. package/dist/html/css.d.ts +33 -0
  253. package/dist/html/css.js +72 -0
  254. package/dist/html/css.js.map +1 -0
  255. package/dist/html/dom.d.ts +28 -0
  256. package/dist/html/dom.js +162 -0
  257. package/dist/html/dom.js.map +1 -0
  258. package/dist/html/editions.d.ts +26 -0
  259. package/dist/html/editions.js +57 -0
  260. package/dist/html/editions.js.map +1 -0
  261. package/dist/html/images.d.ts +13 -0
  262. package/dist/html/images.js +62 -0
  263. package/dist/html/images.js.map +1 -0
  264. package/dist/html/index.d.ts +14 -0
  265. package/dist/html/index.js +15 -0
  266. package/dist/html/index.js.map +1 -0
  267. package/dist/html/registry.d.ts +120 -0
  268. package/dist/html/registry.js +48 -0
  269. package/dist/html/registry.js.map +1 -0
  270. package/dist/html/render.d.ts +99 -0
  271. package/dist/html/render.js +687 -0
  272. package/dist/html/render.js.map +1 -0
  273. package/dist/hyphenation/NOTICE +429 -0
  274. package/dist/hyphenation/exceptions.d.ts +60 -0
  275. package/dist/hyphenation/exceptions.js +79 -0
  276. package/dist/hyphenation/exceptions.js.map +1 -0
  277. package/dist/hyphenation/hyphenator.d.ts +66 -0
  278. package/dist/hyphenation/hyphenator.js +245 -0
  279. package/dist/hyphenation/hyphenator.js.map +1 -0
  280. package/dist/hyphenation/index.d.ts +4 -0
  281. package/dist/hyphenation/index.js +5 -0
  282. package/dist/hyphenation/index.js.map +1 -0
  283. package/dist/hyphenation/languages.d.ts +20 -0
  284. package/dist/hyphenation/languages.js +75 -0
  285. package/dist/hyphenation/languages.js.map +1 -0
  286. package/dist/hyphenation/patterns/af.wasm +0 -0
  287. package/dist/hyphenation/patterns/as.wasm +0 -0
  288. package/dist/hyphenation/patterns/be.wasm +0 -0
  289. package/dist/hyphenation/patterns/bg.wasm +0 -0
  290. package/dist/hyphenation/patterns/bn.wasm +0 -0
  291. package/dist/hyphenation/patterns/ca.wasm +0 -0
  292. package/dist/hyphenation/patterns/cy.wasm +0 -0
  293. package/dist/hyphenation/patterns/da.wasm +0 -0
  294. package/dist/hyphenation/patterns/de.wasm +0 -0
  295. package/dist/hyphenation/patterns/el-monoton.wasm +0 -0
  296. package/dist/hyphenation/patterns/el-polyton.wasm +0 -0
  297. package/dist/hyphenation/patterns/en-gb.wasm +0 -0
  298. package/dist/hyphenation/patterns/en-us.wasm +0 -0
  299. package/dist/hyphenation/patterns/eo.wasm +0 -0
  300. package/dist/hyphenation/patterns/es.wasm +0 -0
  301. package/dist/hyphenation/patterns/et.wasm +0 -0
  302. package/dist/hyphenation/patterns/eu.wasm +0 -0
  303. package/dist/hyphenation/patterns/fi-x-school.wasm +0 -0
  304. package/dist/hyphenation/patterns/fr.wasm +0 -0
  305. package/dist/hyphenation/patterns/fur.wasm +0 -0
  306. package/dist/hyphenation/patterns/ga.wasm +0 -0
  307. package/dist/hyphenation/patterns/gl.wasm +0 -0
  308. package/dist/hyphenation/patterns/gu.wasm +0 -0
  309. package/dist/hyphenation/patterns/hi.wasm +0 -0
  310. package/dist/hyphenation/patterns/hr.wasm +0 -0
  311. package/dist/hyphenation/patterns/hsb.wasm +0 -0
  312. package/dist/hyphenation/patterns/ia.wasm +0 -0
  313. package/dist/hyphenation/patterns/is.wasm +0 -0
  314. package/dist/hyphenation/patterns/it.wasm +0 -0
  315. package/dist/hyphenation/patterns/ka.wasm +0 -0
  316. package/dist/hyphenation/patterns/kmr.wasm +0 -0
  317. package/dist/hyphenation/patterns/kn.wasm +0 -0
  318. package/dist/hyphenation/patterns/la.wasm +0 -0
  319. package/dist/hyphenation/patterns/lt.wasm +0 -0
  320. package/dist/hyphenation/patterns/ml.wasm +0 -0
  321. package/dist/hyphenation/patterns/mn-cyrl.wasm +0 -0
  322. package/dist/hyphenation/patterns/mr.wasm +0 -0
  323. package/dist/hyphenation/patterns/nb.wasm +0 -0
  324. package/dist/hyphenation/patterns/nl.wasm +0 -0
  325. package/dist/hyphenation/patterns/nn.wasm +0 -0
  326. package/dist/hyphenation/patterns/no.wasm +0 -0
  327. package/dist/hyphenation/patterns/oc.wasm +0 -0
  328. package/dist/hyphenation/patterns/or.wasm +0 -0
  329. package/dist/hyphenation/patterns/pa.wasm +0 -0
  330. package/dist/hyphenation/patterns/pi.wasm +0 -0
  331. package/dist/hyphenation/patterns/pl.wasm +0 -0
  332. package/dist/hyphenation/patterns/pms.wasm +0 -0
  333. package/dist/hyphenation/patterns/pt.wasm +0 -0
  334. package/dist/hyphenation/patterns/rm.wasm +0 -0
  335. package/dist/hyphenation/patterns/ru.wasm +0 -0
  336. package/dist/hyphenation/patterns/sh-cyrl.wasm +0 -0
  337. package/dist/hyphenation/patterns/sh-latn.wasm +0 -0
  338. package/dist/hyphenation/patterns/sk.wasm +0 -0
  339. package/dist/hyphenation/patterns/sl.wasm +0 -0
  340. package/dist/hyphenation/patterns/sq.wasm +0 -0
  341. package/dist/hyphenation/patterns/sv.wasm +0 -0
  342. package/dist/hyphenation/patterns/ta.wasm +0 -0
  343. package/dist/hyphenation/patterns/te.wasm +0 -0
  344. package/dist/hyphenation/patterns/th.wasm +0 -0
  345. package/dist/hyphenation/patterns/tk.wasm +0 -0
  346. package/dist/hyphenation/patterns/tr.wasm +0 -0
  347. package/dist/hyphenation/patterns/uk.wasm +0 -0
  348. package/dist/hyphenation/patterns/zh-latn-pinyin.wasm +0 -0
  349. package/dist/index.d.ts +47 -0
  350. package/dist/index.js +48 -0
  351. package/dist/index.js.map +1 -0
  352. package/dist/indexes/index.d.ts +10 -0
  353. package/dist/indexes/index.js +11 -0
  354. package/dist/indexes/index.js.map +1 -0
  355. package/dist/indexes/layout.d.ts +30 -0
  356. package/dist/indexes/layout.js +83 -0
  357. package/dist/indexes/layout.js.map +1 -0
  358. package/dist/indexes/locators.d.ts +33 -0
  359. package/dist/indexes/locators.js +51 -0
  360. package/dist/indexes/locators.js.map +1 -0
  361. package/dist/indexes/terms.d.ts +97 -0
  362. package/dist/indexes/terms.js +211 -0
  363. package/dist/indexes/terms.js.map +1 -0
  364. package/dist/indexes/transform.d.ts +90 -0
  365. package/dist/indexes/transform.js +154 -0
  366. package/dist/indexes/transform.js.map +1 -0
  367. package/dist/layout/calibrate.d.ts +12 -0
  368. package/dist/layout/calibrate.js +50 -0
  369. package/dist/layout/calibrate.js.map +1 -0
  370. package/dist/layout/converge.d.ts +31 -0
  371. package/dist/layout/converge.js +84 -0
  372. package/dist/layout/converge.js.map +1 -0
  373. package/dist/layout/counters.d.ts +16 -0
  374. package/dist/layout/counters.js +62 -0
  375. package/dist/layout/counters.js.map +1 -0
  376. package/dist/layout/first-letter.d.ts +34 -0
  377. package/dist/layout/first-letter.js +183 -0
  378. package/dist/layout/first-letter.js.map +1 -0
  379. package/dist/layout/fonts.d.ts +67 -0
  380. package/dist/layout/fonts.js +110 -0
  381. package/dist/layout/fonts.js.map +1 -0
  382. package/dist/layout/generated.d.ts +9 -0
  383. package/dist/layout/generated.js +83 -0
  384. package/dist/layout/generated.js.map +1 -0
  385. package/dist/layout/glue.d.ts +18 -0
  386. package/dist/layout/glue.js +48 -0
  387. package/dist/layout/glue.js.map +1 -0
  388. package/dist/layout/index.d.ts +17 -0
  389. package/dist/layout/index.js +18 -0
  390. package/dist/layout/index.js.map +1 -0
  391. package/dist/layout/lists.d.ts +91 -0
  392. package/dist/layout/lists.js +1068 -0
  393. package/dist/layout/lists.js.map +1 -0
  394. package/dist/layout/margin-boxes.d.ts +114 -0
  395. package/dist/layout/margin-boxes.js +429 -0
  396. package/dist/layout/margin-boxes.js.map +1 -0
  397. package/dist/layout/minipage.d.ts +85 -0
  398. package/dist/layout/minipage.js +83 -0
  399. package/dist/layout/minipage.js.map +1 -0
  400. package/dist/layout/page-box.d.ts +32 -0
  401. package/dist/layout/page-box.js +110 -0
  402. package/dist/layout/page-box.js.map +1 -0
  403. package/dist/layout/page-rules.d.ts +47 -0
  404. package/dist/layout/page-rules.js +202 -0
  405. package/dist/layout/page-rules.js.map +1 -0
  406. package/dist/layout/page.d.ts +51 -0
  407. package/dist/layout/page.js +133 -0
  408. package/dist/layout/page.js.map +1 -0
  409. package/dist/layout/pagebuilder.d.ts +243 -0
  410. package/dist/layout/pagebuilder.js +591 -0
  411. package/dist/layout/pagebuilder.js.map +1 -0
  412. package/dist/layout/pages.d.ts +71 -0
  413. package/dist/layout/pages.js +741 -0
  414. package/dist/layout/pages.js.map +1 -0
  415. package/dist/layout/paragraph.d.ts +194 -0
  416. package/dist/layout/paragraph.js +1148 -0
  417. package/dist/layout/paragraph.js.map +1 -0
  418. package/dist/layout/pre.d.ts +8 -0
  419. package/dist/layout/pre.js +151 -0
  420. package/dist/layout/pre.js.map +1 -0
  421. package/dist/layout/region.d.ts +66 -0
  422. package/dist/layout/region.js +200 -0
  423. package/dist/layout/region.js.map +1 -0
  424. package/dist/layout/vlist.d.ts +218 -0
  425. package/dist/layout/vlist.js +72 -0
  426. package/dist/layout/vlist.js.map +1 -0
  427. package/dist/linebreak/items.d.ts +69 -0
  428. package/dist/linebreak/items.js +44 -0
  429. package/dist/linebreak/items.js.map +1 -0
  430. package/dist/linebreak/knuth-plass.d.ts +149 -0
  431. package/dist/linebreak/knuth-plass.js +461 -0
  432. package/dist/linebreak/knuth-plass.js.map +1 -0
  433. package/dist/lint/config.d.ts +48 -0
  434. package/dist/lint/config.js +185 -0
  435. package/dist/lint/config.js.map +1 -0
  436. package/dist/lint/context.d.ts +64 -0
  437. package/dist/lint/context.js +37 -0
  438. package/dist/lint/context.js.map +1 -0
  439. package/dist/lint/fix.d.ts +40 -0
  440. package/dist/lint/fix.js +86 -0
  441. package/dist/lint/fix.js.map +1 -0
  442. package/dist/lint/index.d.ts +14 -0
  443. package/dist/lint/index.js +15 -0
  444. package/dist/lint/index.js.map +1 -0
  445. package/dist/lint/linter.d.ts +59 -0
  446. package/dist/lint/linter.js +239 -0
  447. package/dist/lint/linter.js.map +1 -0
  448. package/dist/lint/presets.d.ts +20 -0
  449. package/dist/lint/presets.js +65 -0
  450. package/dist/lint/presets.js.map +1 -0
  451. package/dist/lint/project.d.ts +31 -0
  452. package/dist/lint/project.js +100 -0
  453. package/dist/lint/project.js.map +1 -0
  454. package/dist/lint/rules/html.d.ts +30 -0
  455. package/dist/lint/rules/html.js +163 -0
  456. package/dist/lint/rules/html.js.map +1 -0
  457. package/dist/lint/rules/layout.d.ts +42 -0
  458. package/dist/lint/rules/layout.js +428 -0
  459. package/dist/lint/rules/layout.js.map +1 -0
  460. package/dist/lint/rules/source.d.ts +65 -0
  461. package/dist/lint/rules/source.js +334 -0
  462. package/dist/lint/rules/source.js.map +1 -0
  463. package/dist/lint/testing.d.ts +7 -0
  464. package/dist/lint/testing.js +77 -0
  465. package/dist/lint/testing.js.map +1 -0
  466. package/dist/math/hast.d.ts +46 -0
  467. package/dist/math/hast.js +297 -0
  468. package/dist/math/hast.js.map +1 -0
  469. package/dist/math/index.d.ts +9 -0
  470. package/dist/math/index.js +10 -0
  471. package/dist/math/index.js.map +1 -0
  472. package/dist/math/mathjax/LICENSE-mathjax +202 -0
  473. package/dist/math/mathjax/LICENSE-speech-rule-engine +177 -0
  474. package/dist/math/mathjax/sre/af.json +146 -0
  475. package/dist/math/mathjax/sre/base.json +140 -0
  476. package/dist/math/mathjax/sre/ca.json +140 -0
  477. package/dist/math/mathjax/sre/da.json +140 -0
  478. package/dist/math/mathjax/sre/de.json +146 -0
  479. package/dist/math/mathjax/sre/en.json +158 -0
  480. package/dist/math/mathjax/sre/es.json +140 -0
  481. package/dist/math/mathjax/sre/euro.json +32 -0
  482. package/dist/math/mathjax/sre/fr.json +146 -0
  483. package/dist/math/mathjax/sre/hi.json +146 -0
  484. package/dist/math/mathjax/sre/it.json +146 -0
  485. package/dist/math/mathjax/sre/ko.json +146 -0
  486. package/dist/math/mathjax/sre/nb.json +146 -0
  487. package/dist/math/mathjax/sre/nemeth.json +125 -0
  488. package/dist/math/mathjax/sre/nn.json +146 -0
  489. package/dist/math/mathjax/sre/sv.json +146 -0
  490. package/dist/math/mathjax/svg/PUA.json +1 -0
  491. package/dist/math/mathjax/svg/accents-b-i.json +1 -0
  492. package/dist/math/mathjax/svg/accents.json +1 -0
  493. package/dist/math/mathjax/svg/arabic.json +1 -0
  494. package/dist/math/mathjax/svg/arrows.json +1 -0
  495. package/dist/math/mathjax/svg/braille-d.json +1 -0
  496. package/dist/math/mathjax/svg/braille.json +1 -0
  497. package/dist/math/mathjax/svg/calligraphic.json +1 -0
  498. package/dist/math/mathjax/svg/cherokee.json +1 -0
  499. package/dist/math/mathjax/svg/cyrillic-ss.json +1 -0
  500. package/dist/math/mathjax/svg/cyrillic.json +1 -0
  501. package/dist/math/mathjax/svg/devanagari.json +1 -0
  502. package/dist/math/mathjax/svg/double-struck.json +1 -0
  503. package/dist/math/mathjax/svg/fraktur.json +1 -0
  504. package/dist/math/mathjax/svg/greek-ss.json +1 -0
  505. package/dist/math/mathjax/svg/greek.json +1 -0
  506. package/dist/math/mathjax/svg/hebrew.json +1 -0
  507. package/dist/math/mathjax/svg/latin-b.json +1 -0
  508. package/dist/math/mathjax/svg/latin-bi.json +1 -0
  509. package/dist/math/mathjax/svg/latin-i.json +1 -0
  510. package/dist/math/mathjax/svg/latin.json +1 -0
  511. package/dist/math/mathjax/svg/marrows.json +1 -0
  512. package/dist/math/mathjax/svg/math.json +1 -0
  513. package/dist/math/mathjax/svg/monospace-ex.json +1 -0
  514. package/dist/math/mathjax/svg/monospace-l.json +1 -0
  515. package/dist/math/mathjax/svg/monospace.json +1 -0
  516. package/dist/math/mathjax/svg/mshapes.json +1 -0
  517. package/dist/math/mathjax/svg/phonetics-ss.json +1 -0
  518. package/dist/math/mathjax/svg/phonetics.json +1 -0
  519. package/dist/math/mathjax/svg/sans-serif-b.json +1 -0
  520. package/dist/math/mathjax/svg/sans-serif-bi.json +1 -0
  521. package/dist/math/mathjax/svg/sans-serif-ex.json +1 -0
  522. package/dist/math/mathjax/svg/sans-serif-i.json +1 -0
  523. package/dist/math/mathjax/svg/sans-serif-r.json +1 -0
  524. package/dist/math/mathjax/svg/sans-serif.json +1 -0
  525. package/dist/math/mathjax/svg/script.json +1 -0
  526. package/dist/math/mathjax/svg/shapes.json +1 -0
  527. package/dist/math/mathjax/svg/symbols-b-i.json +1 -0
  528. package/dist/math/mathjax/svg/symbols.json +1 -0
  529. package/dist/math/mathjax/svg/variants.json +1 -0
  530. package/dist/math/mathjax.d.ts +67 -0
  531. package/dist/math/mathjax.js +162 -0
  532. package/dist/math/mathjax.js.map +1 -0
  533. package/dist/math/speech.d.ts +27 -0
  534. package/dist/math/speech.js +87 -0
  535. package/dist/math/speech.js.map +1 -0
  536. package/dist/math/typeset.d.ts +75 -0
  537. package/dist/math/typeset.js +108 -0
  538. package/dist/math/typeset.js.map +1 -0
  539. package/dist/measure/css.d.ts +44 -0
  540. package/dist/measure/css.js +158 -0
  541. package/dist/measure/css.js.map +1 -0
  542. package/dist/measure/index.d.ts +3 -0
  543. package/dist/measure/index.js +4 -0
  544. package/dist/measure/index.js.map +1 -0
  545. package/dist/measure/measurer.d.ts +159 -0
  546. package/dist/measure/measurer.js +300 -0
  547. package/dist/measure/measurer.js.map +1 -0
  548. package/dist/measure/model.d.ts +46 -0
  549. package/dist/measure/model.js +47 -0
  550. package/dist/measure/model.js.map +1 -0
  551. package/dist/output/assets.d.ts +10 -0
  552. package/dist/output/assets.js +65 -0
  553. package/dist/output/assets.js.map +1 -0
  554. package/dist/output/index.d.ts +4 -0
  555. package/dist/output/index.js +5 -0
  556. package/dist/output/index.js.map +1 -0
  557. package/dist/output/output.d.ts +103 -0
  558. package/dist/output/output.js +86 -0
  559. package/dist/output/output.js.map +1 -0
  560. package/dist/output/stylesheets.d.ts +45 -0
  561. package/dist/output/stylesheets.js +50 -0
  562. package/dist/output/stylesheets.js.map +1 -0
  563. package/dist/paint/backgrounds.d.ts +56 -0
  564. package/dist/paint/backgrounds.js +261 -0
  565. package/dist/paint/backgrounds.js.map +1 -0
  566. package/dist/paint/blend.d.ts +61 -0
  567. package/dist/paint/blend.js +157 -0
  568. package/dist/paint/blend.js.map +1 -0
  569. package/dist/paint/border-image.d.ts +13 -0
  570. package/dist/paint/border-image.js +149 -0
  571. package/dist/paint/border-image.js.map +1 -0
  572. package/dist/paint/borders.d.ts +47 -0
  573. package/dist/paint/borders.js +329 -0
  574. package/dist/paint/borders.js.map +1 -0
  575. package/dist/paint/canvas.d.ts +52 -0
  576. package/dist/paint/canvas.js +274 -0
  577. package/dist/paint/canvas.js.map +1 -0
  578. package/dist/paint/colours.d.ts +55 -0
  579. package/dist/paint/colours.js +380 -0
  580. package/dist/paint/colours.js.map +1 -0
  581. package/dist/paint/columns.d.ts +11 -0
  582. package/dist/paint/columns.js +42 -0
  583. package/dist/paint/columns.js.map +1 -0
  584. package/dist/paint/context.d.ts +47 -0
  585. package/dist/paint/context.js +2 -0
  586. package/dist/paint/context.js.map +1 -0
  587. package/dist/paint/decoration.d.ts +97 -0
  588. package/dist/paint/decoration.js +280 -0
  589. package/dist/paint/decoration.js.map +1 -0
  590. package/dist/paint/effects.d.ts +64 -0
  591. package/dist/paint/effects.js +342 -0
  592. package/dist/paint/effects.js.map +1 -0
  593. package/dist/paint/emphasis.d.ts +13 -0
  594. package/dist/paint/emphasis.js +95 -0
  595. package/dist/paint/emphasis.js.map +1 -0
  596. package/dist/paint/flatten.d.ts +33 -0
  597. package/dist/paint/flatten.js +968 -0
  598. package/dist/paint/flatten.js.map +1 -0
  599. package/dist/paint/geometry.d.ts +62 -0
  600. package/dist/paint/geometry.js +170 -0
  601. package/dist/paint/geometry.js.map +1 -0
  602. package/dist/paint/gradients.d.ts +31 -0
  603. package/dist/paint/gradients.js +394 -0
  604. package/dist/paint/gradients.js.map +1 -0
  605. package/dist/paint/images.d.ts +17 -0
  606. package/dist/paint/images.js +80 -0
  607. package/dist/paint/images.js.map +1 -0
  608. package/dist/paint/lint.d.ts +46 -0
  609. package/dist/paint/lint.js +105 -0
  610. package/dist/paint/lint.js.map +1 -0
  611. package/dist/paint/overprint.d.ts +13 -0
  612. package/dist/paint/overprint.js +12 -0
  613. package/dist/paint/overprint.js.map +1 -0
  614. package/dist/paint/painter.d.ts +92 -0
  615. package/dist/paint/painter.js +281 -0
  616. package/dist/paint/painter.js.map +1 -0
  617. package/dist/paint/path.d.ts +9 -0
  618. package/dist/paint/path.js +173 -0
  619. package/dist/paint/path.js.map +1 -0
  620. package/dist/paint/raster.d.ts +32 -0
  621. package/dist/paint/raster.js +180 -0
  622. package/dist/paint/raster.js.map +1 -0
  623. package/dist/paint/shadows.d.ts +28 -0
  624. package/dist/paint/shadows.js +104 -0
  625. package/dist/paint/shadows.js.map +1 -0
  626. package/dist/paint/sources.d.ts +13 -0
  627. package/dist/paint/sources.js +17 -0
  628. package/dist/paint/sources.js.map +1 -0
  629. package/dist/paint/stacking.d.ts +75 -0
  630. package/dist/paint/stacking.js +327 -0
  631. package/dist/paint/stacking.js.map +1 -0
  632. package/dist/paint/svg-lint.d.ts +57 -0
  633. package/dist/paint/svg-lint.js +119 -0
  634. package/dist/paint/svg-lint.js.map +1 -0
  635. package/dist/paint/svg.d.ts +95 -0
  636. package/dist/paint/svg.js +728 -0
  637. package/dist/paint/svg.js.map +1 -0
  638. package/dist/paint/tables.d.ts +18 -0
  639. package/dist/paint/tables.js +178 -0
  640. package/dist/paint/tables.js.map +1 -0
  641. package/dist/paint/text-shadow.d.ts +26 -0
  642. package/dist/paint/text-shadow.js +187 -0
  643. package/dist/paint/text-shadow.js.map +1 -0
  644. package/dist/paint/text.d.ts +144 -0
  645. package/dist/paint/text.js +713 -0
  646. package/dist/paint/text.js.map +1 -0
  647. package/dist/paint/values.d.ts +24 -0
  648. package/dist/paint/values.js +160 -0
  649. package/dist/paint/values.js.map +1 -0
  650. package/dist/paint/vertical.d.ts +19 -0
  651. package/dist/paint/vertical.js +236 -0
  652. package/dist/paint/vertical.js.map +1 -0
  653. package/dist/pdf/index.d.ts +6 -0
  654. package/dist/pdf/index.js +7 -0
  655. package/dist/pdf/index.js.map +1 -0
  656. package/dist/pdf/pdfx.d.ts +30 -0
  657. package/dist/pdf/pdfx.js +18 -0
  658. package/dist/pdf/pdfx.js.map +1 -0
  659. package/dist/pdf/structure/index.d.ts +53 -0
  660. package/dist/pdf/structure/index.js +52 -0
  661. package/dist/pdf/structure/index.js.map +1 -0
  662. package/dist/pdf/structure/labels.d.ts +16 -0
  663. package/dist/pdf/structure/labels.js +45 -0
  664. package/dist/pdf/structure/labels.js.map +1 -0
  665. package/dist/pdf/structure/links.d.ts +49 -0
  666. package/dist/pdf/structure/links.js +136 -0
  667. package/dist/pdf/structure/links.js.map +1 -0
  668. package/dist/pdf/structure/tags.d.ts +79 -0
  669. package/dist/pdf/structure/tags.js +314 -0
  670. package/dist/pdf/structure/tags.js.map +1 -0
  671. package/dist/pdf/types.d.ts +534 -0
  672. package/dist/pdf/types.js +16 -0
  673. package/dist/pdf/types.js.map +1 -0
  674. package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +41 -0
  675. package/dist/pdf/wasm/pulpweaver4_pdf.js +286 -0
  676. package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
  677. package/dist/pdf/writer.d.ts +41 -0
  678. package/dist/pdf/writer.js +78 -0
  679. package/dist/pdf/writer.js.map +1 -0
  680. package/dist/plugin/attributes.d.ts +10 -0
  681. package/dist/plugin/attributes.js +63 -0
  682. package/dist/plugin/attributes.js.map +1 -0
  683. package/dist/plugin/define.d.ts +425 -0
  684. package/dist/plugin/define.js +311 -0
  685. package/dist/plugin/define.js.map +1 -0
  686. package/dist/plugin/failure.d.ts +80 -0
  687. package/dist/plugin/failure.js +97 -0
  688. package/dist/plugin/failure.js.map +1 -0
  689. package/dist/plugin/index.d.ts +11 -0
  690. package/dist/plugin/index.js +12 -0
  691. package/dist/plugin/index.js.map +1 -0
  692. package/dist/plugin/load.d.ts +105 -0
  693. package/dist/plugin/load.js +197 -0
  694. package/dist/plugin/load.js.map +1 -0
  695. package/dist/plugin/register.d.ts +166 -0
  696. package/dist/plugin/register.js +306 -0
  697. package/dist/plugin/register.js.map +1 -0
  698. package/dist/plugin/render.d.ts +4 -0
  699. package/dist/plugin/render.js +28 -0
  700. package/dist/plugin/render.js.map +1 -0
  701. package/dist/preflight/index.d.ts +3 -0
  702. package/dist/preflight/index.js +4 -0
  703. package/dist/preflight/index.js.map +1 -0
  704. package/dist/preflight/pdfx.d.ts +440 -0
  705. package/dist/preflight/pdfx.js +1779 -0
  706. package/dist/preflight/pdfx.js.map +1 -0
  707. package/dist/preflight/reader.d.ts +126 -0
  708. package/dist/preflight/reader.js +832 -0
  709. package/dist/preflight/reader.js.map +1 -0
  710. package/dist/preflight/xmp.d.ts +30 -0
  711. package/dist/preflight/xmp.js +145 -0
  712. package/dist/preflight/xmp.js.map +1 -0
  713. package/dist/print/index.d.ts +2 -0
  714. package/dist/print/index.js +3 -0
  715. package/dist/print/index.js.map +1 -0
  716. package/dist/print/output.d.ts +5 -0
  717. package/dist/print/output.js +199 -0
  718. package/dist/print/output.js.map +1 -0
  719. package/dist/problem.d.ts +142 -0
  720. package/dist/problem.js +234 -0
  721. package/dist/problem.js.map +1 -0
  722. package/dist/profile/index.d.ts +10 -0
  723. package/dist/profile/index.js +11 -0
  724. package/dist/profile/index.js.map +1 -0
  725. package/dist/profile/lint.d.ts +69 -0
  726. package/dist/profile/lint.js +282 -0
  727. package/dist/profile/lint.js.map +1 -0
  728. package/dist/profile/metadata.d.ts +27 -0
  729. package/dist/profile/metadata.js +38 -0
  730. package/dist/profile/metadata.js.map +1 -0
  731. package/dist/profile/profile.d.ts +92 -0
  732. package/dist/profile/profile.js +282 -0
  733. package/dist/profile/profile.js.map +1 -0
  734. package/dist/project.d.ts +56 -0
  735. package/dist/project.js +137 -0
  736. package/dist/project.js.map +1 -0
  737. package/dist/reproducible/clock.d.ts +46 -0
  738. package/dist/reproducible/clock.js +173 -0
  739. package/dist/reproducible/clock.js.map +1 -0
  740. package/dist/reproducible/date.d.ts +42 -0
  741. package/dist/reproducible/date.js +82 -0
  742. package/dist/reproducible/date.js.map +1 -0
  743. package/dist/reproducible/index.d.ts +8 -0
  744. package/dist/reproducible/index.js +9 -0
  745. package/dist/reproducible/index.js.map +1 -0
  746. package/dist/spike/spike-page.chromium.json +330 -0
  747. package/dist/spike/spike.d.ts +75 -0
  748. package/dist/spike/spike.js +106 -0
  749. package/dist/spike/spike.js.map +1 -0
  750. package/dist/style/borders.d.ts +25 -0
  751. package/dist/style/borders.js +177 -0
  752. package/dist/style/borders.js.map +1 -0
  753. package/dist/style/colours.d.ts +34 -0
  754. package/dist/style/colours.js +138 -0
  755. package/dist/style/colours.js.map +1 -0
  756. package/dist/style/compile.d.ts +79 -0
  757. package/dist/style/compile.js +325 -0
  758. package/dist/style/compile.js.map +1 -0
  759. package/dist/style/defaults.d.ts +20 -0
  760. package/dist/style/defaults.js +45 -0
  761. package/dist/style/defaults.js.map +1 -0
  762. package/dist/style/gcpm.d.ts +22 -0
  763. package/dist/style/gcpm.js +86 -0
  764. package/dist/style/gcpm.js.map +1 -0
  765. package/dist/style/index.d.ts +4 -0
  766. package/dist/style/index.js +5 -0
  767. package/dist/style/index.js.map +1 -0
  768. package/dist/style/media.d.ts +22 -0
  769. package/dist/style/media.js +342 -0
  770. package/dist/style/media.js.map +1 -0
  771. package/dist/style/properties.d.ts +44 -0
  772. package/dist/style/properties.js +497 -0
  773. package/dist/style/properties.js.map +1 -0
  774. package/dist/style/scope.d.ts +6 -0
  775. package/dist/style/scope.js +134 -0
  776. package/dist/style/scope.js.map +1 -0
  777. package/dist/style/values.d.ts +45 -0
  778. package/dist/style/values.js +106 -0
  779. package/dist/style/values.js.map +1 -0
  780. package/dist/test/book.d.ts +180 -0
  781. package/dist/test/book.js +314 -0
  782. package/dist/test/book.js.map +1 -0
  783. package/dist/test/build.d.ts +58 -0
  784. package/dist/test/build.js +222 -0
  785. package/dist/test/build.js.map +1 -0
  786. package/dist/test/environment.d.ts +63 -0
  787. package/dist/test/environment.js +46 -0
  788. package/dist/test/environment.js.map +1 -0
  789. package/dist/test/index.d.ts +17 -0
  790. package/dist/test/index.js +18 -0
  791. package/dist/test/index.js.map +1 -0
  792. package/dist/test/indexes.d.ts +4 -0
  793. package/dist/test/indexes.js +48 -0
  794. package/dist/test/indexes.js.map +1 -0
  795. package/dist/test/layout.d.ts +8 -0
  796. package/dist/test/layout.js +120 -0
  797. package/dist/test/layout.js.map +1 -0
  798. package/dist/test/matchers.d.ts +80 -0
  799. package/dist/test/matchers.js +177 -0
  800. package/dist/test/matchers.js.map +1 -0
  801. package/dist/test/pipeline.d.ts +228 -0
  802. package/dist/test/pipeline.js +73 -0
  803. package/dist/test/pipeline.js.map +1 -0
  804. package/dist/test/plugins.d.ts +13 -0
  805. package/dist/test/plugins.js +22 -0
  806. package/dist/test/plugins.js.map +1 -0
  807. package/dist/test/render.d.ts +46 -0
  808. package/dist/test/render.js +149 -0
  809. package/dist/test/render.js.map +1 -0
  810. package/dist/test/runner.d.ts +61 -0
  811. package/dist/test/runner.js +256 -0
  812. package/dist/test/runner.js.map +1 -0
  813. package/dist/test/select.d.ts +54 -0
  814. package/dist/test/select.js +193 -0
  815. package/dist/test/select.js.map +1 -0
  816. package/dist/test/snapshot.d.ts +52 -0
  817. package/dist/test/snapshot.js +175 -0
  818. package/dist/test/snapshot.js.map +1 -0
  819. package/dist/test/text.d.ts +7 -0
  820. package/dist/test/text.js +46 -0
  821. package/dist/test/text.js.map +1 -0
  822. package/dist/test/vitest.d.ts +3 -0
  823. package/dist/test/vitest.js +39 -0
  824. package/dist/test/vitest.js.map +1 -0
  825. package/dist/text/index.d.ts +5 -0
  826. package/dist/text/index.js +6 -0
  827. package/dist/text/index.js.map +1 -0
  828. package/dist/text/output.d.ts +5 -0
  829. package/dist/text/output.js +39 -0
  830. package/dist/text/output.js.map +1 -0
  831. package/dist/text/render.d.ts +82 -0
  832. package/dist/text/render.js +583 -0
  833. package/dist/text/render.js.map +1 -0
  834. package/dist/text/width.d.ts +16 -0
  835. package/dist/text/width.js +90 -0
  836. package/dist/text/width.js.map +1 -0
  837. package/dist/text/wrap.d.ts +19 -0
  838. package/dist/text/wrap.js +151 -0
  839. package/dist/text/wrap.js.map +1 -0
  840. package/dist/transform/core.d.ts +19 -0
  841. package/dist/transform/core.js +22 -0
  842. package/dist/transform/core.js.map +1 -0
  843. package/dist/transform/index.d.ts +10 -0
  844. package/dist/transform/index.js +11 -0
  845. package/dist/transform/index.js.map +1 -0
  846. package/dist/transform/numbering.d.ts +47 -0
  847. package/dist/transform/numbering.js +142 -0
  848. package/dist/transform/numbering.js.map +1 -0
  849. package/dist/transform/references.d.ts +38 -0
  850. package/dist/transform/references.js +182 -0
  851. package/dist/transform/references.js.map +1 -0
  852. package/dist/transform/run.d.ts +32 -0
  853. package/dist/transform/run.js +210 -0
  854. package/dist/transform/run.js.map +1 -0
  855. package/dist/transform/store.d.ts +111 -0
  856. package/dist/transform/store.js +331 -0
  857. package/dist/transform/store.js.map +1 -0
  858. package/dist/transform/testing.d.ts +31 -0
  859. package/dist/transform/testing.js +76 -0
  860. package/dist/transform/testing.js.map +1 -0
  861. package/dist/transform/transform.d.ts +104 -0
  862. package/dist/transform/transform.js +89 -0
  863. package/dist/transform/transform.js.map +1 -0
  864. package/dist/vfs/fsa.d.ts +14 -0
  865. package/dist/vfs/fsa.js +123 -0
  866. package/dist/vfs/fsa.js.map +1 -0
  867. package/dist/vfs/index.d.ts +7 -0
  868. package/dist/vfs/index.js +8 -0
  869. package/dist/vfs/index.js.map +1 -0
  870. package/dist/vfs/memory.d.ts +15 -0
  871. package/dist/vfs/memory.js +101 -0
  872. package/dist/vfs/memory.js.map +1 -0
  873. package/dist/vfs/path.d.ts +30 -0
  874. package/dist/vfs/path.js +67 -0
  875. package/dist/vfs/path.js.map +1 -0
  876. package/dist/vfs/vfs.d.ts +66 -0
  877. package/dist/vfs/vfs.js +68 -0
  878. package/dist/vfs/vfs.js.map +1 -0
  879. package/dist/vfs/zip.d.ts +27 -0
  880. package/dist/vfs/zip.js +67 -0
  881. package/dist/vfs/zip.js.map +1 -0
  882. package/dist/web/css.d.ts +15 -0
  883. package/dist/web/css.js +80 -0
  884. package/dist/web/css.js.map +1 -0
  885. package/dist/web/hast.d.ts +44 -0
  886. package/dist/web/hast.js +175 -0
  887. package/dist/web/hast.js.map +1 -0
  888. package/dist/web/index.d.ts +11 -0
  889. package/dist/web/index.js +12 -0
  890. package/dist/web/index.js.map +1 -0
  891. package/dist/web/justify-main.d.ts +1 -0
  892. package/dist/web/justify-main.js +38 -0
  893. package/dist/web/justify-main.js.map +1 -0
  894. package/dist/web/justify.d.ts +46 -0
  895. package/dist/web/justify.js +147 -0
  896. package/dist/web/justify.js.map +1 -0
  897. package/dist/web/output.d.ts +28 -0
  898. package/dist/web/output.js +251 -0
  899. package/dist/web/output.js.map +1 -0
  900. package/dist/web/runtime/LICENSE-harfbuzzjs.txt +19 -0
  901. package/dist/web/runtime/NOTICE-patterns.txt +429 -0
  902. package/dist/web/runtime/harfbuzz.wasm +0 -0
  903. package/dist/web/runtime/justify.js.txt +2 -0
  904. package/dist/web/site.d.ts +53 -0
  905. package/dist/web/site.js +219 -0
  906. package/dist/web/site.js.map +1 -0
  907. package/docs/README.md +16 -0
  908. package/docs/reference/css-properties/index.md +94 -0
  909. package/docs/reference/css-properties/pw-adj-demerits.md +22 -0
  910. package/docs/reference/css-properties/pw-border-bottom-width.md +24 -0
  911. package/docs/reference/css-properties/pw-border-left-width.md +24 -0
  912. package/docs/reference/css-properties/pw-border-right-width.md +24 -0
  913. package/docs/reference/css-properties/pw-border-top-width.md +24 -0
  914. package/docs/reference/css-properties/pw-box.md +28 -0
  915. package/docs/reference/css-properties/pw-broken-penalty.md +22 -0
  916. package/docs/reference/css-properties/pw-club-penalty.md +24 -0
  917. package/docs/reference/css-properties/pw-column-rule-width.md +23 -0
  918. package/docs/reference/css-properties/pw-content-after.md +31 -0
  919. package/docs/reference/css-properties/pw-content-before.md +31 -0
  920. package/docs/reference/css-properties/pw-double-hyphen-demerits.md +23 -0
  921. package/docs/reference/css-properties/pw-emergency-stretch.md +28 -0
  922. package/docs/reference/css-properties/pw-ex-hyphen-penalty.md +22 -0
  923. package/docs/reference/css-properties/pw-final-hyphen-demerits.md +22 -0
  924. package/docs/reference/css-properties/pw-float-skip.md +22 -0
  925. package/docs/reference/css-properties/pw-float.md +33 -0
  926. package/docs/reference/css-properties/pw-footnote-max-height.md +22 -0
  927. package/docs/reference/css-properties/pw-footnote-skip.md +23 -0
  928. package/docs/reference/css-properties/pw-hyphen-penalty.md +24 -0
  929. package/docs/reference/css-properties/pw-inter-line-penalty.md +24 -0
  930. package/docs/reference/css-properties/pw-leader-space.md +22 -0
  931. package/docs/reference/css-properties/pw-leader.md +29 -0
  932. package/docs/reference/css-properties/pw-left-hyphen-min.md +23 -0
  933. package/docs/reference/css-properties/pw-line-breaking.md +29 -0
  934. package/docs/reference/css-properties/pw-line-penalty.md +23 -0
  935. package/docs/reference/css-properties/pw-list-indent.md +18 -0
  936. package/docs/reference/css-properties/pw-looseness.md +30 -0
  937. package/docs/reference/css-properties/pw-max-depth.md +22 -0
  938. package/docs/reference/css-properties/pw-minipage-footnotes.md +23 -0
  939. package/docs/reference/css-properties/pw-orphans.md +24 -0
  940. package/docs/reference/css-properties/pw-outline-width.md +23 -0
  941. package/docs/reference/css-properties/pw-overprint.md +26 -0
  942. package/docs/reference/css-properties/pw-padding-bottom.md +22 -0
  943. package/docs/reference/css-properties/pw-padding-left.md +22 -0
  944. package/docs/reference/css-properties/pw-padding-right.md +22 -0
  945. package/docs/reference/css-properties/pw-padding-top.md +22 -0
  946. package/docs/reference/css-properties/pw-page-prefix.md +28 -0
  947. package/docs/reference/css-properties/pw-page.md +32 -0
  948. package/docs/reference/css-properties/pw-penalty-after.md +23 -0
  949. package/docs/reference/css-properties/pw-penalty-before.md +30 -0
  950. package/docs/reference/css-properties/pw-pretolerance.md +23 -0
  951. package/docs/reference/css-properties/pw-right-hyphen-min.md +22 -0
  952. package/docs/reference/css-properties/pw-running.md +23 -0
  953. package/docs/reference/css-properties/pw-site-background.md +21 -0
  954. package/docs/reference/css-properties/pw-site-link.md +17 -0
  955. package/docs/reference/css-properties/pw-site-measure.md +17 -0
  956. package/docs/reference/css-properties/pw-site-muted.md +21 -0
  957. package/docs/reference/css-properties/pw-site-rule.md +17 -0
  958. package/docs/reference/css-properties/pw-site-text.md +22 -0
  959. package/docs/reference/css-properties/pw-space-after.md +23 -0
  960. package/docs/reference/css-properties/pw-space-before.md +29 -0
  961. package/docs/reference/css-properties/pw-string-set.md +32 -0
  962. package/docs/reference/css-properties/pw-tolerance.md +33 -0
  963. package/docs/reference/css-properties/pw-top-skip.md +22 -0
  964. package/docs/reference/css-properties/pw-widow-penalty.md +32 -0
  965. package/docs/reference/css-properties/pw-widows.md +24 -0
  966. package/docs/reference/css-properties/pw-word-space.md +22 -0
  967. package/docs/reference/css-properties/pw-xspace.md +22 -0
  968. package/docs/reference/index.md +17 -0
  969. package/docs/reference/lint-rules/black-text.md +31 -0
  970. package/docs/reference/lint-rules/blank-page.md +35 -0
  971. package/docs/reference/lint-rules/chapter-verso.md +34 -0
  972. package/docs/reference/lint-rules/citation-in-heading.md +24 -0
  973. package/docs/reference/lint-rules/consecutive-hyphens.md +34 -0
  974. package/docs/reference/lint-rules/empty-link.md +32 -0
  975. package/docs/reference/lint-rules/figure-distance.md +34 -0
  976. package/docs/reference/lint-rules/fonts.md +24 -0
  977. package/docs/reference/lint-rules/generated-text.md +24 -0
  978. package/docs/reference/lint-rules/heading-levels.md +30 -0
  979. package/docs/reference/lint-rules/ibid-across-page.md +30 -0
  980. package/docs/reference/lint-rules/image-alt.md +30 -0
  981. package/docs/reference/lint-rules/image-resolution.md +34 -0
  982. package/docs/reference/lint-rules/index.md +120 -0
  983. package/docs/reference/lint-rules/ink-limit.md +30 -0
  984. package/docs/reference/lint-rules/missing-field.md +37 -0
  985. package/docs/reference/lint-rules/orphan.md +34 -0
  986. package/docs/reference/lint-rules/overfull-line.md +28 -0
  987. package/docs/reference/lint-rules/profile.md +24 -0
  988. package/docs/reference/lint-rules/raw-html.md +30 -0
  989. package/docs/reference/lint-rules/signature.md +34 -0
  990. package/docs/reference/lint-rules/straight-quotes.md +33 -0
  991. package/docs/reference/lint-rules/svg-use-css.md +24 -0
  992. package/docs/reference/lint-rules/underfull-line.md +35 -0
  993. package/docs/reference/lint-rules/unknown-citation.md +30 -0
  994. package/docs/reference/lint-rules/unknown-label.md +31 -0
  995. package/docs/reference/lint-rules/unpaintable.md +24 -0
  996. package/docs/reference/lint-rules/unplaced-index.md +31 -0
  997. package/docs/reference/lint-rules/unused-entry.md +36 -0
  998. package/docs/reference/lint-rules/widow.md +34 -0
  999. package/docs/reference/plugin-api/assert-no-errors.md +18 -0
  1000. package/docs/reference/plugin-api/asset-processor.md +28 -0
  1001. package/docs/reference/plugin-api/attribute-problem.md +26 -0
  1002. package/docs/reference/plugin-api/attribute-type.md +18 -0
  1003. package/docs/reference/plugin-api/capabilities.md +18 -0
  1004. package/docs/reference/plugin-api/capability.md +22 -0
  1005. package/docs/reference/plugin-api/check-attributes.md +18 -0
  1006. package/docs/reference/plugin-api/claim-kind.md +20 -0
  1007. package/docs/reference/plugin-api/combine-penalties.md +17 -0
  1008. package/docs/reference/plugin-api/command-context.md +30 -0
  1009. package/docs/reference/plugin-api/command-definition.md +34 -0
  1010. package/docs/reference/plugin-api/core-claims.md +18 -0
  1011. package/docs/reference/plugin-api/define-plugin.md +20 -0
  1012. package/docs/reference/plugin-api/define-rule.md +19 -0
  1013. package/docs/reference/plugin-api/describe-error.md +14 -0
  1014. package/docs/reference/plugin-api/describe-node.md +14 -0
  1015. package/docs/reference/plugin-api/empty-registry.md +18 -0
  1016. package/docs/reference/plugin-api/failed-on.md +32 -0
  1017. package/docs/reference/plugin-api/fails-as.md +18 -0
  1018. package/docs/reference/plugin-api/import-plugins.md +20 -0
  1019. package/docs/reference/plugin-api/import-text.md +14 -0
  1020. package/docs/reference/plugin-api/index.md +123 -0
  1021. package/docs/reference/plugin-api/layout-definition.md +42 -0
  1022. package/docs/reference/plugin-api/layout-slot.md +28 -0
  1023. package/docs/reference/plugin-api/line-breaker.md +18 -0
  1024. package/docs/reference/plugin-api/lint-context.md +48 -0
  1025. package/docs/reference/plugin-api/lint-definition.md +32 -0
  1026. package/docs/reference/plugin-api/lint-edition.md +38 -0
  1027. package/docs/reference/plugin-api/lint-fix.md +36 -0
  1028. package/docs/reference/plugin-api/lint-level.md +20 -0
  1029. package/docs/reference/plugin-api/lint-preset.md +30 -0
  1030. package/docs/reference/plugin-api/lint-rule.md +42 -0
  1031. package/docs/reference/plugin-api/load-failure.md +32 -0
  1032. package/docs/reference/plugin-api/load-plugins-options.md +32 -0
  1033. package/docs/reference/plugin-api/load-plugins.md +20 -0
  1034. package/docs/reference/plugin-api/loaded-plugin.md +32 -0
  1035. package/docs/reference/plugin-api/node-claim.md +34 -0
  1036. package/docs/reference/plugin-api/output-definition.md +28 -0
  1037. package/docs/reference/plugin-api/owned.md +28 -0
  1038. package/docs/reference/plugin-api/page-builder-hook.md +18 -0
  1039. package/docs/reference/plugin-api/penalty-rule.md +34 -0
  1040. package/docs/reference/plugin-api/plugin-api.md +18 -0
  1041. package/docs/reference/plugin-api/plugin-definition.md +66 -0
  1042. package/docs/reference/plugin-api/plugin-error.md +22 -0
  1043. package/docs/reference/plugin-api/plugin-failure.md +30 -0
  1044. package/docs/reference/plugin-api/plugin-importer.md +34 -0
  1045. package/docs/reference/plugin-api/plugin-problem.md +30 -0
  1046. package/docs/reference/plugin-api/plugin-registry.md +83 -0
  1047. package/docs/reference/plugin-api/plugin-scope.md +15 -0
  1048. package/docs/reference/plugin-api/plugin-stage.md +18 -0
  1049. package/docs/reference/plugin-api/plugin-threw-problem.md +34 -0
  1050. package/docs/reference/plugin-api/plugin-threw.md +21 -0
  1051. package/docs/reference/plugin-api/plugin.md +69 -0
  1052. package/docs/reference/plugin-api/project-with-plugins.md +36 -0
  1053. package/docs/reference/plugin-api/read-context.md +30 -0
  1054. package/docs/reference/plugin-api/read-failure.md +18 -0
  1055. package/docs/reference/plugin-api/read-plugin-styles.md +22 -0
  1056. package/docs/reference/plugin-api/reader.md +22 -0
  1057. package/docs/reference/plugin-api/register-options.md +28 -0
  1058. package/docs/reference/plugin-api/register-plugins.md +20 -0
  1059. package/docs/reference/plugin-api/render-format.md +18 -0
  1060. package/docs/reference/plugin-api/render-formats.md +18 -0
  1061. package/docs/reference/plugin-api/renderer-registry.md +18 -0
  1062. package/docs/reference/plugin-api/renderer-set.md +34 -0
  1063. package/docs/reference/plugin-api/renderers.md +34 -0
  1064. package/docs/reference/plugin-api/specifier-kind.md +14 -0
  1065. package/docs/reference/plugin-api/style-source.md +18 -0
  1066. package/docs/reference/plugin-api/text-context.md +28 -0
  1067. package/docs/reference/plugin-api/text-edit.md +28 -0
  1068. package/docs/reference/plugin-api/text-renderer.md +24 -0
  1069. package/docs/reference/plugin-api/try-plugin-async.md +18 -0
  1070. package/docs/reference/plugin-api/try-plugin.md +20 -0
  1071. package/docs/reference/pulpweaver4-toml/editions.md +194 -0
  1072. package/docs/reference/pulpweaver4-toml/index.md +182 -0
  1073. package/docs/reference/pulpweaver4-toml/inks.md +50 -0
  1074. package/docs/reference/pulpweaver4-toml/lint.md +36 -0
  1075. package/docs/reference/test-matchers/index.md +33 -0
  1076. package/docs/reference/test-matchers/to-be-recto.md +20 -0
  1077. package/docs/reference/test-matchers/to-cite.md +22 -0
  1078. package/docs/reference/test-matchers/to-fit-on-one-page.md +20 -0
  1079. package/docs/reference/test-matchers/to-have-no-overfull-lines.md +20 -0
  1080. package/docs/reference/test-matchers/to-match-html-snapshot.md +20 -0
  1081. package/docs/reference/test-matchers/to-match-page-snapshot.md +20 -0
  1082. package/docs/reference/test-matchers/to-match-text-snapshot.md +21 -0
  1083. package/docs/reference/test-matchers/to-start-page.md +20 -0
  1084. package/package.json +75 -4
  1085. package/README.md +0 -3
@@ -0,0 +1,1436 @@
1
+ import { parseEvents } from "./block.js";
2
+ import { Warning } from "./options.js";
3
+ import { isRow, isBlock, isCaption, isInline } from "./ast.js";
4
+ const getStringContent = function (node) {
5
+ const buffer = [];
6
+ addStringContent(node, buffer);
7
+ return buffer.join("");
8
+ };
9
+ // Uses an explicit stack rather than recursion, so that deeply nested
10
+ // content cannot overflow the JS call stack. Siblings are stacked in
11
+ // reverse, so that they come back off in document order; the node being
12
+ // visited is held in `current` rather than on the stack, which keeps a
13
+ // leaf or a single chain of only children from touching it at all.
14
+ const addStringContent = function (node, buffer) {
15
+ const stack = [];
16
+ let top = 0;
17
+ let current = node;
18
+ for (;;) {
19
+ if ("tag" in current && current.tag === "footnote_reference") {
20
+ // excluded from heading IDs
21
+ }
22
+ else if ("text" in current) {
23
+ buffer.push(current.text);
24
+ }
25
+ else if ("tag" in current &&
26
+ (current.tag === "soft_break" || current.tag === "hard_break")) {
27
+ buffer.push("\n");
28
+ }
29
+ else if ("children" in current) {
30
+ const children = current.children;
31
+ let i = children.length;
32
+ if (i > 0) {
33
+ // descend into the first child directly, stacking only the rest
34
+ while (--i > 0) {
35
+ stack[top++] = children[i];
36
+ }
37
+ current = children[0];
38
+ continue;
39
+ }
40
+ }
41
+ if (top === 0) {
42
+ return;
43
+ }
44
+ current = stack[--top];
45
+ }
46
+ };
47
+ // in verbatim text, trim one space next to ` at beginning or end:
48
+ const trimVerbatim = function (s) {
49
+ return s
50
+ .replace(/^ `/, "`")
51
+ .replace(/` $/, "`");
52
+ };
53
+ const romanDigits = {
54
+ i: 1,
55
+ v: 5,
56
+ x: 10,
57
+ l: 50,
58
+ c: 100,
59
+ d: 500,
60
+ m: 1000,
61
+ I: 1,
62
+ V: 5,
63
+ X: 10,
64
+ L: 50,
65
+ C: 100,
66
+ D: 500,
67
+ M: 1000
68
+ };
69
+ const romanToNumber = function (s) {
70
+ // go backwards through the digits
71
+ let total = 0;
72
+ let prevdigit = 0;
73
+ let i = s.length - 1;
74
+ while (i >= 0) {
75
+ const c = s.charAt(i);
76
+ const n = romanDigits[c];
77
+ if (!n) {
78
+ throw (new Error("Encountered bad character in roman numeral " + s));
79
+ }
80
+ if (n < prevdigit) { // e.g. ix
81
+ total = total - n;
82
+ }
83
+ else {
84
+ total = total + n;
85
+ }
86
+ prevdigit = n;
87
+ i = i - 1;
88
+ }
89
+ return total;
90
+ };
91
+ const getListStart = function (marker, style) {
92
+ const numtype = style.replace(/[().]/g, "");
93
+ const s = marker.replace(/[().]/g, "");
94
+ switch (numtype) {
95
+ case "1": return parseInt(s, 10);
96
+ case "A": return ((s.codePointAt(0) || 65) - 65 + 1); // 65 = "A"
97
+ case "a": return ((s.codePointAt(0) || 97) - 97 + 1); // 97 = "a"
98
+ case "I": return romanToNumber(s);
99
+ case "i": return romanToNumber(s);
100
+ }
101
+ return undefined;
102
+ };
103
+ // Parsing context:
104
+ var Context;
105
+ (function (Context) {
106
+ Context[Context["Normal"] = 0] = "Normal";
107
+ Context[Context["Verbatim"] = 1] = "Verbatim";
108
+ Context[Context["Literal"] = 2] = "Literal"; // gather str, soft_break, hard_break in accumulatedText
109
+ })(Context || (Context = {}));
110
+ // A citation's prefix or suffix, or an item's, around the inlines given,
111
+ // which (when there are positions) say where it is.
112
+ const citationPart = function (tag, children) {
113
+ const part = { tag: tag, children: children };
114
+ const first = children[0].pos;
115
+ const last = children[children.length - 1].pos;
116
+ if (first && last) {
117
+ part.pos = { start: first.start, end: last.end };
118
+ }
119
+ return part;
120
+ };
121
+ // The inlines of a part of a citation, without the spaces and line breaks
122
+ // at its start (if start) and end (if end), which belong to the brackets
123
+ // and separators around it.
124
+ const trimCitationPart = function (inlines, start, end) {
125
+ while (start && inlines.length > 0) {
126
+ const first = inlines[0];
127
+ if (first.tag === "soft_break") {
128
+ inlines.shift();
129
+ }
130
+ else if (first.tag === "str" && /^[ \t]/.test(first.text)) {
131
+ const text = first.text.replace(/^[ \t]+/, "");
132
+ const n = first.text.length - text.length;
133
+ if (text === "") {
134
+ inlines.shift();
135
+ }
136
+ else {
137
+ first.text = text;
138
+ if (first.pos) {
139
+ const s = first.pos.start;
140
+ first.pos = { start: { line: s.line, col: s.col + n,
141
+ offset: s.offset + n },
142
+ end: first.pos.end };
143
+ }
144
+ break;
145
+ }
146
+ }
147
+ else {
148
+ break;
149
+ }
150
+ }
151
+ while (end && inlines.length > 0) {
152
+ const last = inlines[inlines.length - 1];
153
+ if (last.tag === "soft_break") {
154
+ inlines.pop();
155
+ }
156
+ else if (last.tag === "str" && /[ \t]$/.test(last.text)) {
157
+ const text = last.text.replace(/[ \t]+$/, "");
158
+ const n = last.text.length - text.length;
159
+ if (text === "") {
160
+ inlines.pop();
161
+ }
162
+ else {
163
+ last.text = text;
164
+ if (last.pos) {
165
+ const e = last.pos.end;
166
+ last.pos = { start: last.pos.start,
167
+ end: { line: e.line, col: e.col - n,
168
+ offset: e.offset - n } };
169
+ }
170
+ break;
171
+ }
172
+ }
173
+ else {
174
+ break;
175
+ }
176
+ }
177
+ return inlines;
178
+ };
179
+ const normalizeLabel = function (label) {
180
+ return label.trim().replace(/[ \t\r\n]+/g, " ");
181
+ };
182
+ // `events` is only ever walked front to back, so it is enough for it to
183
+ // be iterable; accepting any iterable lets parse hand over the block
184
+ // parser itself instead of first collecting every event into an array.
185
+ // Arrays are iterable, so existing callers are unaffected.
186
+ const parseFromEvents = function (events, input, options = {}) {
187
+ const linestarts = [-1];
188
+ if (options.sourcePositions) { // construct map of newline positions
189
+ for (let i = 0; i < input.length; i++) {
190
+ if (input[i] === "\n") {
191
+ linestarts.push(i);
192
+ }
193
+ }
194
+ }
195
+ // use binary search on linestarts to find line number and col
196
+ const getSourceLoc = function (pos) {
197
+ const numlines = linestarts.length;
198
+ let bottom = 0;
199
+ let top = numlines - 1;
200
+ let line = 0;
201
+ let col = 0;
202
+ while (!line) {
203
+ const mid = bottom + ~~((top - bottom) / 2);
204
+ if (linestarts[mid] > pos) {
205
+ top = mid;
206
+ }
207
+ else if (linestarts[mid] <= pos) {
208
+ if (mid === top || linestarts[mid + 1] > pos) {
209
+ line = mid + 1;
210
+ col = pos - linestarts[mid];
211
+ }
212
+ else {
213
+ if (bottom === mid && bottom < top) {
214
+ bottom = mid + 1;
215
+ }
216
+ else {
217
+ bottom = mid;
218
+ }
219
+ }
220
+ }
221
+ }
222
+ return { line: line, col: col, offset: pos };
223
+ };
224
+ let context = Context.Normal;
225
+ let accumulatedText = "";
226
+ // Use null-prototype objects for maps with user-supplied keys, so
227
+ // that labels like "constructor" or "__proto__" don't hit inherited
228
+ // Object.prototype properties:
229
+ const references = Object.create(null);
230
+ const autoReferences = Object.create(null);
231
+ const footnotes = Object.create(null);
232
+ const identifiers = Object.create(null); // identifiers used
233
+ const blockAttributes = {}; // accumulated block attributes
234
+ let listDepth = 0;
235
+ const warn = options.warn || (() => { });
236
+ const addBlockAttributes = function (container) {
237
+ if (Object.keys(blockAttributes).length > 0) {
238
+ container.attributes = container.attributes || {};
239
+ for (const k in blockAttributes) {
240
+ container.attributes[k] = blockAttributes[k];
241
+ delete blockAttributes[k];
242
+ }
243
+ }
244
+ };
245
+ const getUniqueIdentifier = function (s) {
246
+ const base = s.replace(/[\]\[~!@#$%^&*(){}`,.<>\\|=+/?\s]+/g, " ")
247
+ .trim()
248
+ .replace(/ +/g, "-");
249
+ let i = 0;
250
+ let ident = base;
251
+ // generate unique id
252
+ while (!ident || identifiers[ident]) {
253
+ i = i + 1;
254
+ ident = (base || "s") + "-" + i;
255
+ }
256
+ return ident;
257
+ };
258
+ const pushContainer = function (pos) {
259
+ const container = {
260
+ children: [],
261
+ data: {},
262
+ pos: pos,
263
+ attributes: undefined
264
+ };
265
+ addBlockAttributes(container);
266
+ containers.push(container);
267
+ };
268
+ const popContainer = function (pos) {
269
+ const node = containers.pop();
270
+ if (!node) {
271
+ throw (new Error("Container stack is empty (popContainer)"));
272
+ }
273
+ if (pos && node.pos) {
274
+ node.pos = {
275
+ start: node.pos.start,
276
+ end: pos.end,
277
+ };
278
+ }
279
+ return node;
280
+ };
281
+ const topContainer = function () {
282
+ if (containers.length > 0) {
283
+ return containers[containers.length - 1];
284
+ }
285
+ else {
286
+ throw (new Error("Container stack is empty (topContainer)"));
287
+ }
288
+ };
289
+ // points to last child of top container, or top container if
290
+ // it doesn't have children
291
+ const getTip = function () {
292
+ const top = topContainer();
293
+ if (top.children.length > 0) {
294
+ return top.children[top.children.length - 1];
295
+ }
296
+ else {
297
+ return top;
298
+ }
299
+ };
300
+ const addChildToTip = function (child) {
301
+ if (containers.length > 0) {
302
+ const tip = containers[containers.length - 1];
303
+ tip.children.push(child);
304
+ }
305
+ };
306
+ const tightenContainerEnd = function (node) {
307
+ const lastChild = node.children[node.children.length - 1];
308
+ if (node.pos && lastChild && lastChild.pos) {
309
+ node.pos.end = lastChild.pos.end;
310
+ }
311
+ };
312
+ const handlers = { str: (suffixes, startpos, endpos, pos) => {
313
+ const txt = input.substring(startpos, endpos + 1);
314
+ if (context === Context.Normal) {
315
+ addChildToTip({ tag: "str", text: txt, pos: pos });
316
+ }
317
+ else {
318
+ accumulatedText += txt;
319
+ }
320
+ },
321
+ soft_break: (suffixes, startpos, endpos, pos) => {
322
+ if (context === Context.Normal) {
323
+ addChildToTip({ tag: "soft_break", pos: pos });
324
+ }
325
+ else {
326
+ accumulatedText += "\n";
327
+ }
328
+ },
329
+ escape: (suffixes, startpos, endpos, pos) => {
330
+ if (context === Context.Verbatim) {
331
+ accumulatedText += "\\";
332
+ }
333
+ },
334
+ hard_break: (suffixes, startpos, endpos, pos) => {
335
+ if (context === Context.Normal) {
336
+ addChildToTip({ tag: "hard_break", pos: pos });
337
+ }
338
+ else {
339
+ accumulatedText += "\n";
340
+ }
341
+ },
342
+ non_breaking_space: (suffixes, startpos, endpos, pos) => {
343
+ if (context === Context.Verbatim) {
344
+ accumulatedText += "\\ ";
345
+ }
346
+ else {
347
+ addChildToTip({ tag: "non_breaking_space", pos: pos });
348
+ }
349
+ },
350
+ symb: (suffixes, startpos, endpos, pos) => {
351
+ if (context === Context.Normal) {
352
+ const alias = input.substring(startpos + 1, endpos);
353
+ addChildToTip({ tag: "symb", alias: alias, pos: pos });
354
+ }
355
+ else {
356
+ const txt = input.substring(startpos, endpos + 1);
357
+ accumulatedText += txt;
358
+ }
359
+ },
360
+ footnote_reference: (suffixes, startpos, endpos, pos) => {
361
+ const fnref = input.substring(startpos + 2, endpos);
362
+ addChildToTip({ tag: "footnote_reference",
363
+ text: normalizeLabel(fnref), pos: pos });
364
+ },
365
+ ["+reference_definition"]: (suffixes, startpos, endpos, pos) => {
366
+ pushContainer(pos);
367
+ },
368
+ ["-reference_definition"]: (suffixes, startpos, endpos, pos) => {
369
+ const node = popContainer(pos);
370
+ const lab = normalizeLabel(node.data.key);
371
+ const r = {
372
+ tag: "reference",
373
+ label: lab,
374
+ destination: node.data.value || "",
375
+ attributes: node.attributes,
376
+ pos: node.pos,
377
+ };
378
+ if (node.data.key) {
379
+ references[lab] = r;
380
+ }
381
+ },
382
+ reference_key: (suffixes, startpos, endpos, pos) => {
383
+ topContainer().data.key = input.substring(startpos + 1, endpos);
384
+ topContainer().data.value = "";
385
+ },
386
+ reference_value: (suffixes, startpos, endpos, pos) => {
387
+ topContainer().data.value =
388
+ topContainer().data.value + input.substring(startpos, endpos + 1);
389
+ },
390
+ ["+emph"]: (suffixes, startpos, endpos, pos) => {
391
+ pushContainer(pos);
392
+ },
393
+ ["-emph"]: (suffixes, startpos, endpos, pos) => {
394
+ const node = popContainer(pos);
395
+ addChildToTip({ tag: "emph", children: node.children, pos: node.pos });
396
+ },
397
+ ["+strong"]: (suffixes, startpos, endpos, pos) => {
398
+ pushContainer(pos);
399
+ },
400
+ ["-strong"]: (suffixes, startpos, endpos, pos) => {
401
+ const node = popContainer(pos);
402
+ addChildToTip({ tag: "strong", children: node.children, pos: node.pos });
403
+ },
404
+ ["+span"]: (suffixes, startpos, endpos, pos) => {
405
+ pushContainer(pos);
406
+ },
407
+ ["-span"]: (suffixes, startpos, endpos, pos) => {
408
+ const node = popContainer(pos);
409
+ addChildToTip({ tag: "span", children: node.children, pos: node.pos });
410
+ },
411
+ ["+mark"]: (suffixes, startpos, endpos, pos) => {
412
+ pushContainer(pos);
413
+ },
414
+ ["-mark"]: (suffixes, startpos, endpos, pos) => {
415
+ const node = popContainer(pos);
416
+ addChildToTip({ tag: "mark", children: node.children, pos: node.pos });
417
+ },
418
+ ["+superscript"]: (suffixes, startpos, endpos, pos) => {
419
+ pushContainer(pos);
420
+ },
421
+ ["-superscript"]: (suffixes, startpos, endpos, pos) => {
422
+ const node = popContainer(pos);
423
+ addChildToTip({ tag: "superscript", children: node.children, pos: node.pos });
424
+ },
425
+ ["+subscript"]: (suffixes, startpos, endpos, pos) => {
426
+ pushContainer(pos);
427
+ },
428
+ ["-subscript"]: (suffixes, startpos, endpos, pos) => {
429
+ const node = popContainer(pos);
430
+ addChildToTip({ tag: "subscript", children: node.children, pos: node.pos });
431
+ },
432
+ ["+delete"]: (suffixes, startpos, endpos, pos) => {
433
+ pushContainer(pos);
434
+ },
435
+ ["-delete"]: (suffixes, startpos, endpos, pos) => {
436
+ const node = popContainer(pos);
437
+ addChildToTip({ tag: "delete", children: node.children, pos: node.pos });
438
+ },
439
+ ["+insert"]: (suffixes, startpos, endpos, pos) => {
440
+ pushContainer(pos);
441
+ },
442
+ ["-insert"]: (suffixes, startpos, endpos, pos) => {
443
+ const node = popContainer(pos);
444
+ addChildToTip({ tag: "insert", children: node.children, pos: node.pos });
445
+ },
446
+ ["+double_quoted"]: (suffixes, startpos, endpos, pos) => {
447
+ pushContainer(pos);
448
+ },
449
+ ["-double_quoted"]: (suffixes, startpos, endpos, pos) => {
450
+ const node = popContainer(pos);
451
+ addChildToTip({ tag: "double_quoted", children: node.children, pos: node.pos });
452
+ },
453
+ ["+single_quoted"]: (suffixes, startpos, endpos, pos) => {
454
+ pushContainer(pos);
455
+ },
456
+ ["-single_quoted"]: (suffixes, startpos, endpos, pos) => {
457
+ const node = popContainer(pos);
458
+ addChildToTip({ tag: "single_quoted", children: node.children, pos: node.pos });
459
+ },
460
+ // A citation's parts are gathered as they come, in data.parts, each
461
+ // the inlines between two separators and the key among them, if any;
462
+ // the citation is made from them at its end.
463
+ ["+citation"]: (suffixes, startpos, endpos, pos) => {
464
+ pushContainer(pos);
465
+ topContainer().data.parts = [];
466
+ },
467
+ citation_key: (suffixes, startpos, endpos, pos) => {
468
+ const suppress = input.codePointAt(startpos) === 45; // -
469
+ topContainer().data.key = {
470
+ id: input.substring(suppress ? startpos + 2 : startpos + 1, endpos + 1),
471
+ suppress_author: suppress,
472
+ index: topContainer().children.length,
473
+ pos: pos
474
+ };
475
+ },
476
+ citation_separator: (suffixes, startpos, endpos, pos) => {
477
+ const top = topContainer();
478
+ top.data.parts.push({ children: top.children, key: top.data.key });
479
+ top.children = [];
480
+ top.data.key = undefined;
481
+ },
482
+ ["-citation"]: (suffixes, startpos, endpos, pos) => {
483
+ const node = popContainer(pos);
484
+ const parts = node.data.parts;
485
+ parts.push({ children: node.children, key: node.data.key });
486
+ const children = [];
487
+ for (let i = 0; i < parts.length; i++) {
488
+ const part = parts[i];
489
+ const key = part.key;
490
+ if (key) {
491
+ const prefix = trimCitationPart(part.children.slice(0, key.index), true, false);
492
+ const suffix = trimCitationPart(part.children.slice(key.index), false, true);
493
+ const item = {
494
+ tag: "citation_item",
495
+ id: key.id,
496
+ children: [],
497
+ };
498
+ if (key.suppress_author) {
499
+ item.suppress_author = true;
500
+ }
501
+ let start = key.pos && key.pos.start;
502
+ let end = key.pos && key.pos.end;
503
+ if (prefix.length > 0) {
504
+ const part = citationPart("citation_prefix", prefix);
505
+ item.children.push(part);
506
+ start = part.pos && part.pos.start;
507
+ }
508
+ if (suffix.length > 0) {
509
+ const part = citationPart("citation_suffix", suffix);
510
+ item.children.push(part);
511
+ end = part.pos && part.pos.end;
512
+ }
513
+ if (start && end) {
514
+ item.pos = { start: start, end: end };
515
+ }
516
+ children.push(item);
517
+ }
518
+ else {
519
+ const inlines = trimCitationPart(part.children, true, true);
520
+ if (inlines.length > 0) {
521
+ children.push(citationPart(i === 0 ? "citation_prefix"
522
+ : "citation_suffix", inlines));
523
+ }
524
+ }
525
+ }
526
+ const citation = { tag: "citation", children: children,
527
+ pos: node.pos };
528
+ addChildToTip(citation);
529
+ },
530
+ ["+attributes"]: (suffixes, startpos, endpos, pos) => {
531
+ pushContainer(pos);
532
+ },
533
+ ["-attributes"]: (suffixes, startpos, endpos, pos) => {
534
+ const node = popContainer(pos);
535
+ if (node.attributes && containers.length > 0) {
536
+ if (node.attributes.id) {
537
+ identifiers[node.attributes.id] = true;
538
+ }
539
+ const warnUnattached = () => warn(new Warning("Ignoring unattached attribute", options.sourcePositions ?
540
+ getSourceLoc(startpos) : startpos));
541
+ let tip = getTip();
542
+ if (tip === topContainer()) {
543
+ // no inline children to add the attribute to...
544
+ warnUnattached();
545
+ return;
546
+ }
547
+ let endsWithSpace = false;
548
+ if ("tag" in tip && tip.tag === "str") { // bare word
549
+ // split off last consecutive word of string
550
+ // and attach attributes to it
551
+ const m = tip.text.match(/[^\s]+$/);
552
+ if (m && m.index && m.index > 0) {
553
+ let wordpos;
554
+ if (tip.pos) {
555
+ const origend = tip.pos.end;
556
+ tip.pos.end = {
557
+ line: origend.line,
558
+ col: origend.col - m[0].length,
559
+ offset: origend.offset - m[0].length
560
+ };
561
+ wordpos = {
562
+ start: {
563
+ line: origend.line,
564
+ col: origend.col - m[0].length + 1,
565
+ offset: origend.offset - m[0].length + 1
566
+ },
567
+ end: origend
568
+ };
569
+ }
570
+ tip.text = tip.text.substring(0, m.index);
571
+ addChildToTip({ tag: "str", text: m[0], pos: wordpos });
572
+ }
573
+ else if (!m) {
574
+ endsWithSpace = true;
575
+ }
576
+ }
577
+ tip = getTip(); // get new tip, which may be the new element
578
+ if (endsWithSpace) {
579
+ warnUnattached();
580
+ return;
581
+ }
582
+ if (!tip.attributes) {
583
+ tip.attributes = {};
584
+ }
585
+ for (const k in node.attributes) {
586
+ if (k === "class") {
587
+ if (tip.attributes[k]) {
588
+ tip.attributes[k] = tip.attributes[k] +
589
+ " " + node.attributes[k];
590
+ }
591
+ else {
592
+ tip.attributes[k] = node.attributes[k];
593
+ }
594
+ }
595
+ else {
596
+ tip.attributes[k] = node.attributes[k];
597
+ }
598
+ }
599
+ }
600
+ },
601
+ ["+block_attributes"]: (suffixes, startpos, endpos, pos) => {
602
+ pushContainer(pos);
603
+ },
604
+ ["-block_attributes"]: (suffixes, startpos, endpos, pos) => {
605
+ const node = popContainer(pos);
606
+ if (node.attributes && containers.length > 0) {
607
+ if (node.attributes.id) {
608
+ identifiers[node.attributes.id] = true;
609
+ }
610
+ for (const k in node.attributes) {
611
+ if (k === "class") {
612
+ if (blockAttributes[k]) {
613
+ blockAttributes[k] = blockAttributes[k] +
614
+ " " + node.attributes[k];
615
+ }
616
+ else {
617
+ blockAttributes[k] = node.attributes[k];
618
+ }
619
+ }
620
+ else {
621
+ blockAttributes[k] = node.attributes[k];
622
+ }
623
+ }
624
+ }
625
+ },
626
+ class: (suffixes, startpos, endpos, pos) => {
627
+ const top = topContainer();
628
+ const cl = input.substring(startpos, endpos + 1);
629
+ if (!top.attributes) {
630
+ top.attributes = {};
631
+ }
632
+ if (top.attributes.class) {
633
+ top.attributes.class = top.attributes.class + " " + cl;
634
+ }
635
+ else {
636
+ top.attributes.class = cl;
637
+ }
638
+ },
639
+ id: (suffixes, startpos, endpos, pos) => {
640
+ const top = topContainer();
641
+ const id = input.substring(startpos, endpos + 1);
642
+ if (!top.attributes) {
643
+ top.attributes = { id: id };
644
+ }
645
+ else {
646
+ top.attributes.id = id;
647
+ }
648
+ },
649
+ key: (suffixes, startpos, endpos, pos) => {
650
+ const top = topContainer();
651
+ const key = input.substring(startpos, endpos + 1);
652
+ top.data.key = key;
653
+ if (!top.attributes) {
654
+ top.attributes = {};
655
+ }
656
+ top.attributes[top.data.key] = "";
657
+ },
658
+ value: (suffixes, startpos, endpos, pos) => {
659
+ const top = topContainer();
660
+ const val = input.substring(startpos, endpos + 1)
661
+ .replace(/[ \r\n]+/g, " ") // collapse interior whitespace
662
+ .replace(/\\([.,\\/#!$%^&*;:{}=\-_`~+[\]()'"?|])/g, "$1");
663
+ // resolve backslash escapes
664
+ if (!top.attributes) {
665
+ top.attributes = {};
666
+ }
667
+ if (top.data.key) {
668
+ top.attributes[top.data.key] = // append multiple values to key
669
+ top.attributes[top.data.key] + val;
670
+ }
671
+ else {
672
+ throw (new Error("Encountered value without key"));
673
+ }
674
+ },
675
+ ["+linktext"]: (suffixes, startpos, endpos, pos) => {
676
+ pushContainer(pos);
677
+ topContainer().data.isimage = false;
678
+ },
679
+ ["-linktext"]: (suffixes, startpos, endpos, pos) => {
680
+ // we don't pop yet, but wait for -destination
681
+ },
682
+ ["+imagetext"]: (suffixes, startpos, endpos, pos) => {
683
+ pushContainer(pos);
684
+ topContainer().data.isimage = true;
685
+ },
686
+ ["-imagetext"]: (suffixes, startpos, endpos, pos) => {
687
+ // we don't pop yet, but wait for -destination
688
+ },
689
+ ["+destination"]: (suffixes, startpos, endpos, pos) => {
690
+ context = Context.Literal;
691
+ },
692
+ ["-destination"]: (suffixes, startpos, endpos, pos) => {
693
+ const node = popContainer(pos); // the container added by +linktext/+imagetext
694
+ addChildToTip({
695
+ tag: node.data.isimage ? "image" : "link",
696
+ destination: accumulatedText.replace(/[\r\n]/g, ""),
697
+ children: node.children,
698
+ pos: node.pos
699
+ });
700
+ context = Context.Normal;
701
+ accumulatedText = "";
702
+ },
703
+ ["+reference"]: (suffixes, startpos, endpos, pos) => {
704
+ context = Context.Literal;
705
+ },
706
+ ["-reference"]: (suffixes, startpos, endpos, pos) => {
707
+ const node = popContainer(pos); // the container added by +linktext
708
+ let ref = accumulatedText;
709
+ if (ref.length === 0) {
710
+ ref = getStringContent(node);
711
+ }
712
+ addChildToTip({
713
+ tag: node.data.isimage ? "image" : "link",
714
+ reference: normalizeLabel(ref),
715
+ children: node.children,
716
+ pos: node.pos
717
+ });
718
+ context = Context.Normal;
719
+ accumulatedText = "";
720
+ },
721
+ ["+verbatim"]: (suffixes, startpos, endpos, pos) => {
722
+ context = Context.Verbatim;
723
+ pushContainer(pos);
724
+ },
725
+ ["-verbatim"]: (suffixes, startpos, endpos, pos) => {
726
+ const node = popContainer(pos);
727
+ addChildToTip({
728
+ tag: "verbatim",
729
+ text: trimVerbatim(accumulatedText),
730
+ pos: node.pos
731
+ });
732
+ context = Context.Normal;
733
+ accumulatedText = "";
734
+ },
735
+ raw_format: (suffixes, startpos, endpos, pos) => {
736
+ const format = input.substring(startpos, endpos + 1)
737
+ .replace(/^\{?=/, "")
738
+ .replace(/\}$/, "");
739
+ const top = topContainer();
740
+ if (context === Context.Verbatim) { // in a code block
741
+ top.data.format = format;
742
+ }
743
+ else {
744
+ const tip = top.children[top.children.length - 1];
745
+ if (tip && "tag" in tip && tip.tag === "verbatim") {
746
+ tip.tag = "raw_inline";
747
+ tip.format = format;
748
+ }
749
+ else {
750
+ throw (new Error("raw_format is not after verbatim or code_block."));
751
+ }
752
+ }
753
+ },
754
+ ["+display_math"]: (suffixes, startpos, endpos, pos) => {
755
+ context = Context.Verbatim;
756
+ pushContainer(pos);
757
+ },
758
+ ["+inline_math"]: (suffixes, startpos, endpos, pos) => {
759
+ context = Context.Verbatim;
760
+ pushContainer(pos);
761
+ },
762
+ ["-display_math"]: (suffixes, startpos, endpos, pos) => {
763
+ const node = popContainer(pos);
764
+ addChildToTip({
765
+ tag: "display_math",
766
+ text: trimVerbatim(accumulatedText),
767
+ pos: node.pos
768
+ });
769
+ context = Context.Normal;
770
+ accumulatedText = "";
771
+ },
772
+ ["-inline_math"]: (suffixes, startpos, endpos, pos) => {
773
+ const node = popContainer(pos);
774
+ addChildToTip({
775
+ tag: "inline_math",
776
+ text: trimVerbatim(accumulatedText),
777
+ pos: node.pos
778
+ });
779
+ context = Context.Normal;
780
+ accumulatedText = "";
781
+ },
782
+ ["+url"]: (suffixes, startpos, endpos, pos) => {
783
+ context = Context.Literal;
784
+ pushContainer(pos);
785
+ },
786
+ ["-url"]: (suffixes, startpos, endpos, pos) => {
787
+ const node = popContainer(pos);
788
+ addChildToTip({ tag: "url",
789
+ text: accumulatedText.replace(/[\r\n]/g, ""),
790
+ pos: node.pos });
791
+ context = Context.Normal;
792
+ accumulatedText = "";
793
+ },
794
+ ["+email"]: (suffixes, startpos, endpos, pos) => {
795
+ context = Context.Literal;
796
+ pushContainer(pos);
797
+ },
798
+ ["-email"]: (suffixes, startpos, endpos, pos) => {
799
+ const node = popContainer(pos);
800
+ addChildToTip({ tag: "email",
801
+ text: accumulatedText.replace(/[\r\n]/g, ""),
802
+ pos: node.pos });
803
+ context = Context.Normal;
804
+ accumulatedText = "";
805
+ },
806
+ ["+para"]: (suffixes, startpos, endpos, pos) => {
807
+ pushContainer(pos);
808
+ },
809
+ ["-para"]: (suffixes, startpos, endpos, pos) => {
810
+ const node = popContainer(pos);
811
+ addChildToTip({
812
+ tag: "para",
813
+ children: node.children,
814
+ attributes: node.attributes,
815
+ pos: node.pos
816
+ });
817
+ },
818
+ ["+heading"]: (suffixes, startpos, endpos, pos) => {
819
+ pushContainer(pos);
820
+ topContainer().data.level = 1 + endpos - startpos;
821
+ },
822
+ ["-heading"]: (suffixes, startpos, endpos, pos) => {
823
+ const node = popContainer(pos);
824
+ const headingStr = getStringContent(node).trim();
825
+ if (!node.attributes || !node.attributes.id) {
826
+ if (!node.autoAttributes) {
827
+ node.autoAttributes = {};
828
+ }
829
+ node.autoAttributes.id = getUniqueIdentifier(headingStr);
830
+ identifiers[node.autoAttributes.id] = true;
831
+ }
832
+ // add implicit heading reference
833
+ const lab = normalizeLabel(headingStr);
834
+ if (!references[lab] && !autoReferences[lab]) {
835
+ autoReferences[lab] = {
836
+ tag: "reference",
837
+ label: lab,
838
+ destination: "#" + (node.attributes?.id || node.autoAttributes?.id)
839
+ };
840
+ }
841
+ // add section structure
842
+ let pnode = topContainer();
843
+ if (pnode.data.headinglevel !== undefined) { // doc or section
844
+ while (pnode && pnode.data.headinglevel !== undefined &&
845
+ pnode.data.headinglevel >= node.data.level) {
846
+ // close sections til we get to the right level
847
+ pnode = popContainer(pos);
848
+ addChildToTip({
849
+ tag: "section",
850
+ children: pnode.children,
851
+ attributes: pnode.attributes,
852
+ autoAttributes: pnode.autoAttributes,
853
+ pos: pnode.pos
854
+ });
855
+ pnode = topContainer();
856
+ }
857
+ // now we know that pnode.data.headinglevel is either
858
+ // undefined or < node.data.level
859
+ pushContainer(node.pos);
860
+ topContainer().data.headinglevel = node.data.level;
861
+ // move id attribute from heading to section
862
+ if (node.autoAttributes && node.autoAttributes.id) {
863
+ topContainer().autoAttributes = node.autoAttributes;
864
+ delete node.autoAttributes;
865
+ }
866
+ if (node.attributes && node.attributes.id) {
867
+ topContainer().attributes = node.attributes;
868
+ delete node.attributes;
869
+ }
870
+ }
871
+ addChildToTip({
872
+ tag: "heading",
873
+ level: node.data.level,
874
+ children: node.children,
875
+ attributes: node.attributes,
876
+ autoAttributes: node.autoAttributes,
877
+ pos: node.pos
878
+ });
879
+ },
880
+ ["+list"]: (suffixes, startpos, endpos, pos) => {
881
+ pushContainer(pos);
882
+ topContainer().data.styles = suffixes;
883
+ topContainer().data.blanklines = false;
884
+ topContainer().data.tight = true;
885
+ listDepth++;
886
+ },
887
+ ["-list"]: (suffixes, startpos, endpos, pos) => {
888
+ const node = popContainer(pos);
889
+ // take first if ambiguous
890
+ const listStyle = node.data.styles[0];
891
+ if (!listStyle) {
892
+ throw (new Error("No style defined for list"));
893
+ }
894
+ tightenContainerEnd(node);
895
+ const listStart = getListStart(node.data.firstMarker, listStyle);
896
+ if (listStyle === ":") {
897
+ addChildToTip({
898
+ tag: "definition_list",
899
+ children: node.children,
900
+ attributes: node.attributes,
901
+ autoAttributes: node.autoAttributes,
902
+ pos: node.pos
903
+ });
904
+ }
905
+ else if (listStyle.endsWith("X")) {
906
+ addChildToTip({
907
+ tag: "task_list",
908
+ tight: node.data.tight,
909
+ children: node.children,
910
+ attributes: node.attributes,
911
+ autoAttributes: node.autoAttributes,
912
+ pos: node.pos
913
+ });
914
+ }
915
+ else if (listStyle === "+" || listStyle === "*" ||
916
+ listStyle === "-") {
917
+ addChildToTip({
918
+ tag: "bullet_list",
919
+ tight: node.data.tight,
920
+ style: listStyle,
921
+ children: node.children,
922
+ attributes: node.attributes,
923
+ autoAttributes: node.autoAttributes,
924
+ pos: node.pos
925
+ });
926
+ }
927
+ else {
928
+ addChildToTip({
929
+ tag: "ordered_list",
930
+ style: listStyle,
931
+ children: node.children,
932
+ start: listStart,
933
+ tight: node.data.tight,
934
+ attributes: node.attributes,
935
+ autoAttributes: node.autoAttributes,
936
+ pos: node.pos
937
+ });
938
+ }
939
+ listDepth--;
940
+ },
941
+ ["+list_item"]: (suffixes, startpos, endpos, pos) => {
942
+ // narrow styles
943
+ if (suffixes.length < topContainer().data.styles.length) {
944
+ topContainer().data.styles = suffixes;
945
+ }
946
+ if (!topContainer().data.firstMarker) {
947
+ topContainer().data.firstMarker =
948
+ input.substring(startpos, endpos + 1);
949
+ }
950
+ pushContainer(pos);
951
+ if (suffixes.length === 1 && suffixes[0] === ":") {
952
+ topContainer().data.definitionList = true;
953
+ }
954
+ },
955
+ ["-list_item"]: (suffixes, startpos, endpos, pos) => {
956
+ const node = popContainer(pos);
957
+ // A lazily closed item (e.g. before a blank line that ends the list)
958
+ // must not extend past its own content, so the parent list's
959
+ // tightened range still contains it.
960
+ tightenContainerEnd(node);
961
+ if (node.data.definitionList) {
962
+ if (node.children[0] && node.children[0].tag === "para") {
963
+ const term = {
964
+ tag: "term",
965
+ children: node.children[0].children
966
+ };
967
+ node.children.shift();
968
+ const definition = {
969
+ tag: "definition",
970
+ children: node.children
971
+ };
972
+ addChildToTip({
973
+ tag: "definition_list_item",
974
+ children: [term, definition],
975
+ attributes: node.attributes,
976
+ autoAttributes: node.autoAttributes,
977
+ pos: node.pos
978
+ });
979
+ }
980
+ else {
981
+ const term = { tag: "term", children: [] };
982
+ const definition = {
983
+ tag: "definition",
984
+ children: node.children
985
+ };
986
+ addChildToTip({
987
+ tag: "definition_list_item",
988
+ children: [term, definition],
989
+ attributes: node.attributes,
990
+ autoAttributes: node.autoAttributes,
991
+ pos: node.pos
992
+ });
993
+ }
994
+ }
995
+ else if (node.data.checkbox) {
996
+ addChildToTip({
997
+ tag: "task_list_item",
998
+ children: node.children,
999
+ attributes: node.attributes,
1000
+ autoAttributes: node.autoAttributes,
1001
+ checkbox: node.data.checkbox,
1002
+ pos: node.pos
1003
+ });
1004
+ }
1005
+ else {
1006
+ addChildToTip({
1007
+ tag: "list_item",
1008
+ children: node.children,
1009
+ attributes: node.attributes,
1010
+ autoAttributes: node.autoAttributes,
1011
+ pos: node.pos
1012
+ });
1013
+ }
1014
+ },
1015
+ checkbox_checked: (suffixes, startpos, endpos, pos) => {
1016
+ topContainer().data.checkbox = "checked";
1017
+ },
1018
+ checkbox_unchecked: (suffixes, startpos, endpos, pos) => {
1019
+ topContainer().data.checkbox = "unchecked";
1020
+ },
1021
+ ["+block_quote"]: (suffixes, startpos, endpos, pos) => {
1022
+ pushContainer(pos);
1023
+ },
1024
+ ["-block_quote"]: (suffixes, startpos, endpos, pos) => {
1025
+ const node = popContainer(pos);
1026
+ tightenContainerEnd(node);
1027
+ addChildToTip({
1028
+ tag: "block_quote",
1029
+ children: node.children,
1030
+ attributes: node.attributes,
1031
+ autoAttributes: node.autoAttributes,
1032
+ pos: node.pos
1033
+ });
1034
+ },
1035
+ ["+table"]: (suffixes, startpos, endpos, pos) => {
1036
+ pushContainer(pos);
1037
+ topContainer().data.aligns = [];
1038
+ },
1039
+ ["-table"]: (suffixes, startpos, endpos, pos) => {
1040
+ const node = popContainer(pos);
1041
+ tightenContainerEnd(node);
1042
+ const rows = node.children;
1043
+ let caption = {
1044
+ tag: "caption",
1045
+ children: []
1046
+ };
1047
+ if (rows[0]?.tag === "caption") {
1048
+ caption = rows.shift();
1049
+ }
1050
+ addChildToTip({
1051
+ tag: "table",
1052
+ children: [caption, ...rows],
1053
+ attributes: node.attributes,
1054
+ autoAttributes: node.autoAttributes,
1055
+ pos: node.pos
1056
+ });
1057
+ },
1058
+ ["+row"]: (suffixes, startpos, endpos, pos) => {
1059
+ pushContainer(pos);
1060
+ topContainer().data.aligns = [];
1061
+ },
1062
+ ["-row"]: (suffixes, startpos, endpos, pos) => {
1063
+ const node = popContainer(pos);
1064
+ if (node.children.length === 0) { // a separator line
1065
+ // set table aligns, so they can be propagated to future rows
1066
+ topContainer().data.aligns = node.data.aligns;
1067
+ const tip = getTip();
1068
+ if (tip && "tag" in tip && tip.tag === "row") { // prev row of table
1069
+ tip.head = true;
1070
+ for (let i = 0; i < tip.children.length; i++) {
1071
+ tip.children[i].head = true;
1072
+ tip.children[i].align = node.data.aligns[i] || "default";
1073
+ }
1074
+ }
1075
+ }
1076
+ else {
1077
+ // get aligns from table
1078
+ node.data.aligns = [];
1079
+ for (let i = 0; i < node.children.length; i++) {
1080
+ node.children[i].align = topContainer().data.aligns[i] || "default";
1081
+ }
1082
+ addChildToTip({
1083
+ tag: "row",
1084
+ children: node.children,
1085
+ head: false, // gets set later
1086
+ attributes: node.attributes,
1087
+ autoAttributes: node.autoAttributes,
1088
+ pos: node.pos
1089
+ });
1090
+ }
1091
+ },
1092
+ separator_default: (suffixes, startpos, endpos, pos) => {
1093
+ topContainer().data.aligns.push("default");
1094
+ },
1095
+ separator_left: (suffixes, startpos, endpos, pos) => {
1096
+ topContainer().data.aligns.push("left");
1097
+ },
1098
+ separator_right: (suffixes, startpos, endpos, pos) => {
1099
+ topContainer().data.aligns.push("right");
1100
+ },
1101
+ separator_center: (suffixes, startpos, endpos, pos) => {
1102
+ topContainer().data.aligns.push("center");
1103
+ },
1104
+ ["+cell"]: (suffixes, startpos, endpos, pos) => {
1105
+ pushContainer(pos);
1106
+ },
1107
+ ["-cell"]: (suffixes, startpos, endpos, pos) => {
1108
+ const node = popContainer(pos);
1109
+ addChildToTip({
1110
+ tag: "cell",
1111
+ children: node.children,
1112
+ head: false, // gets set in "-row"
1113
+ align: "default", // set at "-row"
1114
+ attributes: node.attributes,
1115
+ autoAttributes: node.autoAttributes,
1116
+ pos: node.pos
1117
+ });
1118
+ },
1119
+ ["+caption"]: (suffixes, startpos, endpos, pos) => {
1120
+ pushContainer(pos);
1121
+ },
1122
+ ["-caption"]: (suffixes, startpos, endpos, pos) => {
1123
+ const node = popContainer(pos);
1124
+ const tip = getTip();
1125
+ if (!tip || ("tag" in tip && tip.tag !== "table")) {
1126
+ return;
1127
+ }
1128
+ const capt = {
1129
+ tag: "caption",
1130
+ children: node.children,
1131
+ attributes: node.attributes,
1132
+ autoAttributes: node.autoAttributes,
1133
+ pos: node.pos
1134
+ };
1135
+ if (tip.children[0]?.tag === "caption") {
1136
+ tip.children[0] = capt;
1137
+ }
1138
+ },
1139
+ ["+footnote"]: (suffixes, startpos, endpos, pos) => {
1140
+ pushContainer(pos);
1141
+ },
1142
+ ["-footnote"]: (suffixes, startpos, endpos, pos) => {
1143
+ const node = popContainer(pos);
1144
+ tightenContainerEnd(node);
1145
+ if (node.data.label) {
1146
+ const lab = normalizeLabel(node.data.label);
1147
+ footnotes[lab] =
1148
+ {
1149
+ tag: "footnote",
1150
+ label: lab || "",
1151
+ children: node.children,
1152
+ attributes: node.attributes,
1153
+ autoAttributes: node.autoAttributes,
1154
+ pos: node.pos
1155
+ };
1156
+ }
1157
+ else {
1158
+ warn(new Warning("Ignoring footnote without a label.", options.sourcePositions ?
1159
+ getSourceLoc(endpos) : endpos));
1160
+ }
1161
+ },
1162
+ note_label: (suffixes, startpos, endpos, pos) => {
1163
+ topContainer().data.label =
1164
+ input.substring(startpos, endpos + 1);
1165
+ },
1166
+ ["+code_block"]: (suffixes, startpos, endpos, pos) => {
1167
+ pushContainer(pos);
1168
+ context = Context.Verbatim;
1169
+ },
1170
+ ["-code_block"]: (suffixes, startpos, endpos, pos) => {
1171
+ const node = popContainer(pos);
1172
+ if (node.data.format) {
1173
+ addChildToTip({
1174
+ tag: "raw_block",
1175
+ format: node.data.format,
1176
+ text: accumulatedText,
1177
+ attributes: node.attributes,
1178
+ autoAttributes: node.autoAttributes,
1179
+ pos: node.pos
1180
+ });
1181
+ }
1182
+ else {
1183
+ addChildToTip({
1184
+ tag: "code_block",
1185
+ text: accumulatedText,
1186
+ lang: node.data.lang,
1187
+ attributes: node.attributes,
1188
+ autoAttributes: node.autoAttributes,
1189
+ pos: node.pos
1190
+ });
1191
+ }
1192
+ context = Context.Normal;
1193
+ accumulatedText = "";
1194
+ },
1195
+ code_language: (suffixes, startpos, endpos, pos) => {
1196
+ const top = topContainer();
1197
+ top.data.lang = input.substring(startpos, endpos + 1);
1198
+ },
1199
+ ["+div"]: (suffixes, startpos, endpos, pos) => {
1200
+ pushContainer(pos);
1201
+ },
1202
+ ["-div"]: (suffixes, startpos, endpos, pos) => {
1203
+ const node = popContainer(pos);
1204
+ addChildToTip({
1205
+ tag: "div",
1206
+ children: node.children,
1207
+ attributes: node.attributes,
1208
+ autoAttributes: node.autoAttributes,
1209
+ pos: node.pos
1210
+ });
1211
+ },
1212
+ thematic_break: (suffixes, startpos, endpos, pos) => {
1213
+ const tb = { tag: "thematic_break", pos: pos };
1214
+ addBlockAttributes(tb);
1215
+ addChildToTip(tb);
1216
+ },
1217
+ left_single_quote: (suffixes, startpos, endpos, pos) => {
1218
+ addChildToTip({ tag: "smart_punctuation",
1219
+ type: "left_single_quote",
1220
+ text: "'", pos: pos });
1221
+ },
1222
+ right_single_quote: (suffixes, startpos, endpos, pos) => {
1223
+ addChildToTip({ tag: "smart_punctuation",
1224
+ type: "right_single_quote",
1225
+ text: "'", pos: pos });
1226
+ },
1227
+ left_double_quote: (suffixes, startpos, endpos, pos) => {
1228
+ addChildToTip({ tag: "smart_punctuation",
1229
+ type: "left_double_quote",
1230
+ text: '"', pos });
1231
+ },
1232
+ right_double_quote: (suffixes, startpos, endpos, pos) => {
1233
+ addChildToTip({ tag: "smart_punctuation",
1234
+ type: "right_double_quote",
1235
+ text: '"', pos });
1236
+ },
1237
+ ellipses: (suffixes, startpos, endpos, pos) => {
1238
+ addChildToTip({ tag: "smart_punctuation",
1239
+ type: "ellipses",
1240
+ text: "...", pos });
1241
+ },
1242
+ en_dash: (suffixes, startpos, endpos, pos) => {
1243
+ addChildToTip({ tag: "smart_punctuation",
1244
+ type: "en_dash",
1245
+ text: "--", pos });
1246
+ },
1247
+ em_dash: (suffixes, startpos, endpos, pos) => {
1248
+ addChildToTip({ tag: "smart_punctuation",
1249
+ type: "em_dash",
1250
+ text: "---", pos });
1251
+ },
1252
+ // We set the blanklines property of a parent list or
1253
+ // sublist to aid with tight/loose list determination.
1254
+ blankline: (suffixes, startpos, endpos, pos) => {
1255
+ let listnode;
1256
+ if ("tight" in topContainer().data) {
1257
+ listnode = topContainer();
1258
+ }
1259
+ else if (containers.length >= 2 &&
1260
+ "tight" in containers[containers.length - 2].data) {
1261
+ listnode = containers[containers.length - 2];
1262
+ }
1263
+ if (listnode) {
1264
+ listnode.data.blanklines = true;
1265
+ }
1266
+ } };
1267
+ const handleEvent = function (containers, event) {
1268
+ let sp;
1269
+ let ep;
1270
+ let pos;
1271
+ if (options.sourcePositions) {
1272
+ sp = getSourceLoc(event.startpos);
1273
+ ep = getSourceLoc(event.endpos);
1274
+ pos = { start: sp, end: ep };
1275
+ }
1276
+ let annot = event.annot;
1277
+ let suffixes = [];
1278
+ if (event.annot.includes("|")) {
1279
+ const parts = event.annot.split("|");
1280
+ annot = parts[0];
1281
+ suffixes = parts.slice(1);
1282
+ }
1283
+ // Attributes must come right before a block, so we
1284
+ // reset them on blank lines.
1285
+ if (annot === "blankline") {
1286
+ for (const key in blockAttributes) {
1287
+ delete blockAttributes[key];
1288
+ }
1289
+ }
1290
+ // The following is for tight/loose determination.
1291
+ // If blanklines have already been seen, and we're
1292
+ // about to process something other than a blankline,
1293
+ // the end of a list or list item, or the start of
1294
+ // a list, then it's a loose list.
1295
+ if (listDepth > 0 && annot !== "blankline") {
1296
+ let ln;
1297
+ const top = topContainer();
1298
+ if (top) {
1299
+ if (top.data && "tight" in top.data) {
1300
+ ln = top;
1301
+ }
1302
+ else if (containers.length >= 2 &&
1303
+ "tight" in containers[containers.length - 2].data) {
1304
+ ln = containers[containers.length - 2];
1305
+ }
1306
+ }
1307
+ if (ln) {
1308
+ if (!/^[+-]list/.test(annot) && ln.data.blanklines) {
1309
+ ln.data.tight = false;
1310
+ }
1311
+ if (!/^[-+]list_item$/.test(annot)) {
1312
+ ln.data.blanklines = false;
1313
+ }
1314
+ }
1315
+ }
1316
+ const fn = handlers[annot];
1317
+ if (fn) {
1318
+ fn(suffixes, event.startpos, event.endpos, pos);
1319
+ }
1320
+ };
1321
+ const containers = [{
1322
+ children: [],
1323
+ data: { headinglevel: 0 },
1324
+ pos: {
1325
+ start: { line: 0, col: 0, offset: 0 },
1326
+ end: { line: 0, col: 0, offset: 0 }
1327
+ }
1328
+ }];
1329
+ let lastpos = 0;
1330
+ for (const event of events) {
1331
+ handleEvent(containers, event);
1332
+ lastpos = event.endpos;
1333
+ }
1334
+ let lastloc;
1335
+ if (options.sourcePositions) {
1336
+ lastloc = getSourceLoc(lastpos);
1337
+ }
1338
+ // close any open sections:
1339
+ let pnode = topContainer();
1340
+ while (pnode && pnode.data.headinglevel > 0) {
1341
+ // close sections til we get to the doc level
1342
+ popContainer(lastloc && { start: lastloc, end: lastloc });
1343
+ addChildToTip({
1344
+ tag: "section",
1345
+ children: pnode.children,
1346
+ attributes: pnode.attributes,
1347
+ autoAttributes: pnode.autoAttributes,
1348
+ pos: pnode.pos
1349
+ });
1350
+ pnode = topContainer();
1351
+ }
1352
+ const doc = {
1353
+ tag: "doc",
1354
+ references: references,
1355
+ autoReferences: autoReferences,
1356
+ footnotes: footnotes,
1357
+ children: containers[0].children,
1358
+ };
1359
+ if (containers[0].autoAttributes) {
1360
+ doc.autoAttributes = containers[0].autoAttributes;
1361
+ }
1362
+ if (containers[0].attributes) {
1363
+ doc.attributes = containers[0].attributes;
1364
+ }
1365
+ return doc;
1366
+ };
1367
+ const omitFields = {
1368
+ children: true,
1369
+ tag: true,
1370
+ pos: true,
1371
+ attributes: true,
1372
+ autoAttributes: true,
1373
+ references: true,
1374
+ autoReferences: true,
1375
+ footnotes: true
1376
+ };
1377
+ const stringify = function (x) {
1378
+ return JSON.stringify(x).replace(/\\\n/g, "\\n");
1379
+ };
1380
+ const renderAstNode = function (node, buff, indent) {
1381
+ buff.push(" ".repeat(indent));
1382
+ if (indent > 128) {
1383
+ buff.push("(((DEEPLY NESTED CONTENT OMITTED)))\n");
1384
+ return;
1385
+ }
1386
+ buff.push(node.tag);
1387
+ if (node.pos) {
1388
+ buff.push(` (${node.pos.start.line}:${node.pos.start.col}:${node.pos.start.offset}-${node.pos.end.line}:${node.pos.end.col}:${node.pos.end.offset})`);
1389
+ }
1390
+ for (const k in node) {
1391
+ if (!omitFields[k]) {
1392
+ const v = node[k];
1393
+ if (v !== undefined && v !== null) {
1394
+ buff.push(` ${k}=${stringify(v)}`);
1395
+ }
1396
+ }
1397
+ }
1398
+ if (node.attributes) {
1399
+ for (const k in node.attributes) {
1400
+ buff.push(` ${k}=${stringify(node.attributes[k])}`);
1401
+ }
1402
+ }
1403
+ buff.push("\n");
1404
+ if (node.children) {
1405
+ for (const child of node.children) {
1406
+ renderAstNode(child, buff, indent + 2);
1407
+ }
1408
+ }
1409
+ };
1410
+ // Render an AST in human-readable form, with indentation
1411
+ // showing the hierarchy.
1412
+ const renderAST = function (doc) {
1413
+ const buff = [];
1414
+ renderAstNode(doc, buff, 0);
1415
+ if (Object.keys(doc.references).length > 0) {
1416
+ buff.push("references\n");
1417
+ for (const k in doc.references) {
1418
+ buff.push(` [${stringify(k)}] =\n`);
1419
+ renderAstNode(doc.references[k], buff, 4);
1420
+ }
1421
+ }
1422
+ if (Object.keys(doc.footnotes).length > 0) {
1423
+ buff.push("footnotes\n");
1424
+ for (const k in doc.footnotes) {
1425
+ buff.push(` [${stringify(k)}] =\n`);
1426
+ renderAstNode(doc.footnotes[k], buff, 4);
1427
+ }
1428
+ }
1429
+ return buff.join("");
1430
+ };
1431
+ const parse = function (input, options = {}) {
1432
+ const parser = parseEvents(input, options);
1433
+ return parseFromEvents(parser, input, options);
1434
+ };
1435
+ export { parseFromEvents, parse, renderAST, getStringContent, isBlock, isRow, isCaption, isInline, };
1436
+ //# sourceMappingURL=parse.js.map