@aiquants/markdown 6.2.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +61 -3
  2. package/dist/{abnfDiagram-VRR7QNED-DX6eyf4O.cjs → abnfDiagram-VRR7QNED-B4qwBPG8.cjs} +1 -1
  3. package/dist/{abnfDiagram-VRR7QNED-Csrzuwyl.js → abnfDiagram-VRR7QNED-DJQK-fno.js} +3 -3
  4. package/dist/{arc-Gw7Urszo.js → arc-B5-ynLRd.js} +1 -1
  5. package/dist/{arc-ZAQ3z7kr.cjs → arc-CXmyMsv9.cjs} +1 -1
  6. package/dist/{architectureDiagram-ZJ3FMSHR-Coy6_Fcg.js → architectureDiagram-ZJ3FMSHR-C_JEocx6.js} +2 -2
  7. package/dist/{architectureDiagram-ZJ3FMSHR-DxzMbkp1.cjs → architectureDiagram-ZJ3FMSHR-DyhTbYvV.cjs} +1 -1
  8. package/dist/{blockDiagram-677ZJIJ3-THmR4OyE.cjs → blockDiagram-677ZJIJ3-BsWnBpmo.cjs} +1 -1
  9. package/dist/{blockDiagram-677ZJIJ3-CbR-wn2x.js → blockDiagram-677ZJIJ3-COWsJwrz.js} +3 -3
  10. package/dist/{c4Diagram-LMCZKHZV-DHMqNO9p.js → c4Diagram-LMCZKHZV-BJGPyybb.js} +2 -2
  11. package/dist/{c4Diagram-LMCZKHZV-BcJpuXK1.cjs → c4Diagram-LMCZKHZV-C8SAoymj.cjs} +1 -1
  12. package/dist/{channel-Cryph4zI.cjs → channel-Catm-7_m.cjs} +1 -1
  13. package/dist/{channel-CfC4eqki.js → channel-gEEzHgMK.js} +1 -1
  14. package/dist/{chunk-2Q5K7J3B-C3BIc3MH.js → chunk-2Q5K7J3B-BrZPj48S.js} +1 -1
  15. package/dist/{chunk-2Q5K7J3B-CxWyY331.cjs → chunk-2Q5K7J3B-D2pUNN7e.cjs} +1 -1
  16. package/dist/{chunk-32BRIVSS-C3w_aYfI.cjs → chunk-32BRIVSS-BHwCDqTA.cjs} +1 -1
  17. package/dist/{chunk-32BRIVSS-C37ccuiX.js → chunk-32BRIVSS-Qjp2CRZG.js} +1 -1
  18. package/dist/{chunk-5VM5RSS4-Cbt79-V5.cjs → chunk-5VM5RSS4-C-2Xl1mK.cjs} +1 -1
  19. package/dist/{chunk-5VM5RSS4-DVLmkcyq.js → chunk-5VM5RSS4-Cz-1oXF8.js} +1 -1
  20. package/dist/{chunk-EX3LRPZG-BZOxrSRn.cjs → chunk-EX3LRPZG-CcWHrBHu.cjs} +1 -1
  21. package/dist/{chunk-EX3LRPZG-Co0Bql0-.js → chunk-EX3LRPZG-DOly63cQ.js} +4 -4
  22. package/dist/{chunk-JWPE2WC7-DUndc3Wb.js → chunk-JWPE2WC7-D8oKuUKk.js} +1 -1
  23. package/dist/{chunk-JWPE2WC7-Cvt_ToFU.cjs → chunk-JWPE2WC7-uLMzLWor.cjs} +1 -1
  24. package/dist/{chunk-MOJQB5TN-AAMW2q8N.cjs → chunk-MOJQB5TN-CFHULd2m.cjs} +1 -1
  25. package/dist/{chunk-MOJQB5TN-aTSDPliR.js → chunk-MOJQB5TN-DFfn4gwS.js} +1 -1
  26. package/dist/{chunk-PUDLZKDR-Q5QzbDtY.js → chunk-PUDLZKDR-BSXgzvcs.js} +6 -6
  27. package/dist/{chunk-PUDLZKDR-CzCdcyAN.cjs → chunk-PUDLZKDR-CdXVWW4P.cjs} +1 -1
  28. package/dist/{chunk-RYQCIY6F-DbjhsOnH.cjs → chunk-RYQCIY6F-CVamSMzr.cjs} +1 -1
  29. package/dist/{chunk-RYQCIY6F-O6wbIIFF.js → chunk-RYQCIY6F-D7rBCtF6.js} +1 -1
  30. package/dist/{chunk-V7JOEXUC-OTS1fN7j.js → chunk-V7JOEXUC-BEGUrMN0.js} +5 -5
  31. package/dist/{chunk-V7JOEXUC-B6Qc5ABc.cjs → chunk-V7JOEXUC-DJuvtTef.cjs} +1 -1
  32. package/dist/{chunk-VR4S4FIN-D4tY80kq.js → chunk-VR4S4FIN-DbzCqIxB.js} +1 -1
  33. package/dist/{chunk-VR4S4FIN-DlneMFEg.cjs → chunk-VR4S4FIN-Okfemb3d.cjs} +1 -1
  34. package/dist/{chunk-XXDRQBXY-CvhBfnFQ.cjs → chunk-XXDRQBXY-DQBgFSg2.cjs} +1 -1
  35. package/dist/{chunk-XXDRQBXY-58rTAwvh.js → chunk-XXDRQBXY-DzmhMVRC.js} +1 -1
  36. package/dist/{classDiagram-v2-EOCWNBFH-hcuKRiyp.js → classDiagram-OUVF2IWQ-BGn-HjT8.js} +2 -2
  37. package/dist/{classDiagram-OUVF2IWQ-C0S2HAJU.cjs → classDiagram-OUVF2IWQ-DR8DD7tr.cjs} +1 -1
  38. package/dist/{classDiagram-OUVF2IWQ-hcuKRiyp.js → classDiagram-v2-EOCWNBFH-BGn-HjT8.js} +2 -2
  39. package/dist/{classDiagram-v2-EOCWNBFH-C0S2HAJU.cjs → classDiagram-v2-EOCWNBFH-DR8DD7tr.cjs} +1 -1
  40. package/dist/components/MermaidDiagram.d.ts +1 -0
  41. package/dist/components/mathRendering.d.ts +1 -0
  42. package/dist/components/mdastNodes/CodeNode.d.ts +2 -1
  43. package/dist/conversion.d.ts +26 -0
  44. package/dist/converter/NOTICES.md +178 -0
  45. package/dist/converter/createMarkdownConverter.d.ts +12 -0
  46. package/dist/converter/protocol.d.ts +58 -0
  47. package/dist/converter/serve.d.ts +12 -0
  48. package/dist/converter/worker.d.ts +1 -0
  49. package/dist/converter/worker.js +76 -0
  50. package/dist/converter.cjs +1 -0
  51. package/dist/converter.d.ts +4 -0
  52. package/dist/converter.js +109 -0
  53. package/dist/converter.wasm +0 -0
  54. package/dist/{cose-bilkent-JH36ORCC-BwltbHKG.js → cose-bilkent-JH36ORCC-CXaSZTQh.js} +1 -1
  55. package/dist/{cose-bilkent-JH36ORCC-DVZVn03H.cjs → cose-bilkent-JH36ORCC-DKpnPAKO.cjs} +1 -1
  56. package/dist/{cynefinDiagram-TSTJHNR4-ogTeIoNY.js → cynefinDiagram-TSTJHNR4-BQSdT_2p.js} +2 -2
  57. package/dist/{cynefinDiagram-TSTJHNR4-DYCBxaEi.cjs → cynefinDiagram-TSTJHNR4-WzHtBOXU.cjs} +1 -1
  58. package/dist/{dagre-VKFMJZFB-DJW9o9XX.cjs → dagre-VKFMJZFB-BOlxvZO9.cjs} +1 -1
  59. package/dist/{dagre-VKFMJZFB-BfNdgMHQ.js → dagre-VKFMJZFB-DQ5e1PJD.js} +2 -2
  60. package/dist/{diagram-FQU43EPY-BRpNVpgn.cjs → diagram-FQU43EPY-DdDxGx-M.cjs} +1 -1
  61. package/dist/{diagram-FQU43EPY-CJf3yD8h.js → diagram-FQU43EPY-DlCF28sn.js} +2 -2
  62. package/dist/{diagram-G47NLZAW-5rZfUeWV.cjs → diagram-G47NLZAW-Cvts7_pn.cjs} +1 -1
  63. package/dist/{diagram-G47NLZAW-D0-6oupP.js → diagram-G47NLZAW-DVdw7HhH.js} +3 -3
  64. package/dist/{diagram-NH7WQ7WH-BwrWWWZJ.js → diagram-NH7WQ7WH-BkU3b82h.js} +2 -2
  65. package/dist/{diagram-NH7WQ7WH-g7m8p5fK.cjs → diagram-NH7WQ7WH-Cs_Dyb0p.cjs} +1 -1
  66. package/dist/{diagram-OA4YK3LP-BBqA1m8s.js → diagram-OA4YK3LP-D39RUkK3.js} +3 -3
  67. package/dist/{diagram-OA4YK3LP-BxP8KUna.cjs → diagram-OA4YK3LP-ONhluSWR.cjs} +1 -1
  68. package/dist/{diagram-WEI45ONY-CMexm2GN.js → diagram-WEI45ONY-CMD5pSfn.js} +2 -2
  69. package/dist/{diagram-WEI45ONY-DgJyq1w0.cjs → diagram-WEI45ONY-DyEvKt6H.cjs} +1 -1
  70. package/dist/{ebnfDiagram-CCIWWBDH-sfiWOXCW.cjs → ebnfDiagram-CCIWWBDH-Bi-wg1C0.cjs} +1 -1
  71. package/dist/{ebnfDiagram-CCIWWBDH-DvLr_8nV.js → ebnfDiagram-CCIWWBDH-Z3TtxdlL.js} +3 -3
  72. package/dist/{erDiagram-Q63AITRT-D6U6Ng3Y.js → erDiagram-Q63AITRT-C-O8hBWj.js} +4 -4
  73. package/dist/{erDiagram-Q63AITRT-B11THykZ.cjs → erDiagram-Q63AITRT-DQO3kH0H.cjs} +1 -1
  74. package/dist/errors-BW5JXRoX.cjs +1 -0
  75. package/dist/errors-Blk_XJ9C.js +55 -0
  76. package/dist/errors.d.ts +12 -0
  77. package/dist/extractHeadings-DSlyjlEb.cjs +311 -0
  78. package/dist/{extractHeadings-CdLPwHlC.js → extractHeadings-DkKFCMIW.js} +5195 -5149
  79. package/dist/flowDiagram-23GEKE2U-BHV7jjdl.js +7 -0
  80. package/dist/flowDiagram-23GEKE2U-Bn8nX3mJ.cjs +1 -0
  81. package/dist/{ganttDiagram-NO4QXBWP-CGCdgj0K.js → ganttDiagram-NO4QXBWP-BgxDDjW1.js} +2 -2
  82. package/dist/{ganttDiagram-NO4QXBWP-BLlXK3zo.cjs → ganttDiagram-NO4QXBWP-C6v1dyOv.cjs} +1 -1
  83. package/dist/gen/markdown/v1/markdown_pb.d.ts +1 -0
  84. package/dist/{gitGraphDiagram-IHSO6WYX-Bib3c0C6.js → gitGraphDiagram-IHSO6WYX-BSIaczat.js} +3 -3
  85. package/dist/{gitGraphDiagram-IHSO6WYX-BHOyibqH.cjs → gitGraphDiagram-IHSO6WYX-Dly6wuUW.cjs} +1 -1
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.client.cjs +1 -1
  88. package/dist/index.client.js +1 -1
  89. package/dist/index.js +1 -1
  90. package/dist/index.server.cjs +1 -1
  91. package/dist/index.server.d.ts +3 -1
  92. package/dist/index.server.js +185 -178
  93. package/dist/{infoDiagram-FWYZ7A6U-BUqDBIaP.js → infoDiagram-FWYZ7A6U-BJpiPMD3.js} +1 -1
  94. package/dist/{infoDiagram-FWYZ7A6U-BcDp6g1Y.cjs → infoDiagram-FWYZ7A6U-CRxeian2.cjs} +1 -1
  95. package/dist/{ishikawaDiagram-FXEZZL3T-CcPh4nuP.js → ishikawaDiagram-FXEZZL3T-B3tCfTEo.js} +1 -1
  96. package/dist/{ishikawaDiagram-FXEZZL3T-C3QHQ1ia.cjs → ishikawaDiagram-FXEZZL3T-jEnTu6LN.cjs} +1 -1
  97. package/dist/{journeyDiagram-5HDEW3XC-B17v98Wb.cjs → journeyDiagram-5HDEW3XC-BXFW-Svx.cjs} +1 -1
  98. package/dist/{journeyDiagram-5HDEW3XC-MdxndgF1.js → journeyDiagram-5HDEW3XC-D7U-NNAM.js} +4 -4
  99. package/dist/{kanban-definition-HUTT4EX6-JhfZ6Qik.js → kanban-definition-HUTT4EX6-B14iIRCh.js} +2 -2
  100. package/dist/{kanban-definition-HUTT4EX6-BApVXeVQ.cjs → kanban-definition-HUTT4EX6-DSprt7D2.cjs} +1 -1
  101. package/dist/{linear-CIVwb13z.cjs → linear-B-_z7_Qw.cjs} +1 -1
  102. package/dist/{linear-dbOUbGpD.js → linear-DZOg62FH.js} +1 -1
  103. package/dist/{mindmap-definition-LN4V7U3C-BUbo0u-Y.cjs → mindmap-definition-LN4V7U3C-Bs_ccQ71.cjs} +1 -1
  104. package/dist/{mindmap-definition-LN4V7U3C-gNTBga2z.js → mindmap-definition-LN4V7U3C-Dh-Z6t4L.js} +3 -3
  105. package/dist/{pegDiagram-2B236MQR-BqjpbNkG.js → pegDiagram-2B236MQR-6OQwK0r-.js} +3 -3
  106. package/dist/{pegDiagram-2B236MQR-DZiQVxu1.cjs → pegDiagram-2B236MQR-BunF191h.cjs} +1 -1
  107. package/dist/{pieDiagram-ENE6RG2P-D2nxDVFV.cjs → pieDiagram-ENE6RG2P-BUdykoZb.cjs} +1 -1
  108. package/dist/{pieDiagram-ENE6RG2P-C1Gr48CK.js → pieDiagram-ENE6RG2P-DjvAa5zD.js} +3 -3
  109. package/dist/{quadrantDiagram-ABIIQ3AL-DuD9ZdUQ.js → quadrantDiagram-ABIIQ3AL-DfiOa0GN.js} +2 -2
  110. package/dist/{quadrantDiagram-ABIIQ3AL-C855tL3K.cjs → quadrantDiagram-ABIIQ3AL-ksoulitn.cjs} +1 -1
  111. package/dist/{railroadDiagram-RFXS5EU6-BZsnhaQd.cjs → railroadDiagram-RFXS5EU6-BWupYLwR.cjs} +1 -1
  112. package/dist/{railroadDiagram-RFXS5EU6-xx1d3Md8.js → railroadDiagram-RFXS5EU6-DxJ3t05t.js} +3 -3
  113. package/dist/remarkProcessor.server.d.ts +1 -27
  114. package/dist/{requirementDiagram-TGXJPOKE-CCu1UYFH.js → requirementDiagram-TGXJPOKE-CxplHHB8.js} +3 -3
  115. package/dist/{requirementDiagram-TGXJPOKE-D_NbFRkb.cjs → requirementDiagram-TGXJPOKE-D17FjoFO.cjs} +1 -1
  116. package/dist/{sankeyDiagram-HTMAVEWB-Dn2Ta-XX.cjs → sankeyDiagram-HTMAVEWB-CDXvEE-n.cjs} +1 -1
  117. package/dist/{sankeyDiagram-HTMAVEWB-QGzXzczJ.js → sankeyDiagram-HTMAVEWB-DFOQ2fD-.js} +1 -1
  118. package/dist/{sequenceDiagram-DBY2YBRQ-BA3Oc4pz.cjs → sequenceDiagram-DBY2YBRQ-D-aVI5Yt.cjs} +1 -1
  119. package/dist/{sequenceDiagram-DBY2YBRQ-CjnUnaw9.js → sequenceDiagram-DBY2YBRQ-Gf5VRPPO.js} +3 -3
  120. package/dist/{sizeCapture-X5ZJPWSS-BPQhVBe0.cjs → sizeCapture-X5ZJPWSS-BAB3SekL.cjs} +1 -1
  121. package/dist/{sizeCapture-X5ZJPWSS-nb9uU-BE.js → sizeCapture-X5ZJPWSS-DyErW1EK.js} +1 -1
  122. package/dist/source-lines.cjs +1 -0
  123. package/dist/source-lines.d.ts +6 -0
  124. package/dist/source-lines.js +11 -0
  125. package/dist/{stateDiagram-2N3HPSRC-DSqLqSY5.cjs → stateDiagram-2N3HPSRC-BrUDPgXu.cjs} +1 -1
  126. package/dist/{stateDiagram-2N3HPSRC-Byg3E1AA.js → stateDiagram-2N3HPSRC-lxQmuBDw.js} +2 -2
  127. package/dist/{stateDiagram-v2-6OUMAXLB-VRhXyf-C.cjs → stateDiagram-v2-6OUMAXLB-B67PZ7bz.cjs} +1 -1
  128. package/dist/{stateDiagram-v2-6OUMAXLB-hKcuYy9t.js → stateDiagram-v2-6OUMAXLB-l5VmN12f.js} +2 -2
  129. package/dist/{swimlanes-5IMT3BWC-DyIDdThc.js → swimlanes-5IMT3BWC-CMkiOd-R.js} +3 -3
  130. package/dist/{swimlanes-5IMT3BWC-CVnOKNcb.cjs → swimlanes-5IMT3BWC-DW61y4w7.cjs} +1 -1
  131. package/dist/{swimlanesDiagram-G3AALYLV-BF1ofRjP.js → swimlanesDiagram-G3AALYLV-CaDY11RK.js} +2 -2
  132. package/dist/{swimlanesDiagram-G3AALYLV-C3U5wLlX.cjs → swimlanesDiagram-G3AALYLV-DN1x1exB.cjs} +1 -1
  133. package/dist/{timeline-definition-FHXFAJF6-KUETCXLT.cjs → timeline-definition-FHXFAJF6-DCW8SrSN.cjs} +1 -1
  134. package/dist/{timeline-definition-FHXFAJF6-DBmE_qU3.js → timeline-definition-FHXFAJF6-GIvmYQNR.js} +2 -2
  135. package/dist/{vennDiagram-L72KCM5P-C6j4k5X-.js → vennDiagram-L72KCM5P-DtN1NFNM.js} +1 -1
  136. package/dist/{vennDiagram-L72KCM5P-DkSV3dIE.cjs → vennDiagram-L72KCM5P-wENEw3FH.cjs} +1 -1
  137. package/dist/{wardleyDiagram-EHGQE667-BaG6Cf_u.js → wardleyDiagram-EHGQE667-CPYTbfuJ.js} +2 -2
  138. package/dist/{wardleyDiagram-EHGQE667-uWMTMxL-.cjs → wardleyDiagram-EHGQE667-Daugt2NV.cjs} +1 -1
  139. package/dist/{xychartDiagram-FW5EYKEG-QAFE-xqg.cjs → xychartDiagram-FW5EYKEG-B3D8pi1c.cjs} +1 -1
  140. package/dist/{xychartDiagram-FW5EYKEG-BPl5BnMB.js → xychartDiagram-FW5EYKEG-C-NgU5xv.js} +2 -2
  141. package/package.json +23 -8
  142. package/dist/extractHeadings-DRUBnhbi.cjs +0 -311
  143. package/dist/flowDiagram-23GEKE2U-CDscoQ9F.cjs +0 -1
  144. package/dist/flowDiagram-23GEKE2U-CLibi_u4.js +0 -7
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./chunk-V7JOEXUC-B6Qc5ABc.cjs"),a=require("./extractHeadings-DRUBnhbi.cjs");var s={parser:r.classDiagram_default,get db(){return new r.ClassDB},renderer:r.classRenderer_v3_unified_default,styles:r.styles_default,init:a.__name(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};exports.diagram=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./chunk-V7JOEXUC-DJuvtTef.cjs"),a=require("./extractHeadings-DSlyjlEb.cjs");var s={parser:r.classDiagram_default,get db(){return new r.ClassDB},renderer:r.classRenderer_v3_unified_default,styles:r.styles_default,init:a.__name(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};exports.diagram=s;
@@ -1,5 +1,5 @@
1
- import { s as r, c as s, a as e, C as t } from "./chunk-V7JOEXUC-OTS1fN7j.js";
2
- import { _ as l } from "./extractHeadings-CdLPwHlC.js";
1
+ import { s as r, c as s, a as e, C as t } from "./chunk-V7JOEXUC-BEGUrMN0.js";
2
+ import { _ as l } from "./extractHeadings-DkKFCMIW.js";
3
3
  var d = {
4
4
  parser: e,
5
5
  get db() {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./chunk-V7JOEXUC-B6Qc5ABc.cjs"),a=require("./extractHeadings-DRUBnhbi.cjs");var s={parser:r.classDiagram_default,get db(){return new r.ClassDB},renderer:r.classRenderer_v3_unified_default,styles:r.styles_default,init:a.__name(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};exports.diagram=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./chunk-V7JOEXUC-DJuvtTef.cjs"),a=require("./extractHeadings-DSlyjlEb.cjs");var s={parser:r.classDiagram_default,get db(){return new r.ClassDB},renderer:r.classRenderer_v3_unified_default,styles:r.styles_default,init:a.__name(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};exports.diagram=s;
@@ -7,6 +7,7 @@ interface MermaidDiagramProps {
7
7
  interaction?: MermaidInteractionMode;
8
8
  hideInteractionMenu?: boolean;
9
9
  labels?: MermaidDiagramLabels;
10
+ sourceLines?: string;
10
11
  }
11
12
  export declare const MERMAID_REDRAW_DELAY_MS = 200;
12
13
  export declare const MermaidDiagram: import("react").NamedExoticComponent<MermaidDiagramProps>;
@@ -9,3 +9,4 @@ export type RenderedMath = {
9
9
  readonly diagnostics: readonly MarkdownMathDiagnostic[];
10
10
  };
11
11
  export declare const renderMath: (formula: string, displayMode: boolean) => RenderedMath;
12
+ export declare const RENDERED_MATH_CACHE_SIZE = 610;
@@ -2,10 +2,11 @@ type CodeNodeProps = {
2
2
  lang?: string;
3
3
  code?: string;
4
4
  theme?: "light" | "dark";
5
+ sourceLines?: string;
5
6
  node?: {
6
7
  lang?: string | null;
7
8
  value: string;
8
9
  };
9
10
  };
10
- export declare const CodeNode: ({ lang: langProp, code, node }: CodeNodeProps) => import("react").JSX.Element;
11
+ export declare const CodeNode: ({ lang: langProp, code, node, sourceLines }: CodeNodeProps) => import("react").JSX.Element;
11
12
  export {};
@@ -0,0 +1,26 @@
1
+ export declare const RESPONSE_HEADROOM_BYTES: number;
2
+ export declare const MAX_HTML_BYTES_LIMIT: number;
3
+ export interface ParseResult {
4
+ htmlContent: string;
5
+ headings: Array<{
6
+ text: string;
7
+ depth: number;
8
+ id: string;
9
+ }>;
10
+ }
11
+ export interface ParseOptions {
12
+ deniedPathSegments: readonly string[];
13
+ maxHtmlBytes: number;
14
+ resolveImports?: boolean;
15
+ validateExistence?: boolean;
16
+ includeSourceLines?: boolean;
17
+ enableSubscript?: boolean;
18
+ enableSuperscript?: boolean;
19
+ enableMark?: boolean;
20
+ enableTableMerge?: boolean;
21
+ enableEmbeds?: boolean;
22
+ enableZennDirectives?: boolean;
23
+ signal?: AbortSignal;
24
+ timeoutMs?: number;
25
+ }
26
+ export declare const assertConversionOptions: (options: Pick<ParseOptions, "deniedPathSegments" | "maxHtmlBytes">, caller: string) => void;
@@ -0,0 +1,178 @@
1
+ # Third-party notices of the browser converter
2
+
3
+ `converter.wasm` is the Go program `cmd/markdown-wasm` of `packages/go/markdown-api`, compiled with the Go toolchain
4
+ go1.27.0; `converter/worker.js` starts with that toolchain's `wasm_exec.js`. They contain the following software.
5
+
6
+ ## The Go toolchain go1.27.0 (the runtime, the standard library and `wasm_exec.js`)
7
+
8
+ ```text
9
+ Copyright 2009 The Go Authors.
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are
13
+ met:
14
+
15
+ * Redistributions of source code must retain the above copyright
16
+ notice, this list of conditions and the following disclaimer.
17
+ * Redistributions in binary form must reproduce the above
18
+ copyright notice, this list of conditions and the following disclaimer
19
+ in the documentation and/or other materials provided with the
20
+ distribution.
21
+ * Neither the name of Google LLC nor the names of its
22
+ contributors may be used to endorse or promote products derived from
23
+ this software without specific prior written permission.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+ ```
37
+
38
+ ## github.com/aiquants/markdown-api (this repository)
39
+
40
+ ```text
41
+ MIT License
42
+
43
+ Copyright (c) 2026 AI Quants / fehde-k
44
+
45
+ Permission is hereby granted, free of charge, to any person obtaining a copy
46
+ of this software and associated documentation files (the "Software"), to deal
47
+ in the Software without restriction, including without limitation the rights
48
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49
+ copies of the Software, and to permit persons to whom the Software is
50
+ furnished to do so, subject to the following conditions:
51
+
52
+ The above copyright notice and this permission notice shall be included in all
53
+ copies or substantial portions of the Software.
54
+
55
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
61
+ SOFTWARE.
62
+ ```
63
+
64
+ ## github.com/aiquants/storage-api (a local module of this repository)
65
+
66
+ ```text
67
+ MIT License
68
+
69
+ Copyright (c) 2026 AI Quants / fehde-k
70
+
71
+ Permission is hereby granted, free of charge, to any person obtaining a copy
72
+ of this software and associated documentation files (the "Software"), to deal
73
+ in the Software without restriction, including without limitation the rights
74
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
75
+ copies of the Software, and to permit persons to whom the Software is
76
+ furnished to do so, subject to the following conditions:
77
+
78
+ The above copyright notice and this permission notice shall be included in all
79
+ copies or substantial portions of the Software.
80
+
81
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
82
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
83
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
84
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
85
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
86
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
87
+ SOFTWARE.
88
+ ```
89
+
90
+ ## github.com/yuin/goldmark v1.7.1
91
+
92
+ ```text
93
+ MIT License
94
+
95
+ Copyright (c) 2019 Yusuke Inuzuka
96
+
97
+ Permission is hereby granted, free of charge, to any person obtaining a copy
98
+ of this software and associated documentation files (the "Software"), to deal
99
+ in the Software without restriction, including without limitation the rights
100
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
101
+ copies of the Software, and to permit persons to whom the Software is
102
+ furnished to do so, subject to the following conditions:
103
+
104
+ The above copyright notice and this permission notice shall be included in all
105
+ copies or substantial portions of the Software.
106
+
107
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
108
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
109
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
110
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
111
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
112
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
113
+ SOFTWARE.
114
+ ```
115
+
116
+ ## golang.org/x/net v0.26.0
117
+
118
+ ```text
119
+ Copyright (c) 2009 The Go Authors. All rights reserved.
120
+
121
+ Redistribution and use in source and binary forms, with or without
122
+ modification, are permitted provided that the following conditions are
123
+ met:
124
+
125
+ * Redistributions of source code must retain the above copyright
126
+ notice, this list of conditions and the following disclaimer.
127
+ * Redistributions in binary form must reproduce the above
128
+ copyright notice, this list of conditions and the following disclaimer
129
+ in the documentation and/or other materials provided with the
130
+ distribution.
131
+ * Neither the name of Google Inc. nor the names of its
132
+ contributors may be used to endorse or promote products derived from
133
+ this software without specific prior written permission.
134
+
135
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
136
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
138
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146
+ ```
147
+
148
+ ## golang.org/x/text v0.16.0
149
+
150
+ ```text
151
+ Copyright (c) 2009 The Go Authors. All rights reserved.
152
+
153
+ Redistribution and use in source and binary forms, with or without
154
+ modification, are permitted provided that the following conditions are
155
+ met:
156
+
157
+ * Redistributions of source code must retain the above copyright
158
+ notice, this list of conditions and the following disclaimer.
159
+ * Redistributions in binary form must reproduce the above
160
+ copyright notice, this list of conditions and the following disclaimer
161
+ in the documentation and/or other materials provided with the
162
+ distribution.
163
+ * Neither the name of Google Inc. nor the names of its
164
+ contributors may be used to endorse or promote products derived from
165
+ this software without specific prior written permission.
166
+
167
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
168
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
169
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
170
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
171
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
172
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
173
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
174
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
175
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
176
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
177
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
178
+ ```
@@ -0,0 +1,12 @@
1
+ import { ParseResult } from "../conversion.ts";
2
+ import { BrowserConversion } from "./protocol.ts";
3
+ export interface MarkdownConverterSetup {
4
+ readonly workerUrl: string | URL;
5
+ readonly wasmUrl: string | URL;
6
+ readonly timeoutMs: number;
7
+ }
8
+ export interface MarkdownConverter {
9
+ readonly convert: (conversion: BrowserConversion, signal?: AbortSignal) => Promise<ParseResult>;
10
+ readonly dispose: () => void;
11
+ }
12
+ export declare const createMarkdownConverter: (setup: MarkdownConverterSetup) => MarkdownConverter;
@@ -0,0 +1,58 @@
1
+ import { ParseOptions, ParseResult } from "../conversion.ts";
2
+ export declare const CONVERT_FUNCTION_NAME = "aiquantsMarkdownConvert";
3
+ export type BrowserParseOptions = Omit<ParseOptions, "resolveImports" | "validateExistence" | "signal" | "timeoutMs">;
4
+ export interface BrowserConversion {
5
+ readonly markdownText: string;
6
+ readonly filePath: string;
7
+ readonly workspaceRoot: string;
8
+ readonly options: BrowserParseOptions;
9
+ }
10
+ export type BrowserConversionErrorCode = (typeof BROWSER_CONVERSION_ERROR_CODES)[number];
11
+ export declare const BROWSER_CONVERSION_ERROR_CODES: readonly [
12
+ "invalid_argument",
13
+ "resource_exhausted",
14
+ "internal"
15
+ ];
16
+ export interface WasmConversionRequest {
17
+ readonly markdownText: string;
18
+ readonly filePath: string;
19
+ readonly workspaceRoot: string;
20
+ readonly includeSourceLines: boolean;
21
+ readonly enableSubscript: boolean | undefined;
22
+ readonly enableSuperscript: boolean | undefined;
23
+ readonly enableMark: boolean | undefined;
24
+ readonly enableTableMerge: boolean | undefined;
25
+ readonly enableEmbeds: boolean | undefined;
26
+ readonly enableZennDirectives: boolean | undefined;
27
+ readonly maxHtmlBytes: number;
28
+ readonly denySegmentPatterns: readonly string[];
29
+ }
30
+ export type WasmConversionAnswer = ParseResult | {
31
+ readonly error: {
32
+ readonly code: BrowserConversionErrorCode;
33
+ readonly message: string;
34
+ };
35
+ };
36
+ export type ConverterWorkerRequest = {
37
+ readonly type: "load";
38
+ readonly wasmUrl: string;
39
+ } | {
40
+ readonly type: "convert";
41
+ readonly id: number;
42
+ readonly request: WasmConversionRequest;
43
+ };
44
+ export type ConverterWorkerMessage = {
45
+ readonly type: "loaded";
46
+ } | {
47
+ readonly type: "converted";
48
+ readonly id: number;
49
+ readonly answer: WasmConversionAnswer;
50
+ } | {
51
+ readonly type: "load-failed";
52
+ readonly message: string;
53
+ } | {
54
+ readonly type: "crashed";
55
+ readonly id: number;
56
+ readonly message: string;
57
+ };
58
+ export declare const wasmRequestOf: (conversion: BrowserConversion) => WasmConversionRequest;
@@ -0,0 +1,12 @@
1
+ import { ConverterWorkerMessage, ConverterWorkerRequest } from "./protocol.ts";
2
+ export interface GoRuntime {
3
+ readonly importObject: WebAssembly.Imports;
4
+ run(instance: WebAssembly.Instance): Promise<void>;
5
+ }
6
+ export type GoRuntimeConstructor = new () => GoRuntime;
7
+ export interface ConverterWorkerScope {
8
+ postMessage(message: ConverterWorkerMessage): void;
9
+ addEventListener(type: "message", listener: (event: MessageEvent<ConverterWorkerRequest>) => void): void;
10
+ close(): void;
11
+ }
12
+ export declare const serveConverter: (scope: ConverterWorkerScope, Go: GoRuntimeConstructor | undefined) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ /*! The first part of this file is wasm_exec.js of the Go toolchain go1.27.0, under the following license. See NOTICES.md for the converter's notices.
2
+
3
+ Copyright 2009 The Go Authors.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+ * Redistributions in binary form must reproduce the above
12
+ copyright notice, this list of conditions and the following disclaimer
13
+ in the documentation and/or other materials provided with the
14
+ distribution.
15
+ * Neither the name of Google LLC nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+ "use strict";(()=>{const o=()=>{const h=new Error("not implemented");return h.code="ENOSYS",h};if(!globalThis.fs){let h="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(n,s){h+=_.decode(s);const i=h.lastIndexOf(`
32
+ `);return i!=-1&&(console.log(h.substring(0,i)),h=h.substring(i+1)),s.length},write(n,s,i,r,f,u){if(i!==0||r!==s.length||f!==null){u(o());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(o())},chown(n,s,i,r){r(o())},close(n,s){s(o())},fchmod(n,s,i){i(o())},fchown(n,s,i,r){r(o())},fstat(n,s){s(o())},fsync(n,s){s(null)},ftruncate(n,s,i){i(o())},lchown(n,s,i,r){r(o())},link(n,s,i){i(o())},lstat(n,s){s(o())},mkdir(n,s,i){i(o())},open(n,s,i,r){r(o())},read(n,s,i,r,f,u){u(o())},readdir(n,s){s(o())},readlink(n,s){s(o())},rename(n,s,i){i(o())},rmdir(n,s){s(o())},stat(n,s){s(o())},symlink(n,s,i){i(o())},truncate(n,s,i){i(o())},unlink(n,s){s(o())},utimes(n,s,i,r){r(o())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw o()},pid:-1,ppid:-1,umask(){throw o()},cwd(){throw o()},chdir(){throw o()}}),globalThis.path||(globalThis.path={resolve(...h){return h.join("/")}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const y=new TextEncoder("utf-8"),_=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=t=>{t!==0&&console.warn("exit code:",t)},this._exitPromise=new Promise(t=>{this._resolveExitPromise=t}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const h=(t,e)=>{this.mem.setUint32(t+0,e,!0),this.mem.setUint32(t+4,Math.floor(e/4294967296),!0)},n=(t,e)=>{this.mem.setUint32(t+0,e,!0)},s=t=>{const e=this.mem.getUint32(t+0,!0),l=this.mem.getInt32(t+4,!0);return e+l*4294967296},i=t=>{const e=this.mem.getFloat64(t,!0);if(e===0)return;if(!isNaN(e))return e;const l=this.mem.getUint32(t,!0);return this._values[l]},r=(t,e)=>{if(typeof e=="number"&&e!==0){if(isNaN(e)){this.mem.setUint32(t+4,2146959360,!0),this.mem.setUint32(t,0,!0);return}this.mem.setFloat64(t,e,!0);return}if(e===void 0){this.mem.setFloat64(t,0,!0);return}let a=this._ids.get(e);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=e,this._goRefCounts[a]=0,this._ids.set(e,a)),this._goRefCounts[a]++;let c=0;switch(typeof e){case"object":e!==null&&(c=1);break;case"string":c=2;break;case"symbol":c=3;break;case"function":c=4;break}this.mem.setUint32(t+4,2146959360|c,!0),this.mem.setUint32(t,a,!0)},f=t=>{const e=s(t+0),l=s(t+8);return new Uint8Array(this._inst.exports.mem.buffer,e,l)},u=t=>{const e=s(t+0),l=s(t+8),a=new Array(l);for(let c=0;c<l;c++)a[c]=i(e+c*8);return a},d=t=>{const e=s(t+0),l=s(t+8);return _.decode(new DataView(this._inst.exports.mem.buffer,e,l))},m=(t,e)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(t,e)),g=Date.now()-performance.now();this.importObject={_gotest:{add:(t,e)=>t+e,callExport:m},gojs:{"runtime.wasmExit":t=>{t>>>=0;const e=this.mem.getInt32(t+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(e)},"runtime.wasmWrite":t=>{t>>>=0;const e=s(t+8),l=s(t+16),a=this.mem.getInt32(t+24,!0);fs.writeSync(e,new Uint8Array(this._inst.exports.mem.buffer,l,a))},"runtime.resetMemoryDataView":t=>{t>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":t=>{t>>>=0,h(t+8,(g+performance.now())*1e6)},"runtime.walltime":t=>{t>>>=0;const e=new Date().getTime();h(t+8,e/1e3),this.mem.setInt32(t+16,e%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":t=>{t>>>=0;const e=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(e,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(e);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},s(t+8))),this.mem.setInt32(t+16,e,!0)},"runtime.clearTimeoutEvent":t=>{t>>>=0;const e=this.mem.getInt32(t+8,!0);clearTimeout(this._scheduledTimeouts.get(e)),this._scheduledTimeouts.delete(e)},"runtime.getRandomData":t=>{t>>>=0,crypto.getRandomValues(f(t+8))},"syscall/js.finalizeRef":t=>{t>>>=0;const e=this.mem.getUint32(t+8,!0);if(this._goRefCounts[e]--,this._goRefCounts[e]===0){const l=this._values[e];this._values[e]=null,this._ids.delete(l),this._idPool.push(e)}},"syscall/js.stringVal":t=>{t>>>=0,r(t+24,d(t+8))},"syscall/js.valueGet":t=>{t>>>=0;const e=Reflect.get(i(t+8),d(t+16));t=this._inst.exports.getsp()>>>0,r(t+32,e)},"syscall/js.valueSet":t=>{t>>>=0,Reflect.set(i(t+8),d(t+16),i(t+32))},"syscall/js.valueDelete":t=>{t>>>=0,Reflect.deleteProperty(i(t+8),d(t+16))},"syscall/js.valueIndex":t=>{t>>>=0,r(t+24,Reflect.get(i(t+8),s(t+16)))},"syscall/js.valueSetIndex":t=>{t>>>=0,Reflect.set(i(t+8),s(t+16),i(t+24))},"syscall/js.valueCall":t=>{t>>>=0;try{const e=i(t+8),l=Reflect.get(e,d(t+16)),a=u(t+32),c=Reflect.apply(l,e,a);t=this._inst.exports.getsp()>>>0,r(t+56,c),this.mem.setUint8(t+64,1)}catch(e){t=this._inst.exports.getsp()>>>0,r(t+56,e),this.mem.setUint8(t+64,0)}},"syscall/js.valueInvoke":t=>{t>>>=0;try{const e=i(t+8),l=u(t+16),a=Reflect.apply(e,void 0,l);t=this._inst.exports.getsp()>>>0,r(t+40,a),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,r(t+40,e),this.mem.setUint8(t+48,0)}},"syscall/js.valueNew":t=>{t>>>=0;try{const e=i(t+8),l=u(t+16),a=Reflect.construct(e,l);t=this._inst.exports.getsp()>>>0,r(t+40,a),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,r(t+40,e),this.mem.setUint8(t+48,0)}},"syscall/js.valueLength":t=>{t>>>=0,h(t+16,parseInt(i(t+8).length))},"syscall/js.valuePrepareString":t=>{t>>>=0;const e=y.encode(String(i(t+8)));r(t+16,e),h(t+24,e.length)},"syscall/js.valueLoadString":t=>{t>>>=0;const e=i(t+8);f(t+16).set(e)},"syscall/js.valueInstanceOf":t=>{t>>>=0,this.mem.setUint8(t+24,i(t+8)instanceof i(t+16)?1:0)},"syscall/js.copyBytesToGo":t=>{t>>>=0;const e=f(t+8),l=i(t+32);if(!(l instanceof Uint8Array||l instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}const a=l.subarray(0,e.length);e.set(a),h(t+40,a.length),this.mem.setUint8(t+48,1)},"syscall/js.copyBytesToJS":t=>{t>>>=0;const e=i(t+8),l=f(t+16);if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}const a=l.subarray(0,e.length);e.set(a),h(t+40,a.length),this.mem.setUint8(t+48,1)},debug:t=>{console.log(t)}}}}async run(h){if(!(h instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=h,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=m=>{const g=n,t=y.encode(m+"\0");return new Uint8Array(this.mem.buffer,n,t.length).set(t),n+=t.length,n%8!==0&&(n+=8-n%8),g},i=this.argv.length,r=[];this.argv.forEach(m=>{r.push(s(m))}),r.push(0),Object.keys(this.env).sort().forEach(m=>{r.push(s(`${m}=${this.env[m]}`))}),r.push(0);const u=n;if(r.forEach(m=>{this.mem.setUint32(n,m,!0),this.mem.setUint32(n+4,0,!0),n+=8}),n>=12288)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(h){const n=this;return function(){const s={id:h,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})();
33
+ const l = "aiquantsMarkdownConvert", d = (e) => e instanceof Error ? e.message : String(e), g = async (e, o, n) => {
34
+ if (e === void 0)
35
+ throw new Error("the Go WebAssembly runtime (wasm_exec.js) is missing from the worker bundle");
36
+ const a = new e(), s = await fetch(o);
37
+ if (!s.ok)
38
+ throw new Error(`the converter could not be fetched from ${o}: HTTP ${s.status}`);
39
+ const r = s.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase() === "application/wasm", { instance: i } = r ? await WebAssembly.instantiateStreaming(s, a.importObject) : await WebAssembly.instantiate(await s.arrayBuffer(), a.importObject);
40
+ a.run(i).finally(n);
41
+ const t = globalThis[l];
42
+ if (typeof t != "function")
43
+ throw new Error(`the converter registered no ${l}`);
44
+ return t;
45
+ }, f = (e, o) => {
46
+ let n = null, a = !1;
47
+ e.addEventListener("message", (s) => {
48
+ const r = s.data;
49
+ if (r.type === "load") {
50
+ if (n !== null) return;
51
+ n = g(o, r.wasmUrl, () => {
52
+ a = !0;
53
+ }).then(
54
+ (t) => (e.postMessage({ type: "loaded" }), t),
55
+ (t) => (e.postMessage({ type: "load-failed", message: d(t) }), null)
56
+ );
57
+ return;
58
+ }
59
+ if (n === null) {
60
+ e.postMessage({ type: "crashed", id: r.id, message: "a conversion arrived before the converter was asked to load" }), e.close();
61
+ return;
62
+ }
63
+ const i = n;
64
+ (async () => {
65
+ const t = await i;
66
+ if (t !== null)
67
+ try {
68
+ if (a) throw new Error("the Go program has exited");
69
+ e.postMessage({ type: "converted", id: r.id, answer: t(r.request) });
70
+ } catch (c) {
71
+ e.postMessage({ type: "crashed", id: r.id, message: d(c) }), e.close();
72
+ }
73
+ })();
74
+ });
75
+ };
76
+ f(self, globalThis.Go);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./errors-BW5JXRoX.cjs"),S=t=>{const{options:o}=t;return{markdownText:t.markdownText,filePath:t.filePath,workspaceRoot:t.workspaceRoot,includeSourceLines:o.includeSourceLines??!1,enableSubscript:o.enableSubscript,enableSuperscript:o.enableSuperscript,enableMark:o.enableMark,enableTableMerge:o.enableTableMerge,enableEmbeds:o.enableEmbeds,enableZennDirectives:o.enableZennDirectives,maxHtmlBytes:o.maxHtmlBytes,denySegmentPatterns:[...o.deniedPathSegments]}},y=t=>{if(!("error"in t))return{htmlContent:t.htmlContent,headings:t.headings};const{code:o,message:s}=t.error;return o==="resource_exhausted"?new a.MarkdownResourceExhaustedError(s):new a.MarkdownConversionError(o,s)},L=t=>{for(const o of["workerUrl","wasmUrl"]){const s=t[o];if(!(s instanceof URL)&&(typeof s!="string"||s===""))throw new TypeError(`createMarkdownConverter: ${o} must be a URL or a non-empty string`)}if(!Number.isSafeInteger(t.timeoutMs)||t.timeoutMs<=0)throw new RangeError(`createMarkdownConverter: timeoutMs must be a positive integer, got ${t.timeoutMs}`)},x=t=>{L(t);const o=new URL(t.wasmUrl,globalThis.location.href).href,s=[];let l=null,u=!1,n=null,d=null,k=1;const i=(e,r)=>{e.settled||(e.settled=!0,e.signal?.removeEventListener("abort",e.onAbort),r instanceof Error?e.reject(r):"aborted"in r?e.reject(r.aborted):e.resolve(r))},c=()=>{l?.terminate(),l=null,u=!1},M=()=>{if(n===null||n.timer!==null||!u)return;const{job:e}=n;n.timer=setTimeout(()=>{n?.job===e&&(n=null,c(),i(e,new a.MarkdownConversionTimeoutError(t.timeoutMs)),f())},t.timeoutMs)},m=()=>{n?.timer!=null&&clearTimeout(n.timer),n=null,f()},w=e=>{d=e,c();const r=n===null?[...s]:[n.job,...s];n?.timer!=null&&clearTimeout(n.timer),n=null,s.length=0;for(const b of r)i(b,e)},h=e=>{const r=e.data;switch(r.type){case"loaded":u=!0,M();return;case"load-failed":w(new a.MarkdownConversionError("unavailable",`the converter could not be loaded: ${r.message}`));return;case"converted":if(n?.job.id!==r.id)return;i(n.job,y(r.answer)),m();return;case"crashed":if(n?.job.id!==r.id)return;i(n.job,new a.MarkdownConversionError("internal",`the converter failed: ${r.message}`)),c(),m();return}},E=e=>{const r=e.message||"the worker failed";if(e.preventDefault(),!u){w(new a.MarkdownConversionError("unavailable",`the converter's worker could not start: ${r}`));return}n!==null&&i(n.job,new a.MarkdownConversionError("internal",`the converter's worker failed: ${r}`)),c(),m()},g=()=>{if(l!==null)return l;const e=new Worker(t.workerUrl,{type:"module",name:"aiquants-markdown-converter"});return e.addEventListener("message",h),e.addEventListener("error",E),e.postMessage({type:"load",wasmUrl:o}),l=e,e},f=()=>{if(n!==null||d!==null)return;const e=s.shift();if(e===void 0)return;const r=g();n={job:e,timer:null},r.postMessage({type:"convert",id:e.id,request:e.request}),M()},p=e=>{const r=s.indexOf(e);r>=0&&s.splice(r,1),i(e,{aborted:e.signal?.reason})};return{convert:async(e,r)=>{if(a.assertConversionOptions(e.options,"MarkdownConverter.convert"),r?.throwIfAborted(),d!==null)throw d;const b=S(e);return new Promise((T,C)=>{const v={id:k++,request:b,signal:r,resolve:T,reject:C,onAbort:()=>p(v),settled:!1};r?.addEventListener("abort",v.onAbort,{once:!0}),s.push(v),f()})},dispose:()=>{w(new a.MarkdownConversionError("unavailable","the converter was disposed"))}}};exports.MAX_HTML_BYTES_LIMIT=a.MAX_HTML_BYTES_LIMIT;exports.MarkdownConversionError=a.MarkdownConversionError;exports.MarkdownConversionTimeoutError=a.MarkdownConversionTimeoutError;exports.MarkdownResourceExhaustedError=a.MarkdownResourceExhaustedError;exports.createMarkdownConverter=x;
@@ -0,0 +1,4 @@
1
+ export { MAX_HTML_BYTES_LIMIT, type ParseResult } from "./conversion.ts";
2
+ export { createMarkdownConverter, type MarkdownConverter, type MarkdownConverterSetup } from "./converter/createMarkdownConverter.ts";
3
+ export type { BrowserConversion, BrowserParseOptions } from "./converter/protocol.ts";
4
+ export { MarkdownConversionError, type MarkdownConversionErrorCode, MarkdownConversionTimeoutError, MarkdownResourceExhaustedError } from "./errors.ts";
@@ -0,0 +1,109 @@
1
+ import { M as l, a as y, b as L, c as S } from "./errors-Blk_XJ9C.js";
2
+ import { d as O } from "./errors-Blk_XJ9C.js";
3
+ const C = (n) => {
4
+ const { options: o } = n;
5
+ return {
6
+ markdownText: n.markdownText,
7
+ filePath: n.filePath,
8
+ workspaceRoot: n.workspaceRoot,
9
+ includeSourceLines: o.includeSourceLines ?? !1,
10
+ enableSubscript: o.enableSubscript,
11
+ enableSuperscript: o.enableSuperscript,
12
+ enableMark: o.enableMark,
13
+ enableTableMerge: o.enableTableMerge,
14
+ enableEmbeds: o.enableEmbeds,
15
+ enableZennDirectives: o.enableZennDirectives,
16
+ maxHtmlBytes: o.maxHtmlBytes,
17
+ denySegmentPatterns: [...o.deniedPathSegments]
18
+ };
19
+ }, R = (n) => {
20
+ if (!("error" in n))
21
+ return { htmlContent: n.htmlContent, headings: n.headings };
22
+ const { code: o, message: s } = n.error;
23
+ return o === "resource_exhausted" ? new S(s) : new l(o, s);
24
+ }, U = (n) => {
25
+ for (const o of ["workerUrl", "wasmUrl"]) {
26
+ const s = n[o];
27
+ if (!(s instanceof URL) && (typeof s != "string" || s === ""))
28
+ throw new TypeError(`createMarkdownConverter: ${o} must be a URL or a non-empty string`);
29
+ }
30
+ if (!Number.isSafeInteger(n.timeoutMs) || n.timeoutMs <= 0)
31
+ throw new RangeError(`createMarkdownConverter: timeoutMs must be a positive integer, got ${n.timeoutMs}`);
32
+ }, A = (n) => {
33
+ U(n);
34
+ const o = new URL(n.wasmUrl, globalThis.location.href).href, s = [];
35
+ let i = null, u = !1, t = null, c = null, p = 1;
36
+ const a = (e, r) => {
37
+ e.settled || (e.settled = !0, e.signal?.removeEventListener("abort", e.onAbort), r instanceof Error ? e.reject(r) : "aborted" in r ? e.reject(r.aborted) : e.resolve(r));
38
+ }, d = () => {
39
+ i?.terminate(), i = null, u = !1;
40
+ }, v = () => {
41
+ if (t === null || t.timer !== null || !u) return;
42
+ const { job: e } = t;
43
+ t.timer = setTimeout(() => {
44
+ t?.job === e && (t = null, d(), a(e, new L(n.timeoutMs)), b());
45
+ }, n.timeoutMs);
46
+ }, m = () => {
47
+ t?.timer != null && clearTimeout(t.timer), t = null, b();
48
+ }, f = (e) => {
49
+ c = e, d();
50
+ const r = t === null ? [...s] : [t.job, ...s];
51
+ t?.timer != null && clearTimeout(t.timer), t = null, s.length = 0;
52
+ for (const w of r) a(w, e);
53
+ }, g = (e) => {
54
+ const r = e.data;
55
+ switch (r.type) {
56
+ case "loaded":
57
+ u = !0, v();
58
+ return;
59
+ case "load-failed":
60
+ f(new l("unavailable", `the converter could not be loaded: ${r.message}`));
61
+ return;
62
+ case "converted":
63
+ if (t?.job.id !== r.id) return;
64
+ a(t.job, R(r.answer)), m();
65
+ return;
66
+ case "crashed":
67
+ if (t?.job.id !== r.id) return;
68
+ a(t.job, new l("internal", `the converter failed: ${r.message}`)), d(), m();
69
+ return;
70
+ }
71
+ }, M = (e) => {
72
+ const r = e.message || "the worker failed";
73
+ if (e.preventDefault(), !u) {
74
+ f(new l("unavailable", `the converter's worker could not start: ${r}`));
75
+ return;
76
+ }
77
+ t !== null && a(t.job, new l("internal", `the converter's worker failed: ${r}`)), d(), m();
78
+ }, k = () => {
79
+ if (i !== null) return i;
80
+ const e = new Worker(n.workerUrl, { type: "module", name: "aiquants-markdown-converter" });
81
+ return e.addEventListener("message", g), e.addEventListener("error", M), e.postMessage({ type: "load", wasmUrl: o }), i = e, e;
82
+ }, b = () => {
83
+ if (t !== null || c !== null) return;
84
+ const e = s.shift();
85
+ if (e === void 0) return;
86
+ const r = k();
87
+ t = { job: e, timer: null }, r.postMessage({ type: "convert", id: e.id, request: e.request }), v();
88
+ }, E = (e) => {
89
+ const r = s.indexOf(e);
90
+ r >= 0 && s.splice(r, 1), a(e, { aborted: e.signal?.reason });
91
+ };
92
+ return { convert: async (e, r) => {
93
+ if (y(e.options, "MarkdownConverter.convert"), r?.throwIfAborted(), c !== null) throw c;
94
+ const w = C(e);
95
+ return new Promise((T, x) => {
96
+ const h = { id: p++, request: w, signal: r, resolve: T, reject: x, onAbort: () => E(h), settled: !1 };
97
+ r?.addEventListener("abort", h.onAbort, { once: !0 }), s.push(h), b();
98
+ });
99
+ }, dispose: () => {
100
+ f(new l("unavailable", "the converter was disposed"));
101
+ } };
102
+ };
103
+ export {
104
+ O as MAX_HTML_BYTES_LIMIT,
105
+ l as MarkdownConversionError,
106
+ L as MarkdownConversionTimeoutError,
107
+ S as MarkdownResourceExhaustedError,
108
+ A as createMarkdownConverter
109
+ };
Binary file
@@ -1,4 +1,4 @@
1
- import { bL as lt, _ as V, Q as k, O as gt } from "./extractHeadings-CdLPwHlC.js";
1
+ import { bL as lt, _ as V, Q as k, O as gt } from "./extractHeadings-DkKFCMIW.js";
2
2
  import { c as tt } from "./cytoscape.esm-kVAWcYoG.js";
3
3
  var Z = { exports: {} }, Q = { exports: {} }, $ = { exports: {} }, ut = $.exports, j;
4
4
  function ft() {