@aiquants/markdown 3.0.0 → 4.0.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.
- package/README.md +42 -1
- package/dist/{abnfDiagram-VRR7QNED-BEW-pzlz.cjs → abnfDiagram-VRR7QNED-DL9JJfMF.cjs} +1 -1
- package/dist/{abnfDiagram-VRR7QNED-ashFdTvJ.js → abnfDiagram-VRR7QNED-utxwo7Ri.js} +3 -3
- package/dist/{arc-DVw3O83w.cjs → arc-BY7loL0l.cjs} +1 -1
- package/dist/{arc-CV_3A_PF.js → arc-Byq9kr_0.js} +1 -1
- package/dist/{architectureDiagram-ZJ3FMSHR-ClwjWrgh.cjs → architectureDiagram-ZJ3FMSHR-CLLwinmD.cjs} +1 -1
- package/dist/{architectureDiagram-ZJ3FMSHR-BsYF-1vK.js → architectureDiagram-ZJ3FMSHR-DpnBy_s1.js} +2 -2
- package/dist/{blockDiagram-677ZJIJ3-CG0redjq.js → blockDiagram-677ZJIJ3-C8dybZZU.js} +3 -3
- package/dist/{blockDiagram-677ZJIJ3-Dv1BULkl.cjs → blockDiagram-677ZJIJ3-Cs5tpWQ-.cjs} +1 -1
- package/dist/{c4Diagram-LMCZKHZV-Bp8B3b7f.js → c4Diagram-LMCZKHZV-3aG0bDyP.js} +2 -2
- package/dist/{c4Diagram-LMCZKHZV-DC4usA2R.cjs → c4Diagram-LMCZKHZV-B-rz2a3v.cjs} +1 -1
- package/dist/{channel-NjFKsGs9.js → channel-BoXFYC1g.js} +1 -1
- package/dist/{channel-Cg0ufK1F.cjs → channel-Dn2hPSB8.cjs} +1 -1
- package/dist/{chunk-2Q5K7J3B-BY6lLkFO.cjs → chunk-2Q5K7J3B-B7QkO_05.cjs} +1 -1
- package/dist/{chunk-2Q5K7J3B-XXQGFlOd.js → chunk-2Q5K7J3B-CYpyj9EA.js} +1 -1
- package/dist/{chunk-32BRIVSS-kO6eHILC.cjs → chunk-32BRIVSS-BjI5igEa.cjs} +1 -1
- package/dist/{chunk-32BRIVSS-DgnH6GLY.js → chunk-32BRIVSS-DcLe6F1l.js} +1 -1
- package/dist/{chunk-5VM5RSS4-BhA4Tl7P.js → chunk-5VM5RSS4-C4ILSCRb.js} +1 -1
- package/dist/{chunk-5VM5RSS4-BITLjZU7.cjs → chunk-5VM5RSS4-DafQyxAv.cjs} +1 -1
- package/dist/{chunk-EX3LRPZG-CJr2-IiP.cjs → chunk-EX3LRPZG-BXZDK2R1.cjs} +1 -1
- package/dist/{chunk-EX3LRPZG-DSylTHty.js → chunk-EX3LRPZG-CTaiVHYY.js} +4 -4
- package/dist/{chunk-JWPE2WC7-Cr_-c4Em.js → chunk-JWPE2WC7-B-nuuS4b.js} +1 -1
- package/dist/{chunk-JWPE2WC7-BTz8xxEq.cjs → chunk-JWPE2WC7-CNZBI1Pb.cjs} +1 -1
- package/dist/{chunk-MOJQB5TN-DngSrRvI.js → chunk-MOJQB5TN-D1oF99aM.js} +1 -1
- package/dist/{chunk-MOJQB5TN-vnYqNQhm.cjs → chunk-MOJQB5TN-Dh_1HfSC.cjs} +1 -1
- package/dist/{chunk-PUDLZKDR-BTwddg7A.cjs → chunk-PUDLZKDR-CMFJFweY.cjs} +1 -1
- package/dist/{chunk-PUDLZKDR-Jnb9X3uo.js → chunk-PUDLZKDR-CPadtN2C.js} +6 -6
- package/dist/{chunk-RYQCIY6F-DxECu9__.cjs → chunk-RYQCIY6F-C6453DQl.cjs} +1 -1
- package/dist/{chunk-RYQCIY6F-CwJsUgE_.js → chunk-RYQCIY6F-DxuegR0d.js} +1 -1
- package/dist/{chunk-V7JOEXUC-DgGwolBn.cjs → chunk-V7JOEXUC-l9PaMPOT.cjs} +1 -1
- package/dist/{chunk-V7JOEXUC-gEKuI7OI.js → chunk-V7JOEXUC-ziE5DrnY.js} +5 -5
- package/dist/{chunk-VR4S4FIN-8cM_PVeG.js → chunk-VR4S4FIN-BiCYvwb8.js} +1 -1
- package/dist/{chunk-VR4S4FIN-DKbaKheJ.cjs → chunk-VR4S4FIN-CCCnXTuJ.cjs} +1 -1
- package/dist/{chunk-XXDRQBXY-CN2bL4d4.js → chunk-XXDRQBXY-BFKT7vFo.js} +1 -1
- package/dist/{chunk-XXDRQBXY-CDD2QRgB.cjs → chunk-XXDRQBXY-D5IbqpUM.cjs} +1 -1
- package/dist/{classDiagram-OUVF2IWQ-DpgKwDbm.cjs → classDiagram-OUVF2IWQ-C1AZm4pB.cjs} +1 -1
- package/dist/{classDiagram-v2-EOCWNBFH-_cymiFSf.js → classDiagram-OUVF2IWQ-KA_F_TBQ.js} +2 -2
- package/dist/{classDiagram-v2-EOCWNBFH-DpgKwDbm.cjs → classDiagram-v2-EOCWNBFH-C1AZm4pB.cjs} +1 -1
- package/dist/{classDiagram-OUVF2IWQ-_cymiFSf.js → classDiagram-v2-EOCWNBFH-KA_F_TBQ.js} +2 -2
- package/dist/components/MarkdownRenderer.d.ts +3 -1
- package/dist/components/MarkdownViewer.d.ts +3 -1
- package/dist/components/MermaidDiagram.d.ts +1 -0
- package/dist/components/mathRendering.d.ts +11 -0
- package/dist/components/mdastNodes/MathNode.d.ts +10 -0
- package/dist/{cose-bilkent-JH36ORCC-DnfyBXGg.cjs → cose-bilkent-JH36ORCC-BQ2K2GyI.cjs} +1 -1
- package/dist/{cose-bilkent-JH36ORCC-BYBqAjZw.js → cose-bilkent-JH36ORCC-B_16TV-v.js} +1 -1
- package/dist/{cynefinDiagram-TSTJHNR4-BWEOxUpI.js → cynefinDiagram-TSTJHNR4-DTV6ORFc.js} +2 -2
- package/dist/{cynefinDiagram-TSTJHNR4-C8EYsJAe.cjs → cynefinDiagram-TSTJHNR4-Dq7UoRYB.cjs} +1 -1
- package/dist/{dagre-VKFMJZFB-Dzz7AfJC.cjs → dagre-VKFMJZFB-PCi8s-PP.cjs} +1 -1
- package/dist/{dagre-VKFMJZFB-D9yci9ce.js → dagre-VKFMJZFB-kSrm5dp4.js} +2 -2
- package/dist/{diagram-FQU43EPY-Byd0f28a.js → diagram-FQU43EPY-D3dKlAPv.js} +2 -2
- package/dist/{diagram-FQU43EPY-B_jbLFxw.cjs → diagram-FQU43EPY-wTUTIyQQ.cjs} +1 -1
- package/dist/{diagram-G47NLZAW-CzGLTuaI.js → diagram-G47NLZAW-HJlhMCYj.js} +3 -3
- package/dist/{diagram-G47NLZAW-BD7Qvt5F.cjs → diagram-G47NLZAW-_4FrgCGJ.cjs} +1 -1
- package/dist/{diagram-NH7WQ7WH-DtE40O1y.cjs → diagram-NH7WQ7WH-ByCeah-n.cjs} +1 -1
- package/dist/{diagram-NH7WQ7WH-D6J_ePSr.js → diagram-NH7WQ7WH-CgeHmdJL.js} +2 -2
- package/dist/{diagram-OA4YK3LP-BV_3h5ls.cjs → diagram-OA4YK3LP-C0IhePjD.cjs} +1 -1
- package/dist/{diagram-OA4YK3LP-BRkpKDSL.js → diagram-OA4YK3LP-CwJcZGHD.js} +3 -3
- package/dist/{diagram-WEI45ONY-CMtm1y9S.cjs → diagram-WEI45ONY-Cf-TVNEb.cjs} +1 -1
- package/dist/{diagram-WEI45ONY-TZvlAD74.js → diagram-WEI45ONY-v1LUmWAx.js} +2 -2
- package/dist/{ebnfDiagram-CCIWWBDH-CK7wZZmM.js → ebnfDiagram-CCIWWBDH-DqZtnwGP.js} +3 -3
- package/dist/{ebnfDiagram-CCIWWBDH-DgZ7GeJ2.cjs → ebnfDiagram-CCIWWBDH-k5XOUGml.cjs} +1 -1
- package/dist/{erDiagram-Q63AITRT-ByF7VP5D.js → erDiagram-Q63AITRT-D6kP6d5J.js} +4 -4
- package/dist/{erDiagram-Q63AITRT-C4Tmp1ar.cjs → erDiagram-Q63AITRT-DFet1VTy.cjs} +1 -1
- package/dist/{extractHeadings-CS-qqdgu.js → extractHeadings-B2I83li5.js} +5148 -5067
- package/dist/{extractHeadings-DZwpYYZa.cjs → extractHeadings-R7NxLZJP.cjs} +70 -70
- package/dist/flowDiagram-23GEKE2U-BTXvBdte.js +7 -0
- package/dist/flowDiagram-23GEKE2U-C81VZYM7.cjs +1 -0
- package/dist/{ganttDiagram-NO4QXBWP-CWaEb7A9.cjs → ganttDiagram-NO4QXBWP-CEQqLRYx.cjs} +1 -1
- package/dist/{ganttDiagram-NO4QXBWP-BxYBLrwg.js → ganttDiagram-NO4QXBWP-I9DxJwkX.js} +2 -2
- package/dist/{gitGraphDiagram-IHSO6WYX-DinEtmt2.js → gitGraphDiagram-IHSO6WYX-p_7WQssC.js} +3 -3
- package/dist/{gitGraphDiagram-IHSO6WYX-Bj41cd84.cjs → gitGraphDiagram-IHSO6WYX-yyEwsmHH.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.client.cjs +1 -1
- package/dist/index.client.d.ts +1 -0
- package/dist/index.client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{infoDiagram-FWYZ7A6U-D0pXl2DF.cjs → infoDiagram-FWYZ7A6U-BFCkTfAI.cjs} +1 -1
- package/dist/{infoDiagram-FWYZ7A6U-Cvu8wgVT.js → infoDiagram-FWYZ7A6U-C9L5rIcg.js} +1 -1
- package/dist/{ishikawaDiagram-FXEZZL3T-C4ywo5e2.cjs → ishikawaDiagram-FXEZZL3T-B3TjOzka.cjs} +1 -1
- package/dist/{ishikawaDiagram-FXEZZL3T-a_OKoT7W.js → ishikawaDiagram-FXEZZL3T-uxcpJtLF.js} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-Bf5zZtzp.cjs → journeyDiagram-5HDEW3XC-CvtPgaNR.cjs} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-BKYDr_AO.js → journeyDiagram-5HDEW3XC-DMq3piuW.js} +4 -4
- package/dist/{kanban-definition-HUTT4EX6-CRrw6nZl.cjs → kanban-definition-HUTT4EX6-DJ9sXiRP.cjs} +1 -1
- package/dist/{kanban-definition-HUTT4EX6-uCk_xnx6.js → kanban-definition-HUTT4EX6-Dfal8jdL.js} +2 -2
- package/dist/{linear-BNrZe-4B.cjs → linear-CLykHvhQ.cjs} +1 -1
- package/dist/{linear-RwkMjaFq.js → linear-CvzPdVAO.js} +1 -1
- package/dist/markdown.css +1 -1
- package/dist/{mindmap-definition-LN4V7U3C-DLgc7_Ea.js → mindmap-definition-LN4V7U3C-C8erO2Mh.js} +3 -3
- package/dist/{mindmap-definition-LN4V7U3C-CtNh9-A3.cjs → mindmap-definition-LN4V7U3C-CErimIK1.cjs} +1 -1
- package/dist/{pegDiagram-2B236MQR-BI08u62h.js → pegDiagram-2B236MQR-CECcXaCN.js} +3 -3
- package/dist/{pegDiagram-2B236MQR-gjNvnRzE.cjs → pegDiagram-2B236MQR-DBL8X0k9.cjs} +1 -1
- package/dist/{pieDiagram-ENE6RG2P-C6mPk_9r.cjs → pieDiagram-ENE6RG2P-B_-x0Nvj.cjs} +1 -1
- package/dist/{pieDiagram-ENE6RG2P-CqqtfJsQ.js → pieDiagram-ENE6RG2P-CWlf16nv.js} +3 -3
- package/dist/{quadrantDiagram-ABIIQ3AL-k1wF3el0.cjs → quadrantDiagram-ABIIQ3AL-HKlopKX4.cjs} +1 -1
- package/dist/{quadrantDiagram-ABIIQ3AL-BAudlbem.js → quadrantDiagram-ABIIQ3AL-JpouSW89.js} +2 -2
- package/dist/{railroadDiagram-RFXS5EU6-qTQnd_2E.cjs → railroadDiagram-RFXS5EU6-B-v61EFn.cjs} +1 -1
- package/dist/{railroadDiagram-RFXS5EU6-BV-FtI-Y.js → railroadDiagram-RFXS5EU6-CLTBEsir.js} +3 -3
- package/dist/{requirementDiagram-TGXJPOKE-DXxySydn.cjs → requirementDiagram-TGXJPOKE-4vCejkrF.cjs} +1 -1
- package/dist/{requirementDiagram-TGXJPOKE-CSI9iBde.js → requirementDiagram-TGXJPOKE-DtoTpDLe.js} +3 -3
- package/dist/{sankeyDiagram-HTMAVEWB-DU5j0Hpe.cjs → sankeyDiagram-HTMAVEWB-Bp8p_ojk.cjs} +1 -1
- package/dist/{sankeyDiagram-HTMAVEWB-BYAMj1wQ.js → sankeyDiagram-HTMAVEWB-WxnjUz1I.js} +1 -1
- package/dist/{sequenceDiagram-DBY2YBRQ-Dbk1YO-l.cjs → sequenceDiagram-DBY2YBRQ-BUPaWSIG.cjs} +1 -1
- package/dist/{sequenceDiagram-DBY2YBRQ-BruqK1lr.js → sequenceDiagram-DBY2YBRQ-DGJcC2MQ.js} +3 -3
- package/dist/{sizeCapture-X5ZJPWSS-BSn0u1_t.js → sizeCapture-X5ZJPWSS-BmP0pJAx.js} +1 -1
- package/dist/{sizeCapture-X5ZJPWSS-qz-hVWx4.cjs → sizeCapture-X5ZJPWSS-Dk82fAT8.cjs} +1 -1
- package/dist/{stateDiagram-2N3HPSRC-CtoTfzmG.cjs → stateDiagram-2N3HPSRC-CL5Omkqs.cjs} +1 -1
- package/dist/{stateDiagram-2N3HPSRC-CKh5ZWdm.js → stateDiagram-2N3HPSRC-ZL_eFTbb.js} +2 -2
- package/dist/{stateDiagram-v2-6OUMAXLB-BmILy7Yi.js → stateDiagram-v2-6OUMAXLB-BgOqjiSL.js} +2 -2
- package/dist/{stateDiagram-v2-6OUMAXLB-D9tt3CyI.cjs → stateDiagram-v2-6OUMAXLB-D3Zgp8xl.cjs} +1 -1
- package/dist/styles/markdown.css +1 -1
- package/dist/{swimlanes-5IMT3BWC-CgWWlJUL.cjs → swimlanes-5IMT3BWC-CuW1KWfs.cjs} +1 -1
- package/dist/{swimlanes-5IMT3BWC-8aqGUD9B.js → swimlanes-5IMT3BWC-GB1p75ou.js} +3 -3
- package/dist/{swimlanesDiagram-G3AALYLV-BQL_l0K6.cjs → swimlanesDiagram-G3AALYLV-Di_Nug7g.cjs} +1 -1
- package/dist/{swimlanesDiagram-G3AALYLV-0sUz7qWx.js → swimlanesDiagram-G3AALYLV-Jr2ZWz3z.js} +2 -2
- package/dist/{timeline-definition-FHXFAJF6-Cps3CVTR.js → timeline-definition-FHXFAJF6-663e-yVA.js} +2 -2
- package/dist/{timeline-definition-FHXFAJF6-CnMWGedg.cjs → timeline-definition-FHXFAJF6-BKVe7Qad.cjs} +1 -1
- package/dist/{vennDiagram-L72KCM5P-Duki5CI_.cjs → vennDiagram-L72KCM5P-2NIIKtsl.cjs} +1 -1
- package/dist/{vennDiagram-L72KCM5P-C3u6VbZv.js → vennDiagram-L72KCM5P-BDGC8Vm3.js} +1 -1
- package/dist/{wardleyDiagram-EHGQE667-DiefhIvI.cjs → wardleyDiagram-EHGQE667-BrTNZSmG.cjs} +1 -1
- package/dist/{wardleyDiagram-EHGQE667-CKNXRrYV.js → wardleyDiagram-EHGQE667-IbGr9hGV.js} +2 -2
- package/dist/{xychartDiagram-FW5EYKEG-lymeWtXL.js → xychartDiagram-FW5EYKEG-CbxKOQYO.js} +2 -2
- package/dist/{xychartDiagram-FW5EYKEG-DGB2SKXi.cjs → xychartDiagram-FW5EYKEG-MCkmgF8g.cjs} +1 -1
- package/package.json +7 -7
- package/dist/flowDiagram-23GEKE2U-BPhnjQfA.cjs +0 -1
- package/dist/flowDiagram-23GEKE2U-UIracYlJ.js +0 -7
package/README.md
CHANGED
|
@@ -216,6 +216,31 @@ const AppLink = ({ href, className, attributes, children }: MarkdownLinkProps) =
|
|
|
216
216
|
|
|
217
217
|
- Only a link that wraps an image or block content is laid out as a box (`inline-block`); a link around text stays inline, so a footnote reference inside `<sup>` keeps the height of its glyphs and shows its focus ring.
|
|
218
218
|
|
|
219
|
+
### Content column and alignment
|
|
220
|
+
|
|
221
|
+
`MarkdownViewer` lays the document out in one column, `[data-aqmd-content]`, inside the scroll container's padding:
|
|
222
|
+
|
|
223
|
+
| Prop | Effect |
|
|
224
|
+
| --- | --- |
|
|
225
|
+
| `width` | The column's CSS `width`. Unset, the column is `100%` wide: the full width of the scroll container's track, whatever the content, so a short document and a diagram drawn at the column's width get the whole width |
|
|
226
|
+
| `maxWidth` | The column's CSS `max-width` (`"1200px"`, `"min(1200px, 100%)"` …). Unset, nothing caps the column beyond `width` |
|
|
227
|
+
| `align` | Places a column narrower than the track: `left` (`margin-inline: 0 auto`), `center` (`auto`) or `right` (`auto 0`). It shows only when `width` or `maxWidth` makes the column narrower than the track |
|
|
228
|
+
|
|
229
|
+
The alignment button needs `onAlignChange`, `showAlign` (on by default) and a `width` or `maxWidth`. Without either of the two, the column fills the track and no alignment can move it, so the viewer does not render the button, whatever `showAlign` says.
|
|
230
|
+
|
|
231
|
+
With the `GitHub` and `Zenn` styles of `DEFAULT_MARKDOWN_STYLES`, a wide table or a long code line scrolls inside its own box. Content with a fixed width wider than the column, such as an embedded `<iframe>` whose `width` attribute exceeds it, overflows the column, and so does any wide content under the `None` style, which loads no stylesheet; the scroll container then scrolls sideways.
|
|
232
|
+
|
|
233
|
+
### Mermaid diagrams
|
|
234
|
+
|
|
235
|
+
A fenced code block in the `mermaid` language renders as `MermaidDiagram`, a block that takes its containing block's width (its slot). The slot's first child is a hidden measuring element, `[data-aqmd-mermaid-measure]` (no height, clipped, `visibility: hidden`, `aria-hidden`), present while the diagram loads, shows or fails; the component measures the slot's width with it.
|
|
236
|
+
Each drawing gets its own drawing host, `[data-aqmd-mermaid-host]`: a hidden element (`visibility: hidden`, `aria-hidden`, absolutely positioned just outside the start edge, `contain: strict`) appended to the main document's `<body>`, with its width set to the measured width in px.
|
|
237
|
+
Mermaid draws in that element and the component shows the result in the slot, so a gantt chart, whose width Mermaid takes from where it is drawn, is exactly as wide as the slot. Because Mermaid looks its drawing up through the main document, the host lives in the main document's light DOM, and a diagram in a slot inside a shadow root is drawn the same way.
|
|
238
|
+
|
|
239
|
+
- The component removes a drawing host when its drawing settles (shown, failed, or discarded as stale) and when the component unmounts or its text changes, so none is left behind, not even the error drawing Mermaid leaves for a text it cannot parse.
|
|
240
|
+
- Nothing is drawn while the slot has no width (inside a closed `<details>` the browser does not lay out, or a hidden panel): the loading text stays until the slot gets a width. A drawing already under way when the slot loses its width finishes at the width it was given.
|
|
241
|
+
- When the width of a slot showing a gantt chart changes (a splitter drag, a window resize), the chart is drawn again at the new width 200 ms after the last change, unless the slot then has no width or the width of the latest drawing. The shown chart stays until the new one replaces it, and the new one starts at the initial zoom and pan. Other diagram types take their size from their text and are never drawn again for a width change.
|
|
242
|
+
- A drawing that finishes after a newer one started, after the diagram's text changed or after the component unmounted is discarded.
|
|
243
|
+
|
|
219
244
|
### Viewer toolbar
|
|
220
245
|
|
|
221
246
|
`MarkdownViewer` shows its alignment, style and table-of-contents buttons as one fixed row, in that visual and tab order, spaced in `rem` so they never overlap at large text sizes. Place the row with two package-scoped custom properties, both `0px` unless set:
|
|
@@ -296,7 +321,9 @@ The parser supports the following extended markdown syntax in addition to Common
|
|
|
296
321
|
|
|
297
322
|
### LaTeX Math Expressions
|
|
298
323
|
|
|
299
|
-
- Inline math: `$y=x^2
|
|
324
|
+
- Inline math: `$y=x^2$`. A single `$` follows the `tex_math_dollars` rule of Pandoc 3.12: the opening `$` must be followed by a character that is not white space, and the formula ends at the first `$` after it that is not escaped by `\` and not inside a `\text{…}` group whose braces close; that `$` must follow a character that is not white space (a character escaped by `\`, such as the space in `$a\ $`, is not) and must not be followed by an ASCII digit; otherwise the `$` stays text.
|
|
325
|
+
Stricter than Pandoc, white space is Unicode's (the ideographic space included) and a `$` at the start of a line never closes. So `$20,000 and $30,000`, `$100〜$200`, `$HOME and $PATH` and `$ x $` are text, while `$x$`, `$a\$b$`, `$a\ $` and `$\text{for all $x$}$` are formulas; write a literal dollar as `\$` or inside a code span.
|
|
326
|
+
- Within a line of text, `$$ … $$` is inline math too (`Cost $$ x $$ here` is the formula `x`): it ends at the next run of as many `$`, with white space allowed inside its ends. An inline formula may continue on the paragraph's next line.
|
|
300
327
|
- Display math: a multi-line block, or a whole line `$$ e^{i\theta} = \cos\theta + i\sin\theta $$` (at most three spaces of indentation; it can follow a paragraph line directly). Both forms render the same. Inside code blocks the lines stay code.
|
|
301
328
|
- A multi-line block opens on a line of two or more `$` whose rest holds no `$` (that rest is not part of the formula) and closes on a line of two or more `$` alone. Any other `$$ … $$` — within a line of text, or followed by more text on its line (`$$E=mc^2$$.`) — is inline math in its paragraph.
|
|
302
329
|
- A formula reaches KaTeX exactly as written: `0<x<1`, `a & b`, quotes and `x^2 + y^2` included (the converter escapes the formula's text once, the viewer reads the text back once, and the subscript, superscript and highlight syntax never applies inside a formula).
|
|
@@ -307,6 +334,20 @@ e^{i\theta} = \cos\theta + i\sin\theta
|
|
|
307
334
|
$$
|
|
308
335
|
```
|
|
309
336
|
|
|
337
|
+
Every renderer (`MarkdownRenderer`, `MarkdownViewer`, `NodesRenderer`) renders a formula with the same KaTeX options: `throwOnError: false` (an invalid formula shows its source in red) and display math in display mode.
|
|
338
|
+
Nothing KaTeX says about a formula reaches the console, in the browser or on the server: its reports about LaTeX-incompatible input that still renders (a text-mode accent such as `\r` in math mode, an unknown symbol, `\\` in display math), its warning about a character its fonts have no metrics for (※, ①, ★, €, an emoji: code `noCharacterMetrics`), and the TeX console commands `\message`, `\errmessage` and `\show`, which render nothing (code `consoleCommand`).
|
|
339
|
+
`MarkdownRenderer` and `MarkdownViewer` hand them to `onMathDiagnostics` as `MarkdownMathDiagnostic` objects (`{ code, message, formula, displayMode }`): after the commit, once per document, and only when there is one; the viewer's function may change on any render without the document being parsed again.
|
|
340
|
+
Japanese or other non-Latin letters inside a formula (`\frac{売上}{原価}`) are not reported, since KaTeX renders them as written; `\text{…}` is the LaTeX way to write words inside a formula.
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
<MarkdownViewer
|
|
344
|
+
{...props}
|
|
345
|
+
onMathDiagnostics={(diagnostics) => {
|
|
346
|
+
for (const { code, message, formula } of diagnostics) logger.debug(`[math] ${code}: ${message} — ${formula}`)
|
|
347
|
+
}}
|
|
348
|
+
/>
|
|
349
|
+
```
|
|
350
|
+
|
|
310
351
|
### GitHub Alerts
|
|
311
352
|
|
|
312
353
|
```markdown
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./chunk-MOJQB5TN-Dh_1HfSC.cjs"),u=require("./chunk-JWPE2WC7-CNZBI1Pb.cjs"),n=require("./extractHeadings-R7NxLZJP.cjs"),i=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var p=i.createRailroadAbnfServices().RailroadAbnf.parser.LangiumParser,o=n.__name(e=>{const r=e.alternatives.map(c);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),c=n.__name(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),f=n.__name(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),d=n.__name(e=>{const r=b(e.primary);if(!e.repeat)return r;const{min:t,max:s}=f(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),b=n.__name(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return o(e.element);case"AbnfOptionalGroup":return{type:"optional",element:o(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),g=n.__name(e=>({name:e.name,definition:o(e.definition)}),"transformRule"),v=n.__name(e=>{u.populateCommonDb(e,a.db),e.title&&a.db.setTitle(e.title),e.rules.map(r=>a.db.addRule(g(r)))},"populateDb"),y={parse:n.__name(e=>{a.db.clear(),n.log.debug("[ABNF Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.MermaidParseError(r);const t=r.value;n.log.debug("[ABNF Parser] Parsed rules:",t.rules.length),v(t),n.log.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a.db}},_={parser:y,db:a.db,renderer:a.renderer,styles:a.getStyles};exports.diagram=_;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-
|
|
2
|
-
import { p as f } from "./chunk-JWPE2WC7-
|
|
3
|
-
import { _ as n, $ as o } from "./extractHeadings-
|
|
1
|
+
import { g as p, r as u, d as a } from "./chunk-MOJQB5TN-D1oF99aM.js";
|
|
2
|
+
import { p as f } from "./chunk-JWPE2WC7-B-nuuS4b.js";
|
|
3
|
+
import { _ as n, $ as o } from "./extractHeadings-B2I83li5.js";
|
|
4
4
|
import { M as c, b as d } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
|
|
5
5
|
var v = d().RailroadAbnf.parser.LangiumParser, i = /* @__PURE__ */ n((e) => {
|
|
6
6
|
const r = e.alternatives.map(g);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./extractHeadings-
|
|
1
|
+
"use strict";const n=require("./extractHeadings-R7NxLZJP.cjs");function $(o){return o.innerRadius}function b(o){return o.outerRadius}function k(o){return o.startAngle}function _(o){return o.endAngle}function nn(o){return o&&o.padAngle}function en(o,x,D,P,h,v,S,s){var E=D-o,r=P-x,e=S-h,p=s-v,i=p*E-e*r;if(!(i*i<n.epsilon))return i=(e*(x-v)-p*(o-h))/i,[o+i*E,x+i*r]}function M(o,x,D,P,h,v,S){var s=o-D,E=x-P,r=(S?v:-v)/n.sqrt(s*s+E*E),e=r*E,p=-r*s,i=o+e,u=x+p,c=D+e,f=P+p,j=(i+c)/2,l=(u+f)/2,y=c-i,g=f-u,A=y*y+g*g,R=h-v,T=i*f-c*u,H=(g<0?-1:1)*n.sqrt(n.max(0,R*R*A-T*T)),I=(T*g-y*H)/A,O=(-T*y-g*H)/A,q=(T*g+y*H)/A,d=(-T*y+g*H)/A,m=I-j,a=O-l,t=q-j,z=d-l;return m*m+a*a>t*t+z*z&&(I=q,O=d),{cx:I,cy:O,x01:-e,y01:-p,x11:I*(h/R-1),y11:O*(h/R-1)}}function an(){var o=$,x=b,D=n.constant(0),P=null,h=k,v=_,S=nn,s=null,E=n.withPath(r);function r(){var e,p,i=+o.apply(this,arguments),u=+x.apply(this,arguments),c=h.apply(this,arguments)-n.halfPi,f=v.apply(this,arguments)-n.halfPi,j=n.abs(f-c),l=f>c;if(s||(s=e=E()),u<i&&(p=u,u=i,i=p),!(u>n.epsilon))s.moveTo(0,0);else if(j>n.tau-n.epsilon)s.moveTo(u*n.cos(c),u*n.sin(c)),s.arc(0,0,u,c,f,!l),i>n.epsilon&&(s.moveTo(i*n.cos(f),i*n.sin(f)),s.arc(0,0,i,f,c,l));else{var y=c,g=f,A=c,R=f,T=j,H=j,I=S.apply(this,arguments)/2,O=I>n.epsilon&&(P?+P.apply(this,arguments):n.sqrt(i*i+u*u)),q=n.min(n.abs(u-i)/2,+D.apply(this,arguments)),d=q,m=q,a,t;if(O>n.epsilon){var z=n.asin(O/i*n.sin(I)),F=n.asin(O/u*n.sin(I));(T-=z*2)>n.epsilon?(z*=l?1:-1,A+=z,R-=z):(T=0,A=R=(c+f)/2),(H-=F*2)>n.epsilon?(F*=l?1:-1,y+=F,g-=F):(H=0,y=g=(c+f)/2)}var B=u*n.cos(y),C=u*n.sin(y),G=i*n.cos(R),J=i*n.sin(R);if(q>n.epsilon){var K=u*n.cos(g),L=u*n.sin(g),N=i*n.cos(A),Q=i*n.sin(A),w;if(j<n.pi)if(w=en(B,C,N,Q,K,L,G,J)){var U=B-w[0],V=C-w[1],W=K-w[0],X=L-w[1],Y=1/n.sin(n.acos((U*W+V*X)/(n.sqrt(U*U+V*V)*n.sqrt(W*W+X*X)))/2),Z=n.sqrt(w[0]*w[0]+w[1]*w[1]);d=n.min(q,(i-Z)/(Y-1)),m=n.min(q,(u-Z)/(Y+1))}else d=m=0}H>n.epsilon?m>n.epsilon?(a=M(N,Q,B,C,u,m,l),t=M(K,L,G,J,u,m,l),s.moveTo(a.cx+a.x01,a.cy+a.y01),m<q?s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,m,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,u,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),!l),s.arc(t.cx,t.cy,m,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):(s.moveTo(B,C),s.arc(0,0,u,y,g,!l)):s.moveTo(B,C),!(i>n.epsilon)||!(T>n.epsilon)?s.lineTo(G,J):d>n.epsilon?(a=M(G,J,K,L,i,-d,l),t=M(B,C,N,Q,i,-d,l),s.lineTo(a.cx+a.x01,a.cy+a.y01),d<q?s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(t.y01,t.x01),!l):(s.arc(a.cx,a.cy,d,n.atan2(a.y01,a.x01),n.atan2(a.y11,a.x11),!l),s.arc(0,0,i,n.atan2(a.cy+a.y11,a.cx+a.x11),n.atan2(t.cy+t.y11,t.cx+t.x11),l),s.arc(t.cx,t.cy,d,n.atan2(t.y11,t.x11),n.atan2(t.y01,t.x01),!l))):s.arc(0,0,i,R,A,l)}if(s.closePath(),e)return s=null,e+""||null}return r.centroid=function(){var e=(+o.apply(this,arguments)+ +x.apply(this,arguments))/2,p=(+h.apply(this,arguments)+ +v.apply(this,arguments))/2-n.pi/2;return[n.cos(p)*e,n.sin(p)*e]},r.innerRadius=function(e){return arguments.length?(o=typeof e=="function"?e:n.constant(+e),r):o},r.outerRadius=function(e){return arguments.length?(x=typeof e=="function"?e:n.constant(+e),r):x},r.cornerRadius=function(e){return arguments.length?(D=typeof e=="function"?e:n.constant(+e),r):D},r.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:n.constant(+e),r):P},r.startAngle=function(e){return arguments.length?(h=typeof e=="function"?e:n.constant(+e),r):h},r.endAngle=function(e){return arguments.length?(v=typeof e=="function"?e:n.constant(+e),r):v},r.padAngle=function(e){return arguments.length?(S=typeof e=="function"?e:n.constant(+e),r):S},r.context=function(e){return arguments.length?(s=e??null,r):s},r}exports.d3arc=an;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aK as ln, aL as an, aM as y, aN as tn, aO as V, aP as O, aQ as _, aR as un, aS as rn, aT as Y, aU as o, aV as M, aW as sn, aX as on, aY as fn } from "./extractHeadings-
|
|
1
|
+
import { aK as ln, aL as an, aM as y, aN as tn, aO as V, aP as O, aQ as _, aR as un, aS as rn, aT as Y, aU as o, aV as M, aW as sn, aX as on, aY as fn } from "./extractHeadings-B2I83li5.js";
|
|
2
2
|
function cn(l) {
|
|
3
3
|
return l.innerRadius;
|
|
4
4
|
}
|