vue-stream-markdown 0.2.1 → 0.2.3
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 +11 -0
- package/dist/{blockquote-Bv0immvx.js → blockquote-Crr-D7fY.js} +6 -2
- package/dist/break-DoDPjOA0.js +77 -0
- package/dist/{button-CRnH8Rzt.js → button-DVWlhfQ9.js} +2 -2
- package/dist/button-Dw4uJRaD.js +6 -0
- package/dist/{code-BcAa_-2j.js → code-Bz8LM16H.js} +14 -10
- package/dist/code-block-Bitp8x1w.js +10 -0
- package/dist/{code-block-mylXl6jG.js → code-block-CmUZxKNr.js} +62 -24
- package/dist/{composables-CL-BX9Ri.js → composables-CzUVrTt_.js} +231 -206
- package/dist/{delete-drdYWAXs.js → delete-DFoiOzHW.js} +6 -2
- package/dist/dropdown-CSRjqK0u.js +6 -0
- package/dist/{emphasis-CdEFGQdu.js → emphasis-DvaBuxeK.js} +6 -2
- package/dist/{error-component-xzXxODeR.js → error-component-BTe-SuY7.js} +15 -7
- package/dist/error-component-DDnC0bqw.js +5 -0
- package/dist/{footnote-definition-BTSXdQZi.js → footnote-definition-ByWh1N3S.js} +9 -5
- package/dist/{footnote-reference-CV_67vK7.js → footnote-reference-BJ4J7BFo.js} +5 -1
- package/dist/{heading-BH7urRHb.js → heading-1fssqGGO.js} +6 -2
- package/dist/html-Be_6ezK6.js +74 -0
- package/dist/{html-D7bGx0Cz.js → html-DfTs9nEm.js} +4 -0
- package/dist/icon-DE3AzDqz.js +4 -0
- package/dist/{icon-MRs2P5TP.js → icon-DcLTFhFW.js} +1 -1
- package/dist/{image-BypX6qku.js → image-DXnmoID_.js} +4 -4
- package/dist/image-Dl-r78_E.js +9 -0
- package/dist/{image-Bo_26KHM.js → image-xPrAKT9D.js} +12 -8
- package/dist/index.css +133 -143
- package/dist/index.d.ts +194 -152
- package/dist/index.js +335 -217
- package/dist/{inline-code-BZNE1ALQ.js → inline-code-B5lfHACE.js} +4 -0
- package/dist/{inline-math-DFUJNhmp.js → inline-math-CPkpjl8t.js} +7 -3
- package/dist/{link-ClKb1qAC.js → link-BACrkxRW.js} +8 -4
- package/dist/{list-BdM_gwie.js → list-Cu8G46hK.js} +6 -2
- package/dist/{list-item-DaRd7Yu3.js → list-item-BMgDS1tS.js} +6 -2
- package/dist/{math-CLweuHzM.js → math-XsZX0VMw.js} +7 -3
- package/dist/{mermaid-CyLU2UYz.js → mermaid-CQdSlhqn.js} +37 -13
- package/dist/{modal-vHG2jmSe.js → modal-C1riNMrs.js} +8 -5
- package/dist/modal-C7O4jt5-.js +4 -0
- package/dist/{node-list-3yGs9Kcx.js → node-list-7H-lIfUX.js} +10 -2
- package/dist/node-list-DMwAmH_n.js +4 -0
- package/dist/{paragraph-LV8LrqLS.js → paragraph-Cfd37HUK.js} +6 -2
- package/dist/previewers-C7PKsIbc.js +10 -0
- package/dist/segmented-BRTZXoDN.js +7 -0
- package/dist/{segmented-ChmGPy3i.js → segmented-C9j-IIDc.js} +7 -2
- package/dist/{shiki-Dp1kiUyz.js → shiki-BoBbCakv.js} +8 -4
- package/dist/{strong-CcKSE5Jo.js → strong-BzOBAWrG.js} +6 -2
- package/dist/table-D6j6Gl87.js +3 -0
- package/dist/{table-Bk4vJ8-K.js → table-YY5M01Jm.js} +10 -6
- package/dist/{text-DP2IAZrc.js → text-DbHMEN3P.js} +4 -0
- package/dist/{thematic-break-DIO-A8eY.js → thematic-break-CdlhHAEZ.js} +4 -0
- package/dist/theme.css +2 -2
- package/dist/{tooltip-DkCGsj0S.js → tooltip-DarhJuZR.js} +3 -2
- package/dist/tooltip-vDDEbLwf.js +4 -0
- package/dist/vanilla-CzQw2_b4.js +4 -0
- package/dist/{vanilla-D2g3JpWZ.js → vanilla-Z6d1vQmX.js} +1 -1
- package/dist/{yaml-eOuEqAWX.js → yaml-DL5ozHZ_.js} +5 -1
- package/dist/{zoom-container-H5FZmzwY.js → zoom-container-DQMpHHGQ.js} +33 -9
- package/dist/zoom-container-JLbwB4gy.js +7 -0
- package/package.json +3 -2
- package/dist/button-CpZL9Dhf.js +0 -6
- package/dist/code-block-C1Hz5oQb.js +0 -10
- package/dist/dropdown-CS5Df_eY.js +0 -6
- package/dist/error-component-Csr-ujUx.js +0 -5
- package/dist/icon-DcKmEBsy.js +0 -4
- package/dist/image-BRCbBLI5.js +0 -9
- package/dist/modal-JW5JgjbN.js +0 -4
- package/dist/node-list-Cl7nXqfm.js +0 -4
- package/dist/previewers-BUz7EQbB.js +0 -10
- package/dist/segmented-STxjOAhU.js +0 -7
- package/dist/table-20vwclBI.js +0 -3
- package/dist/tooltip-BElCxO8W.js +0 -4
- package/dist/vanilla-79xxpygI.js +0 -4
- package/dist/zoom-container-C5vP44cr.js +0 -7
- /package/dist/{angular-CJL7ngrz.js → angular-BhTq4eiQ.js} +0 -0
- /package/dist/{angular-component-COlDvuNE.js → angular-component-Ba6hb3Ou.js} +0 -0
- /package/dist/{apache-CVvmKdUn.js → apache-D-wFNTKM.js} +0 -0
- /package/dist/{arrow-left-Dqeb1_Um.js → arrow-left-Fc4I-KPU.js} +0 -0
- /package/dist/{asciidoc-DOmevTVz.js → asciidoc-BhsFgAwp.js} +0 -0
- /package/dist/{assembly-Bj0yQVcL.js → assembly-DujbfxwO.js} +0 -0
- /package/dist/{astro-DUti0QFn.js → astro-By5aMeAI.js} +0 -0
- /package/dist/{bash-BfyNXzLO.js → bash-CxLhFc8T.js} +0 -0
- /package/dist/{batch-Dp6N3cFQ.js → batch-D2KCChyX.js} +0 -0
- /package/dist/{bicep-CEkCHedl.js → bicep-BpMR7zbS.js} +0 -0
- /package/dist/{c-CTmG9vr2.js → c-BL0h9qSZ.js} +0 -0
- /package/dist/{check-C6XCJVPi.js → check-DUf_EYGI.js} +0 -0
- /package/dist/{chevron-down-aK8OlmM2.js → chevron-down-Bd8OWcQz.js} +0 -0
- /package/dist/{circle-alert-C5r2kfnc.js → circle-alert-C3xlkKpn.js} +0 -0
- /package/dist/{clojure-CHjliXb8.js → clojure-CIlREuXX.js} +0 -0
- /package/dist/{cmake-BsKz8Gt4.js → cmake-C1NQwzHz.js} +0 -0
- /package/dist/{cobol-BvWYwPFU.js → cobol-BSROkBc2.js} +0 -0
- /package/dist/{code-Bwlpb4mV.js → code-jkFGYUqR.js} +0 -0
- /package/dist/{codeowners-CfTM6yvs.js → codeowners-ByOcyZxj.js} +0 -0
- /package/dist/{coffeescript-BDiFe_B2.js → coffeescript-LQTFO7bN.js} +0 -0
- /package/dist/{copy-VpvA-5VS.js → copy-CLBkFmXf.js} +0 -0
- /package/dist/{corner-down-left-B77X84F8.js → corner-down-left-CMgnqWC_.js} +0 -0
- /package/dist/{cpp-BfV_KWzp.js → cpp-BFHQMV1Y.js} +0 -0
- /package/dist/{crystal-BXT0x2i3.js → crystal-DCVN-7Od.js} +0 -0
- /package/dist/{csharp-C6rkxA6x.js → csharp-B0k7ij_8.js} +0 -0
- /package/dist/{css-Drxb2cuf.js → css-CC5BGj0-.js} +0 -0
- /package/dist/{csv-CHKRaQ9l.js → csv-B5a7HayX.js} +0 -0
- /package/dist/{cue-DksiF2mE.js → cue-CGNrDM1A.js} +0 -0
- /package/dist/{d-C8JgmiVc.js → d-CMJdAMFb.js} +0 -0
- /package/dist/{dart-BX3GppmW.js → dart-BBqW-Fvj.js} +0 -0
- /package/dist/{database-Lmva5T5u.js → database-LuWYzgPI.js} +0 -0
- /package/dist/{diff-C61xHcnV.js → diff-UhwhR0nf.js} +0 -0
- /package/dist/{docker-Dws0Euuu.js → docker-CaBsFwYx.js} +0 -0
- /package/dist/{download-BB76SD0m.js → download-DtpBCWCq.js} +0 -0
- /package/dist/{elixir-CtaCeLkf.js → elixir-NvxbJYKg.js} +0 -0
- /package/dist/{elm-CFvSvo-7.js → elm-BNn2zGko.js} +0 -0
- /package/dist/{en-US-Cw-sFSiZ.js → en-US-BE5eeEXk.js} +0 -0
- /package/dist/{env-BwMmmmE5.js → env-CKkm6DtJ.js} +0 -0
- /package/dist/{erlang-DJRbvPSq.js → erlang-DnQ1MXEC.js} +0 -0
- /package/dist/{eye-VjweBQoW.js → eye-g-R6YkP9.js} +0 -0
- /package/dist/{flip-horizontal-D4IxaKDu.js → flip-horizontal-14eeKks-.js} +0 -0
- /package/dist/{fortran-D3Vf5GTV.js → fortran-D7C8ntBV.js} +0 -0
- /package/dist/{fsharp-C2iQH5b1.js → fsharp-B2meisDr.js} +0 -0
- /package/dist/{git-DN4z97-P.js → git-Dibise41.js} +0 -0
- /package/dist/{gleam-PhX3VC_5.js → gleam-DghqX0MW.js} +0 -0
- /package/dist/{go-xPznl0oK.js → go-hIgDRVGB.js} +0 -0
- /package/dist/{graphql-sVzb1_rA.js → graphql-Cwvddao6.js} +0 -0
- /package/dist/{groovy-Bvkrc3eE.js → groovy-Z_peiWRr.js} +0 -0
- /package/dist/{haml-Y_qa35Lk.js → haml-CK7X58Ac.js} +0 -0
- /package/dist/{handlebars-Bo6cxn4k.js → handlebars-CzXueKIL.js} +0 -0
- /package/dist/{haskell-D8t1pxAr.js → haskell-F8Hxt60K.js} +0 -0
- /package/dist/{haxe-C-sdXVB9.js → haxe-rnsd_VXm.js} +0 -0
- /package/dist/{html-I3JKB_2G.js → html-B-vufMHC.js} +0 -0
- /package/dist/{http-Dj2NVTPO.js → http-D-fTarEG.js} +0 -0
- /package/dist/{image-DzKVFSaY.js → image-BnP_94aa.js} +0 -0
- /package/dist/{java-BulcCUaV.js → java-BhCbKSsp.js} +0 -0
- /package/dist/{javascript-DQlby440.js → javascript-CgYlNrc3.js} +0 -0
- /package/dist/{jinja-HRQZM5oZ.js → jinja-BwhD62Ck.js} +0 -0
- /package/dist/{json-wUPUX2x-.js → json-BITBW2a3.js} +0 -0
- /package/dist/{julia-DjHYSWzj.js → julia-K2FP98rH.js} +0 -0
- /package/dist/{kdl-CGLuct22.js → kdl-wzDw_Xgt.js} +0 -0
- /package/dist/{kotlin-CnR9eg7m.js → kotlin-UdhiRb2s.js} +0 -0
- /package/dist/{latex-CesDKd8G.js → latex-Cg4biTsQ.js} +0 -0
- /package/dist/{less-215r2nUv.js → less-CvaKAB1v.js} +0 -0
- /package/dist/{link-4JB1WqYS.js → link-C8MvJEtb.js} +0 -0
- /package/dist/{liquid-FFTnvZwx.js → liquid-DnaYJvE6.js} +0 -0
- /package/dist/{lisp-BNWIo3S3.js → lisp-Dxh5WGkj.js} +0 -0
- /package/dist/{log-C3BhnPjM.js → log-CptO9Lr8.js} +0 -0
- /package/dist/{lua-jBHQD7Fh.js → lua-BYE-WkAz.js} +0 -0
- /package/dist/{luau-CJKAqC3L.js → luau-9_yNlfJT.js} +0 -0
- /package/dist/{makefile-DZmoFYpF.js → makefile-B7idP48b.js} +0 -0
- /package/dist/{markdown-BEABBw2C.js → markdown-CF1aOY6A.js} +0 -0
- /package/dist/{marko-DE7d51Q2.js → marko-B96CKJZY.js} +0 -0
- /package/dist/{matlab-n99nEoGl.js → matlab-LSvZWs6_.js} +0 -0
- /package/dist/{maximize-VRncBaHe.js → maximize-BYf7n_fw.js} +0 -0
- /package/dist/{mermaid-Dv9_1JlU.js → mermaid-CjPc_PTq.js} +0 -0
- /package/dist/{minimize-k8aU78V4.js → minimize-DUcEsZ0x.js} +0 -0
- /package/dist/{nextflow-DjdDVx1j.js → nextflow-Di2JOuIQ.js} +0 -0
- /package/dist/{nginx-DH4jOOdC.js → nginx-DwP-rcfw.js} +0 -0
- /package/dist/{nim-Cb0hPGv5.js → nim-B8CTKDeR.js} +0 -0
- /package/dist/{nix-Bf4Vwv5v.js → nix-DzZgDL2a.js} +0 -0
- /package/dist/{ocaml-BwJ1z9S7.js → ocaml-Bs_vWDxp.js} +0 -0
- /package/dist/{perl-P6bAYvN9.js → perl-BvEAb2FB.js} +0 -0
- /package/dist/{php-BGTGPBW1.js → php-DJ6oc5J7.js} +0 -0
- /package/dist/{postcss-D8a2Jx1D.js → postcss-Buy79gTC.js} +0 -0
- /package/dist/{powershell-DNOnus4K.js → powershell-xWtLU9gf.js} +0 -0
- /package/dist/{prisma-DquVk_GR.js → prisma-_Jw8lmC9.js} +0 -0
- /package/dist/{prolog-BxJJGnOg.js → prolog-CXJiBRKn.js} +0 -0
- /package/dist/{properties-DjauSeDE.js → properties-bV3eZsxi.js} +0 -0
- /package/dist/{proto-3aU1SxxY.js → proto-CdPPb7qQ.js} +0 -0
- /package/dist/{pug-OiYFRnMd.js → pug-DuDhqAK0.js} +0 -0
- /package/dist/{puppet-8Sq4QIbE.js → puppet-BznIc6wm.js} +0 -0
- /package/dist/{python-CBYVyhMm.js → python-1saA982A.js} +0 -0
- /package/dist/{r-DfzMNaiK.js → r-C94u3fL1.js} +0 -0
- /package/dist/{racket-EkEmTJtD.js → racket-CJXkPHdl.js} +0 -0
- /package/dist/{razor-BSd-q379.js → razor-NEi8COml.js} +0 -0
- /package/dist/{rotate-ccw-square-Dy0doneR.js → rotate-ccw-square-BJ_A0rAa.js} +0 -0
- /package/dist/{ruby-CNn-W_DF.js → ruby-CgygvN8C.js} +0 -0
- /package/dist/{rust-BW9y4Ksf.js → rust-DQacYSAC.js} +0 -0
- /package/dist/{sass-Cyleqehh.js → sass-HD_VNbVH.js} +0 -0
- /package/dist/{scala-2YqaI_aG.js → scala-DFCCsRj5.js} +0 -0
- /package/dist/{scheme-CWx6sQlk.js → scheme-CMuWDKun.js} +0 -0
- /package/dist/{shader-CLzSKNOz.js → shader-CJxZVwVX.js} +0 -0
- /package/dist/{shiki-token-renderer-l2VX-xoX.js → shiki-token-renderer-zn-KUQJD.js} +0 -0
- /package/dist/{solidity-CgjJUETv.js → solidity-CZfwNrv_.js} +0 -0
- /package/dist/{stata-CI3W9UFN.js → stata-DLyUE6pK.js} +0 -0
- /package/dist/{svelte-D-OV6frL.js → svelte-D3v3JUId.js} +0 -0
- /package/dist/{swift-CcBwS4X5.js → swift-BuLBBeAo.js} +0 -0
- /package/dist/{table-BMlD4JhL.js → table-tZ8TA3cu.js} +0 -0
- /package/dist/{terraform-BwM_GPTy.js → terraform-BpdftQxe.js} +0 -0
- /package/dist/{text-hIzRUiKs.js → text-CVjFFVPk.js} +0 -0
- /package/dist/{toml-CXJ7B-C1.js → toml-DwuHYrJF.js} +0 -0
- /package/dist/{twig-CXQNsdEx.js → twig-C3W2hNMC.js} +0 -0
- /package/dist/{typescript-0uiFYOof.js → typescript-oV84jXPW.js} +0 -0
- /package/dist/{typst-gIi5b52E.js → typst-iMKBhjQc.js} +0 -0
- /package/dist/{v-Ct-HfSu0.js → v-D8a-2CMq.js} +0 -0
- /package/dist/{vala-BZbAZj2w.js → vala-Dnxzb4xr.js} +0 -0
- /package/dist/{verilog-NzFyyNP_.js → verilog-CABQqn01.js} +0 -0
- /package/dist/{vim-CN-tRagW.js → vim-BGlWyvYm.js} +0 -0
- /package/dist/{vue-BmLzKAao.js → vue-D6HdD2dj.js} +0 -0
- /package/dist/{xml-CBzkooc-.js → xml-B9NfR4AN.js} +0 -0
- /package/dist/{yaml-CT7I_lPM.js → yaml-CrFdGZgo.js} +0 -0
- /package/dist/{zh-CN-B9lWRP8O.js → zh-CN-BLQuwJEP.js} +0 -0
- /package/dist/{zig-B7F-QzJD.js → zig-BYI6J86j.js} +0 -0
- /package/dist/{zoomIn-DlPeXZbT.js → zoomIn-B7_XWmXc.js} +0 -0
- /package/dist/{zoomOut-Lvyw8SOW.js → zoomOut-CMmvbGLb.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as CODE_PREVIEWERS } from "./previewers-
|
|
2
|
-
import { A as tableDataToMarkdown, B as flow, C as loadLocaleMessages, D as escapeMarkdownTableCell, E as useFloating, F as hasKatex, G as useControls, H as saveImage, I as hasMermaid, K as useContext, L as hasShiki, M as preloadAsyncComponents, N as findLastLeafNode, O as extractTableDataFromElement, P as findNodeParent, R as isClient, S as currentLocale, T as localesGlob, U as svgToPngBlob, V as save, W as transformUrl, a as SHADCN_SCHEMAS, b as useI18n, c as DEFAULT_HARDEN_OPTIONS, d as LANGUAGE_ALIAS, f as LANGUAGE_EXTENSIONS, g as useMathRenderer, h as useMediumZoom, i as useSanitizers, j as tableDataToTSV, k as tableDataToCSV, l as DEFAULT_DARK_THEME, m as useMermaid, n as useTailwindV3Theme, o as PRELOAD_NODE_RENDERER, p as LANGUAGE_ICONS, q as useCodeOptions, r as useShiki, s as ICONS, t as useZoom, u as DEFAULT_LIGHT_THEME, v as _defineProperty, w as localeMessages, x as SUPPORT_LANGUAGES, y as useKatex, z as isServer } from "./composables-
|
|
3
|
-
import { t as node_list_default } from "./node-list-
|
|
1
|
+
import { t as CODE_PREVIEWERS } from "./previewers-C7PKsIbc.js";
|
|
2
|
+
import { A as tableDataToMarkdown, B as flow, C as loadLocaleMessages, D as escapeMarkdownTableCell, E as useFloating, F as hasKatex, G as useControls, H as saveImage, I as hasMermaid, K as useContext, L as hasShiki, M as preloadAsyncComponents, N as findLastLeafNode, O as extractTableDataFromElement, P as findNodeParent, R as isClient, S as currentLocale, T as localesGlob, U as svgToPngBlob, V as save, W as transformUrl, a as SHADCN_SCHEMAS, b as useI18n, c as DEFAULT_HARDEN_OPTIONS, d as LANGUAGE_ALIAS, f as LANGUAGE_EXTENSIONS, g as useMathRenderer, h as useMediumZoom, i as useSanitizers, j as tableDataToTSV, k as tableDataToCSV, l as DEFAULT_DARK_THEME, m as useMermaid, n as useTailwindV3Theme, o as PRELOAD_NODE_RENDERER, p as LANGUAGE_ICONS, q as useCodeOptions, r as useShiki, s as ICONS, t as useZoom, u as DEFAULT_LIGHT_THEME, v as _defineProperty, w as localeMessages, x as SUPPORT_LANGUAGES, y as useKatex, z as isServer } from "./composables-CzUVrTt_.js";
|
|
3
|
+
import { t as node_list_default } from "./node-list-7H-lIfUX.js";
|
|
4
4
|
import { n as treeFlatFilter, t as treeFilter } from "./dist-CYkm26BF.js";
|
|
5
5
|
import { computed, createElementBlock, createVNode, defineAsyncComponent, defineComponent, mergeProps, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, toRefs, unref, watch } from "vue";
|
|
6
6
|
import { MarkdownItAsync } from "markdown-it-async";
|
|
@@ -49,44 +49,46 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/components/renderers/index.ts
|
|
51
51
|
const NODE_RENDERERS = {
|
|
52
|
-
blockquote: defineAsyncComponent(() => import("./blockquote-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
blockquote: defineAsyncComponent(() => import("./blockquote-Crr-D7fY.js")),
|
|
53
|
+
break: defineAsyncComponent(() => import("./break-DoDPjOA0.js")),
|
|
54
|
+
code: defineAsyncComponent(() => import("./code-Bz8LM16H.js")),
|
|
55
|
+
delete: defineAsyncComponent(() => import("./delete-DFoiOzHW.js")),
|
|
56
|
+
emphasis: defineAsyncComponent(() => import("./emphasis-DvaBuxeK.js")),
|
|
57
|
+
footnoteDefinition: defineAsyncComponent(() => import("./footnote-definition-ByWh1N3S.js")),
|
|
58
|
+
footnoteReference: defineAsyncComponent(() => import("./footnote-reference-BJ4J7BFo.js")),
|
|
59
|
+
heading: defineAsyncComponent(() => import("./heading-1fssqGGO.js")),
|
|
60
|
+
html: defineAsyncComponent(() => import("./html-Be_6ezK6.js")),
|
|
61
|
+
image: defineAsyncComponent(() => import("./image-xPrAKT9D.js")),
|
|
62
|
+
inlineCode: defineAsyncComponent(() => import("./inline-code-B5lfHACE.js")),
|
|
63
|
+
inlineMath: defineAsyncComponent(() => import("./inline-math-CPkpjl8t.js")),
|
|
64
|
+
link: defineAsyncComponent(() => import("./link-BACrkxRW.js")),
|
|
65
|
+
list: defineAsyncComponent(() => import("./list-Cu8G46hK.js")),
|
|
66
|
+
listItem: defineAsyncComponent(() => import("./list-item-BMgDS1tS.js")),
|
|
67
|
+
math: defineAsyncComponent(() => import("./math-XsZX0VMw.js")),
|
|
68
|
+
paragraph: defineAsyncComponent(() => import("./paragraph-Cfd37HUK.js")),
|
|
69
|
+
strong: defineAsyncComponent(() => import("./strong-BzOBAWrG.js")),
|
|
70
|
+
table: defineAsyncComponent(() => import("./table-YY5M01Jm.js")),
|
|
71
|
+
text: defineAsyncComponent(() => import("./text-DbHMEN3P.js")),
|
|
72
|
+
thematicBreak: defineAsyncComponent(() => import("./thematic-break-CdlhHAEZ.js")),
|
|
73
|
+
yaml: defineAsyncComponent(() => import("./yaml-DL5ozHZ_.js"))
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
//#endregion
|
|
75
77
|
//#region src/components/index.ts
|
|
76
78
|
const UI = {
|
|
77
|
-
Button: defineAsyncComponent(() => import("./button-
|
|
78
|
-
CodeBlock: defineAsyncComponent(() => import("./code-block-
|
|
79
|
-
Dropdown: defineAsyncComponent(() => import("./dropdown-
|
|
80
|
-
ErrorComponent: defineAsyncComponent(() => import("./error-component-
|
|
81
|
-
Icon: defineAsyncComponent(() => import("./icon-
|
|
82
|
-
Image: defineAsyncComponent(() => import("./image-
|
|
83
|
-
Modal: defineAsyncComponent(() => import("./modal-
|
|
84
|
-
NodeList: defineAsyncComponent(() => import("./node-list-
|
|
85
|
-
Segmented: defineAsyncComponent(() => import("./segmented-
|
|
79
|
+
Button: defineAsyncComponent(() => import("./button-Dw4uJRaD.js")),
|
|
80
|
+
CodeBlock: defineAsyncComponent(() => import("./code-block-Bitp8x1w.js")),
|
|
81
|
+
Dropdown: defineAsyncComponent(() => import("./dropdown-CSRjqK0u.js")),
|
|
82
|
+
ErrorComponent: defineAsyncComponent(() => import("./error-component-DDnC0bqw.js")),
|
|
83
|
+
Icon: defineAsyncComponent(() => import("./icon-DE3AzDqz.js")),
|
|
84
|
+
Image: defineAsyncComponent(() => import("./image-Dl-r78_E.js")),
|
|
85
|
+
Modal: defineAsyncComponent(() => import("./modal-C7O4jt5-.js")),
|
|
86
|
+
NodeList: defineAsyncComponent(() => import("./node-list-DMwAmH_n.js")),
|
|
87
|
+
Segmented: defineAsyncComponent(() => import("./segmented-BRTZXoDN.js")),
|
|
86
88
|
Spin: defineAsyncComponent(() => import("./spin-DElj7VPm.js")),
|
|
87
|
-
Table: defineAsyncComponent(() => import("./table-
|
|
88
|
-
Tooltip: defineAsyncComponent(() => import("./tooltip-
|
|
89
|
-
ZoomContainer: defineAsyncComponent(() => import("./zoom-container-
|
|
89
|
+
Table: defineAsyncComponent(() => import("./table-D6j6Gl87.js")),
|
|
90
|
+
Tooltip: defineAsyncComponent(() => import("./tooltip-vDDEbLwf.js")),
|
|
91
|
+
ZoomContainer: defineAsyncComponent(() => import("./zoom-container-JLbwB4gy.js"))
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
//#endregion
|
|
@@ -2892,7 +2894,7 @@ function initializeContent(effects) {
|
|
|
2892
2894
|
* Construct and its state.
|
|
2893
2895
|
*/
|
|
2894
2896
|
/** @type {InitialConstruct} */
|
|
2895
|
-
const document = { tokenize: initializeDocument };
|
|
2897
|
+
const document$1 = { tokenize: initializeDocument };
|
|
2896
2898
|
/** @type {Construct} */
|
|
2897
2899
|
const containerConstruct = { tokenize: tokenizeContainer };
|
|
2898
2900
|
/**
|
|
@@ -8987,7 +8989,7 @@ var constructs_exports = /* @__PURE__ */ __export({
|
|
|
8987
8989
|
attentionMarkers: () => attentionMarkers,
|
|
8988
8990
|
contentInitial: () => contentInitial,
|
|
8989
8991
|
disable: () => disable,
|
|
8990
|
-
document: () => document$
|
|
8992
|
+
document: () => document$2,
|
|
8991
8993
|
flow: () => flow$2,
|
|
8992
8994
|
flowInitial: () => flowInitial,
|
|
8993
8995
|
insideSpan: () => insideSpan,
|
|
@@ -8995,7 +8997,7 @@ var constructs_exports = /* @__PURE__ */ __export({
|
|
|
8995
8997
|
text: () => text$3
|
|
8996
8998
|
});
|
|
8997
8999
|
/** @satisfies {Extension['document']} */
|
|
8998
|
-
const document$
|
|
9000
|
+
const document$2 = {
|
|
8999
9001
|
[42]: list$2,
|
|
9000
9002
|
[43]: list$2,
|
|
9001
9003
|
[45]: list$2,
|
|
@@ -9550,7 +9552,7 @@ function parse(options) {
|
|
|
9550
9552
|
constructs: combineExtensions([constructs_exports, ...(options || {}).extensions || []]),
|
|
9551
9553
|
content: create$1(content),
|
|
9552
9554
|
defined: [],
|
|
9553
|
-
document: create$1(document),
|
|
9555
|
+
document: create$1(document$1),
|
|
9554
9556
|
flow: create$1(flow$1),
|
|
9555
9557
|
lazy: {},
|
|
9556
9558
|
string: create$1(string),
|
|
@@ -19706,6 +19708,82 @@ const quoteTaskListPattern = /^>\s*- \[[x ]\]/i;
|
|
|
19706
19708
|
const quoteIncompleteTaskListPattern = /^>\s*-\s*\[\s*$/;
|
|
19707
19709
|
const trailingStandaloneDashWithNewlinesPattern = /(\n\n?)-[ \t]*$/;
|
|
19708
19710
|
|
|
19711
|
+
//#endregion
|
|
19712
|
+
//#region src/preprocess/utils.ts
|
|
19713
|
+
/**
|
|
19714
|
+
* Utility functions for preprocessing markdown content
|
|
19715
|
+
*/
|
|
19716
|
+
/**
|
|
19717
|
+
* Find the start index of the last paragraph in content
|
|
19718
|
+
* A paragraph is defined as content after the last blank line
|
|
19719
|
+
*
|
|
19720
|
+
* @param lines - Array of lines from content.split('\n')
|
|
19721
|
+
* @param skipTrailingEmpty - If true, skip the last element if it's empty (from trailing \n)
|
|
19722
|
+
* @returns The start index of the last paragraph
|
|
19723
|
+
*/
|
|
19724
|
+
function findLastParagraphStart(lines, skipTrailingEmpty = false) {
|
|
19725
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
19726
|
+
const line = lines[i];
|
|
19727
|
+
if (line === void 0) continue;
|
|
19728
|
+
if (skipTrailingEmpty && i === lines.length - 1 && line.trim() === "") continue;
|
|
19729
|
+
if (line.trim() === "") return i + 1;
|
|
19730
|
+
}
|
|
19731
|
+
return 0;
|
|
19732
|
+
}
|
|
19733
|
+
/**
|
|
19734
|
+
* Get the last paragraph and its start index
|
|
19735
|
+
*
|
|
19736
|
+
* @param content - Markdown content
|
|
19737
|
+
* @param skipTrailingEmpty - If true, skip trailing empty line when finding paragraph start
|
|
19738
|
+
* @returns Object with lastParagraph and startIndex
|
|
19739
|
+
*/
|
|
19740
|
+
function getLastParagraphWithIndex(content$2, skipTrailingEmpty = false) {
|
|
19741
|
+
const lines = content$2.split("\n");
|
|
19742
|
+
const startIndex = findLastParagraphStart(lines, skipTrailingEmpty);
|
|
19743
|
+
return {
|
|
19744
|
+
lastParagraph: lines.slice(startIndex).join("\n"),
|
|
19745
|
+
startIndex
|
|
19746
|
+
};
|
|
19747
|
+
}
|
|
19748
|
+
/**
|
|
19749
|
+
* Find the index of the last non-empty line
|
|
19750
|
+
*
|
|
19751
|
+
* @param lines - Array of lines
|
|
19752
|
+
* @returns The index of the last non-empty line, or -1 if all lines are empty
|
|
19753
|
+
*/
|
|
19754
|
+
function findLastNonEmptyLineIndex(lines) {
|
|
19755
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
19756
|
+
const line = lines[i];
|
|
19757
|
+
if (line && line.trim() !== "") return i;
|
|
19758
|
+
}
|
|
19759
|
+
return -1;
|
|
19760
|
+
}
|
|
19761
|
+
/**
|
|
19762
|
+
* Calculate the absolute position in content from a relative position in a paragraph
|
|
19763
|
+
*
|
|
19764
|
+
* @param paragraphStartIndex - The line index where the paragraph starts
|
|
19765
|
+
* @param relativePos - The position relative to the paragraph start
|
|
19766
|
+
* @param lines - All lines from content.split('\n')
|
|
19767
|
+
* @returns The absolute position in the full content
|
|
19768
|
+
*/
|
|
19769
|
+
function calculateAbsolutePosition(paragraphStartIndex, relativePos, lines) {
|
|
19770
|
+
if (paragraphStartIndex === 0) return relativePos;
|
|
19771
|
+
const beforeParagraph = lines.slice(0, paragraphStartIndex).join("\n");
|
|
19772
|
+
return beforeParagraph.length > 0 ? beforeParagraph.length + 1 + relativePos : relativePos;
|
|
19773
|
+
}
|
|
19774
|
+
/**
|
|
19775
|
+
* Calculate the paragraph offset for absolute position calculations
|
|
19776
|
+
*
|
|
19777
|
+
* @param paragraphStartIndex - The line index where the paragraph starts
|
|
19778
|
+
* @param lines - All lines from content.split('\n')
|
|
19779
|
+
* @returns The offset to add to relative positions
|
|
19780
|
+
*/
|
|
19781
|
+
function calculateParagraphOffset(paragraphStartIndex, lines) {
|
|
19782
|
+
if (paragraphStartIndex === 0) return 0;
|
|
19783
|
+
const beforeParagraph = lines.slice(0, paragraphStartIndex).join("\n");
|
|
19784
|
+
return beforeParagraph.length > 0 ? beforeParagraph.length + 1 : 0;
|
|
19785
|
+
}
|
|
19786
|
+
|
|
19709
19787
|
//#endregion
|
|
19710
19788
|
//#region src/preprocess/code.ts
|
|
19711
19789
|
/**
|
|
@@ -19738,10 +19816,13 @@ const trailingStandaloneDashWithNewlinesPattern = /(\n\n?)-[ \t]*$/;
|
|
|
19738
19816
|
* // Returns: '```' (no completion, code block has no content)
|
|
19739
19817
|
*/
|
|
19740
19818
|
function fixCode(content$2) {
|
|
19819
|
+
const codeBlockMatches = content$2.match(tripleBacktickPattern);
|
|
19820
|
+
const isInsideCodeBlock = (codeBlockMatches ? codeBlockMatches.length : 0) % 2 === 1;
|
|
19741
19821
|
const cleaned = removeTrailingIncompleteBackticks(content$2);
|
|
19742
19822
|
const wasCleanedUp = cleaned !== content$2;
|
|
19743
19823
|
content$2 = cleaned;
|
|
19744
|
-
if (
|
|
19824
|
+
if (isInsideCodeBlock && wasCleanedUp) content$2 = fixCodeBlock(content$2);
|
|
19825
|
+
else if (!wasCleanedUp) content$2 = fixCodeBlock(content$2);
|
|
19745
19826
|
if (!wasCleanedUp) content$2 = fixInlineCode(content$2);
|
|
19746
19827
|
return content$2;
|
|
19747
19828
|
}
|
|
@@ -19759,13 +19840,8 @@ function removeTrailingIncompleteBackticks(content$2) {
|
|
|
19759
19840
|
const afterBackticks = content$2.substring(backtickPos + backtickSequence.length);
|
|
19760
19841
|
if (afterBackticks.trim().length > 0) return content$2;
|
|
19761
19842
|
if (backtickSequence.length === 1) {
|
|
19762
|
-
const
|
|
19763
|
-
|
|
19764
|
-
for (let i = lines.length - 1; i >= 0; i--) if (lines[i].trim() === "") {
|
|
19765
|
-
paragraphStartIndex = i + 1;
|
|
19766
|
-
break;
|
|
19767
|
-
}
|
|
19768
|
-
const backticks = lines.slice(paragraphStartIndex).join("\n").replace(codeBlockPattern, "").match(singleBacktickPattern);
|
|
19843
|
+
const { lastParagraph } = getLastParagraphWithIndex(beforeBackticks);
|
|
19844
|
+
const backticks = lastParagraph.replace(codeBlockPattern, "").match(singleBacktickPattern);
|
|
19769
19845
|
const count = backticks ? backticks.length : 0;
|
|
19770
19846
|
const codeBlockMatches = beforeBackticks.match(tripleBacktickPattern);
|
|
19771
19847
|
const codeBlockCount = codeBlockMatches ? codeBlockMatches.length : 0;
|
|
@@ -19805,12 +19881,7 @@ function fixInlineCode(content$2) {
|
|
|
19805
19881
|
const codeBlockMatches = content$2.match(tripleBacktickPattern);
|
|
19806
19882
|
if ((codeBlockMatches ? codeBlockMatches.length : 0) % 2 === 1) return content$2;
|
|
19807
19883
|
const lines = content$2.split("\n");
|
|
19808
|
-
|
|
19809
|
-
for (let i = lines.length - 1; i >= 0; i--) if (lines[i].trim() === "") {
|
|
19810
|
-
paragraphStartIndex = i + 1;
|
|
19811
|
-
break;
|
|
19812
|
-
}
|
|
19813
|
-
const lastParagraph = lines.slice(paragraphStartIndex).join("\n");
|
|
19884
|
+
const { lastParagraph, startIndex: paragraphStartIndex } = getLastParagraphWithIndex(content$2);
|
|
19814
19885
|
const backticks = lastParagraph.replace(codeBlockPattern, "").match(singleBacktickPattern);
|
|
19815
19886
|
if ((backticks ? backticks.length : 0) % 2 === 1) {
|
|
19816
19887
|
let lastBacktickPos = -1;
|
|
@@ -19832,8 +19903,7 @@ function fixInlineCode(content$2) {
|
|
|
19832
19903
|
}
|
|
19833
19904
|
}
|
|
19834
19905
|
if (lastBacktickPos !== -1) {
|
|
19835
|
-
const
|
|
19836
|
-
const actualPos = (beforeLastParagraph.length > 0 ? beforeLastParagraph.length + 1 : 0) + lastBacktickPos;
|
|
19906
|
+
const actualPos = calculateParagraphOffset(paragraphStartIndex, lines) + lastBacktickPos;
|
|
19837
19907
|
if (content$2.substring(actualPos + 1).trim().length > 0) return `${content$2}\``;
|
|
19838
19908
|
else return content$2.slice(0, actualPos) + content$2.slice(actualPos + 1);
|
|
19839
19909
|
}
|
|
@@ -19865,13 +19935,7 @@ function fixInlineCode(content$2) {
|
|
|
19865
19935
|
* // Returns: 'List item\n\n~~' (no completion, ~~ has no content)
|
|
19866
19936
|
*/
|
|
19867
19937
|
function fixDelete(content$2) {
|
|
19868
|
-
const
|
|
19869
|
-
let paragraphStartIndex = 0;
|
|
19870
|
-
for (let i = lines.length - 1; i >= 0; i--) if (lines[i].trim() === "") {
|
|
19871
|
-
paragraphStartIndex = i + 1;
|
|
19872
|
-
break;
|
|
19873
|
-
}
|
|
19874
|
-
const lastParagraph = lines.slice(paragraphStartIndex).join("\n");
|
|
19938
|
+
const { lastParagraph, startIndex: paragraphStartIndex } = getLastParagraphWithIndex(content$2);
|
|
19875
19939
|
const matches = lastParagraph.match(doubleTildePattern);
|
|
19876
19940
|
const count = matches ? matches.length : 0;
|
|
19877
19941
|
if (content$2.endsWith("~") && !content$2.endsWith("~~")) {
|
|
@@ -19889,7 +19953,7 @@ function fixDelete(content$2) {
|
|
|
19889
19953
|
const lastTildePos = lastParagraph.lastIndexOf("~~");
|
|
19890
19954
|
const afterLast = lastParagraph.substring(lastTildePos + 2);
|
|
19891
19955
|
if (afterLast.trim().length > 0) return `${content$2}~~`;
|
|
19892
|
-
else return content$2.substring(0, content$2.length - afterLast.length - 2);
|
|
19956
|
+
else return content$2.substring(0, content$2.length - afterLast.length - 2).trimEnd();
|
|
19893
19957
|
}
|
|
19894
19958
|
return content$2;
|
|
19895
19959
|
}
|
|
@@ -19904,34 +19968,42 @@ function fixDelete(content$2) {
|
|
|
19904
19968
|
*/
|
|
19905
19969
|
function fixEmphasis(content$2) {
|
|
19906
19970
|
const lines = content$2.split("\n");
|
|
19907
|
-
|
|
19908
|
-
for (let i = lines.length - 1; i >= 0; i--) if (lines[i].trim() === "") {
|
|
19909
|
-
paragraphStartIndex = i + 1;
|
|
19910
|
-
break;
|
|
19911
|
-
}
|
|
19912
|
-
const lastParagraph = lines.slice(paragraphStartIndex).join("\n");
|
|
19971
|
+
const { lastParagraph, startIndex: paragraphStartIndex } = getLastParagraphWithIndex(content$2);
|
|
19913
19972
|
const withoutDoubleAsterisk = lastParagraph.replace(doubleAsteriskPattern, "");
|
|
19914
19973
|
const asteriskMatches = withoutDoubleAsterisk.match(singleAsteriskPattern);
|
|
19915
|
-
|
|
19916
|
-
const lastStarPos = withoutDoubleAsterisk.lastIndexOf("*");
|
|
19917
|
-
if (withoutDoubleAsterisk.substring(lastStarPos + 1).trim().length > 0) return `${content$2}*`;
|
|
19918
|
-
else {
|
|
19919
|
-
let result = content$2.slice(0, -1);
|
|
19920
|
-
if (trailingStandaloneDashWithNewlinesPattern.test(result)) result = result.replace(trailingStandaloneDashWithNewlinesPattern, "$1");
|
|
19921
|
-
return result;
|
|
19922
|
-
}
|
|
19923
|
-
}
|
|
19974
|
+
const asteriskCount = asteriskMatches ? asteriskMatches.length : 0;
|
|
19924
19975
|
const withoutDoubleUnderscore = lastParagraph.replace(doubleUnderscorePattern, "");
|
|
19925
19976
|
const underscoreMatches = withoutDoubleUnderscore.match(singleUnderscorePattern);
|
|
19926
|
-
|
|
19977
|
+
const underscoreCount = underscoreMatches ? underscoreMatches.length : 0;
|
|
19978
|
+
let needsAsteriskCompletion = false;
|
|
19979
|
+
let needsUnderscoreCompletion = false;
|
|
19980
|
+
let needsAsteriskRemoval = false;
|
|
19981
|
+
let needsUnderscoreRemoval = false;
|
|
19982
|
+
if (asteriskCount % 2 === 1) {
|
|
19983
|
+
const lastStarPos = withoutDoubleAsterisk.lastIndexOf("*");
|
|
19984
|
+
if (withoutDoubleAsterisk.substring(lastStarPos + 1).trim().length > 0) needsAsteriskCompletion = true;
|
|
19985
|
+
else needsAsteriskRemoval = true;
|
|
19986
|
+
}
|
|
19987
|
+
if (underscoreCount % 2 === 1) {
|
|
19927
19988
|
const lastUnderscorePos = withoutDoubleUnderscore.lastIndexOf("_");
|
|
19928
|
-
if (withoutDoubleUnderscore.substring(lastUnderscorePos + 1).trim().length > 0)
|
|
19929
|
-
else
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19989
|
+
if (withoutDoubleUnderscore.substring(lastUnderscorePos + 1).trim().length > 0) needsUnderscoreCompletion = true;
|
|
19990
|
+
else needsUnderscoreRemoval = true;
|
|
19991
|
+
}
|
|
19992
|
+
if (needsAsteriskRemoval) {
|
|
19993
|
+
let result = content$2.slice(0, -1).trimEnd();
|
|
19994
|
+
if (trailingStandaloneDashWithNewlinesPattern.test(result)) result = result.replace(trailingStandaloneDashWithNewlinesPattern, "$1");
|
|
19995
|
+
return result;
|
|
19996
|
+
}
|
|
19997
|
+
if (needsUnderscoreRemoval) {
|
|
19998
|
+
const absoluteLastUnderscorePos = calculateParagraphOffset(paragraphStartIndex, lines) + withoutDoubleUnderscore.lastIndexOf("_");
|
|
19999
|
+
let result = content$2.substring(0, absoluteLastUnderscorePos).trimEnd();
|
|
20000
|
+
if (trailingStandaloneDashWithNewlinesPattern.test(result)) result = result.replace(trailingStandaloneDashWithNewlinesPattern, "$1");
|
|
20001
|
+
return result;
|
|
19934
20002
|
}
|
|
20003
|
+
if (needsAsteriskCompletion && needsUnderscoreCompletion) if (withoutDoubleAsterisk.indexOf("*") < withoutDoubleUnderscore.indexOf("_")) return `${content$2}_*`;
|
|
20004
|
+
else return `${content$2}*_`;
|
|
20005
|
+
if (needsAsteriskCompletion) return `${content$2}*`;
|
|
20006
|
+
if (needsUnderscoreCompletion) return `${content$2}_`;
|
|
19935
20007
|
return content$2;
|
|
19936
20008
|
}
|
|
19937
20009
|
|
|
@@ -20005,47 +20077,42 @@ function fixFootnote(content$2) {
|
|
|
20005
20077
|
if (!(before === "`" && before2 === "`" || before === "`" && after === "`" || after === "`" && after2 === "`")) backtickPositions.push(i);
|
|
20006
20078
|
}
|
|
20007
20079
|
}
|
|
20008
|
-
for (let i = 0; i < backtickPositions.length; i += 2)
|
|
20080
|
+
for (let i = 0; i < backtickPositions.length; i += 2) {
|
|
20009
20081
|
const start = backtickPositions[i];
|
|
20010
|
-
const end = backtickPositions[i + 1]
|
|
20011
|
-
inlineCodeRanges.push({
|
|
20082
|
+
const end = backtickPositions[i + 1];
|
|
20083
|
+
if (start !== void 0 && end !== void 0) inlineCodeRanges.push({
|
|
20012
20084
|
start,
|
|
20013
|
-
end
|
|
20085
|
+
end: end + 1
|
|
20014
20086
|
});
|
|
20015
20087
|
}
|
|
20016
20088
|
const footnoteDefRanges = [];
|
|
20017
20089
|
let lineOffset = 0;
|
|
20018
20090
|
for (let i = 0; i < lines.length; i++) {
|
|
20019
20091
|
const line = lines[i];
|
|
20020
|
-
if (isFootnoteDefLine(line)) {
|
|
20092
|
+
if (line && isFootnoteDefLine(line)) {
|
|
20021
20093
|
const lineEnd = lineOffset + line.length;
|
|
20022
20094
|
footnoteDefRanges.push({
|
|
20023
20095
|
start: lineOffset,
|
|
20024
20096
|
end: lineEnd
|
|
20025
20097
|
});
|
|
20026
20098
|
}
|
|
20027
|
-
lineOffset += line.length + 1;
|
|
20099
|
+
if (line) lineOffset += line.length + 1;
|
|
20028
20100
|
}
|
|
20029
|
-
|
|
20030
|
-
for (let i = lines.length - 1; i >= 0; i--) if (lines[i].trim() === "") {
|
|
20031
|
-
lastParagraphStartIndex = i + 1;
|
|
20032
|
-
break;
|
|
20033
|
-
}
|
|
20034
|
-
const lastParagraph = lines.slice(lastParagraphStartIndex).join("\n");
|
|
20101
|
+
const { lastParagraph, startIndex: lastParagraphStartIndex } = getLastParagraphWithIndex(content$2);
|
|
20035
20102
|
let result = content$2;
|
|
20036
20103
|
if (incompleteFootnoteRefPattern.test(lastParagraph)) {
|
|
20037
20104
|
const incompleteRefPos = lastParagraph.lastIndexOf("[^");
|
|
20038
20105
|
if (incompleteRefPos !== -1) {
|
|
20039
|
-
const absolutePos = lastParagraphStartIndex
|
|
20106
|
+
const absolutePos = calculateAbsolutePosition(lastParagraphStartIndex, incompleteRefPos, lines);
|
|
20040
20107
|
const isInCodeBlock = codeBlockRanges.some((range) => absolutePos >= range.start && absolutePos < range.end);
|
|
20041
20108
|
const isInInlineCode = inlineCodeRanges.some((range) => absolutePos >= range.start && absolutePos < range.end);
|
|
20042
20109
|
if (!isInCodeBlock && !isInInlineCode) {
|
|
20043
20110
|
const lineEnd = lastParagraph.indexOf("\n", incompleteRefPos);
|
|
20044
20111
|
const refEnd = lineEnd !== -1 ? lineEnd : lastParagraph.length;
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
const absoluteStart =
|
|
20048
|
-
const absoluteEnd =
|
|
20112
|
+
let refStart = incompleteRefPos;
|
|
20113
|
+
if (refStart > 0 && lastParagraph[refStart - 1] === " ") refStart--;
|
|
20114
|
+
const absoluteStart = calculateAbsolutePosition(lastParagraphStartIndex, refStart, lines);
|
|
20115
|
+
const absoluteEnd = calculateAbsolutePosition(lastParagraphStartIndex, refEnd, lines);
|
|
20049
20116
|
result = result.substring(0, absoluteStart) + result.substring(absoluteEnd);
|
|
20050
20117
|
content$2 = result;
|
|
20051
20118
|
codeBlockRanges.length = 0;
|
|
@@ -20079,12 +20146,12 @@ function fixFootnote(content$2) {
|
|
|
20079
20146
|
if (!(before === "`" && before2 === "`" || before === "`" && after === "`" || after === "`" && after2 === "`")) backtickPositions.push(i);
|
|
20080
20147
|
}
|
|
20081
20148
|
}
|
|
20082
|
-
for (let i = 0; i < backtickPositions.length; i += 2)
|
|
20149
|
+
for (let i = 0; i < backtickPositions.length; i += 2) {
|
|
20083
20150
|
const start = backtickPositions[i];
|
|
20084
|
-
const end = backtickPositions[i + 1]
|
|
20085
|
-
inlineCodeRanges.push({
|
|
20151
|
+
const end = backtickPositions[i + 1];
|
|
20152
|
+
if (start !== void 0 && end !== void 0) inlineCodeRanges.push({
|
|
20086
20153
|
start,
|
|
20087
|
-
end
|
|
20154
|
+
end: end + 1
|
|
20088
20155
|
});
|
|
20089
20156
|
}
|
|
20090
20157
|
}
|
|
@@ -20093,8 +20160,8 @@ function fixFootnote(content$2) {
|
|
|
20093
20160
|
const refPositions = [];
|
|
20094
20161
|
let refMatch = footnoteRefPattern.exec(content$2);
|
|
20095
20162
|
while (refMatch !== null) {
|
|
20096
|
-
const absolutePos = refMatch.index;
|
|
20097
|
-
const refText = refMatch[0];
|
|
20163
|
+
const absolutePos = refMatch.index ?? 0;
|
|
20164
|
+
const refText = refMatch[0] ?? "";
|
|
20098
20165
|
const isInCodeBlock = codeBlockRanges.some((range) => absolutePos >= range.start && absolutePos < range.end);
|
|
20099
20166
|
const isInInlineCode = inlineCodeRanges.some((range) => absolutePos >= range.start && absolutePos < range.end);
|
|
20100
20167
|
const isInFootnoteDef = footnoteDefRanges.some((range) => absolutePos >= range.start && absolutePos < range.end);
|
|
@@ -20111,7 +20178,11 @@ function fixFootnote(content$2) {
|
|
|
20111
20178
|
if (refPositions.length === 0) return content$2;
|
|
20112
20179
|
for (let i = refPositions.length - 1; i >= 0; i--) {
|
|
20113
20180
|
const ref$1 = refPositions[i];
|
|
20114
|
-
if (!definedLabels.has(ref$1.label))
|
|
20181
|
+
if (ref$1 && !definedLabels.has(ref$1.label)) {
|
|
20182
|
+
let refStart = ref$1.start;
|
|
20183
|
+
if (refStart > 0 && result[refStart - 1] === " ") refStart--;
|
|
20184
|
+
result = result.substring(0, refStart) + result.substring(ref$1.end);
|
|
20185
|
+
}
|
|
20115
20186
|
}
|
|
20116
20187
|
return result;
|
|
20117
20188
|
}
|
|
@@ -20147,15 +20218,11 @@ function fixFootnote(content$2) {
|
|
|
20147
20218
|
* // Returns: '$$\n' (no completion, this is block math)
|
|
20148
20219
|
*/
|
|
20149
20220
|
function fixInlineMath(content$2) {
|
|
20221
|
+
if (content$2 === "$") return "";
|
|
20150
20222
|
const codeBlockMatches = content$2.match(tripleBacktickPattern);
|
|
20151
20223
|
if ((codeBlockMatches ? codeBlockMatches.length : 0) % 2 === 1) return content$2;
|
|
20152
20224
|
const lines = content$2.split("\n");
|
|
20153
|
-
|
|
20154
|
-
for (let i = lines.length - 1; i >= 0; i--) if (lines[i].trim() === "") {
|
|
20155
|
-
paragraphStartIndex = i + 1;
|
|
20156
|
-
break;
|
|
20157
|
-
}
|
|
20158
|
-
const lastParagraph = lines.slice(paragraphStartIndex).join("\n");
|
|
20225
|
+
const { lastParagraph, startIndex: paragraphStartIndex } = getLastParagraphWithIndex(content$2);
|
|
20159
20226
|
let withoutCodeBlocks = lastParagraph.replace(codeBlockPattern, "");
|
|
20160
20227
|
withoutCodeBlocks = withoutCodeBlocks.replace(/`[^`\n]+`/g, "");
|
|
20161
20228
|
const dollarMatches = withoutCodeBlocks.match(doubleDollarPattern);
|
|
@@ -20163,36 +20230,22 @@ function fixInlineMath(content$2) {
|
|
|
20163
20230
|
const lastDollarPos = findLastDollarPairNotInCodeBlock(lastParagraph);
|
|
20164
20231
|
if (lastDollarPos === -1) return content$2;
|
|
20165
20232
|
let afterLast = lastParagraph.substring(lastDollarPos + 2);
|
|
20233
|
+
if (afterLast.startsWith("\n") || afterLast.includes("\n")) return content$2;
|
|
20166
20234
|
if (afterLast.trim() === "$") return content$2;
|
|
20167
20235
|
let shouldRemoveTrailingDollar = false;
|
|
20168
20236
|
if (afterLast.endsWith("$") && !afterLast.endsWith("$$")) {
|
|
20169
20237
|
shouldRemoveTrailingDollar = true;
|
|
20170
20238
|
afterLast = afterLast.slice(0, -1);
|
|
20171
20239
|
}
|
|
20172
|
-
|
|
20173
|
-
const isBlockMathByAfter = !hasContentAfter && afterLast.startsWith("\n");
|
|
20174
|
-
const linesInParagraph = lastParagraph.split("\n");
|
|
20175
|
-
let lineWithDollar = "";
|
|
20176
|
-
for (let i = linesInParagraph.length - 1; i >= 0; i--) {
|
|
20177
|
-
const line = linesInParagraph[i];
|
|
20178
|
-
if (line.includes("$$")) {
|
|
20179
|
-
lineWithDollar = line;
|
|
20180
|
-
break;
|
|
20181
|
-
}
|
|
20182
|
-
}
|
|
20183
|
-
const isBlockMathByLine = lineWithDollar.replace(/\$\$/g, "").trim() === "" && afterLast.startsWith("\n");
|
|
20184
|
-
if (isBlockMathByAfter || isBlockMathByLine) return content$2;
|
|
20185
|
-
if (hasContentAfter) {
|
|
20240
|
+
if (afterLast.trim().length > 0) {
|
|
20186
20241
|
if (shouldRemoveTrailingDollar) {
|
|
20187
|
-
const
|
|
20188
|
-
const actualLastDollarPos = (beforeLastParagraph.length > 0 ? beforeLastParagraph.length + 1 : 0) + lastDollarPos;
|
|
20242
|
+
const actualLastDollarPos = calculateParagraphOffset(paragraphStartIndex, lines) + lastDollarPos;
|
|
20189
20243
|
return `${content$2.substring(0, actualLastDollarPos + 2)}${lastParagraph.substring(lastDollarPos + 2, lastParagraph.length - 1)}$$`;
|
|
20190
20244
|
}
|
|
20191
20245
|
return `${content$2}$$`;
|
|
20192
20246
|
} else {
|
|
20193
|
-
const
|
|
20194
|
-
|
|
20195
|
-
return content$2.slice(0, actualLastDollarPos) + content$2.slice(actualLastDollarPos + 2);
|
|
20247
|
+
const actualLastDollarPos = calculateParagraphOffset(paragraphStartIndex, lines) + lastDollarPos;
|
|
20248
|
+
return content$2.slice(0, actualLastDollarPos).trimEnd();
|
|
20196
20249
|
}
|
|
20197
20250
|
}
|
|
20198
20251
|
return content$2;
|
|
@@ -20273,30 +20326,25 @@ function findLastDollarPairNotInCodeBlock(text$4) {
|
|
|
20273
20326
|
* // Removes trailing standalone bracket and trailing newline
|
|
20274
20327
|
*/
|
|
20275
20328
|
function fixLink(content$2) {
|
|
20276
|
-
var _lines$lastNonEmptyLi;
|
|
20277
20329
|
const lines = content$2.split("\n");
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
paragraphStartIndex = i + 1;
|
|
20281
|
-
break;
|
|
20282
|
-
}
|
|
20283
|
-
const lastParagraph = lines.slice(paragraphStartIndex).join("\n");
|
|
20284
|
-
let lastNonEmptyLineIndex = lines.length - 1;
|
|
20285
|
-
while (lastNonEmptyLineIndex >= 0 && ((_lines$lastNonEmptyLi = lines[lastNonEmptyLineIndex]) === null || _lines$lastNonEmptyLi === void 0 ? void 0 : _lines$lastNonEmptyLi.trim()) === "") lastNonEmptyLineIndex--;
|
|
20330
|
+
const { lastParagraph } = getLastParagraphWithIndex(content$2);
|
|
20331
|
+
const lastNonEmptyLineIndex = findLastNonEmptyLineIndex(lines);
|
|
20286
20332
|
if (lastNonEmptyLineIndex >= 0) {
|
|
20287
20333
|
const lastLine = lines[lastNonEmptyLineIndex];
|
|
20288
|
-
if (
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20334
|
+
if (!lastLine) return content$2;
|
|
20335
|
+
const standaloneBracketMatch = lastLine.match(/(!?\[)\s*$/);
|
|
20336
|
+
if (standaloneBracketMatch && standaloneBracketMatch[1]) {
|
|
20337
|
+
const bracket = standaloneBracketMatch[1];
|
|
20338
|
+
const bracketPos = lastLine.lastIndexOf(bracket);
|
|
20339
|
+
if (lastLine.substring(bracketPos + bracket.length).trim().length === 0) {
|
|
20340
|
+
const newLine = lastLine.substring(0, bracketPos).trimEnd();
|
|
20341
|
+
const newLines = [...lines];
|
|
20342
|
+
newLines[lastNonEmptyLineIndex] = newLine;
|
|
20343
|
+
if (lastNonEmptyLineIndex + 1 < newLines.length) {
|
|
20344
|
+
const nextLine = newLines[lastNonEmptyLineIndex + 1];
|
|
20345
|
+
if (nextLine !== void 0 && nextLine.trim() === "") newLines.splice(lastNonEmptyLineIndex + 1, 1);
|
|
20299
20346
|
}
|
|
20347
|
+
return newLines.join("\n");
|
|
20300
20348
|
}
|
|
20301
20349
|
}
|
|
20302
20350
|
}
|
|
@@ -20334,32 +20382,91 @@ function fixLink(content$2) {
|
|
|
20334
20382
|
* // Returns: 'List item\n\n**' (no completion, ** has no content)
|
|
20335
20383
|
*/
|
|
20336
20384
|
function fixStrong(content$2) {
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
break;
|
|
20342
|
-
}
|
|
20343
|
-
const lastParagraph = lines.slice(paragraphStartIndex).join("\n");
|
|
20385
|
+
if (content$2 === "*" || content$2 === "_") return "";
|
|
20386
|
+
const { lastParagraph } = getLastParagraphWithIndex(content$2);
|
|
20387
|
+
const endsWithSingleAsterisk = content$2.endsWith("*") && !content$2.endsWith("**");
|
|
20388
|
+
const endsWithSingleUnderscore = content$2.endsWith("_") && !content$2.endsWith("__");
|
|
20344
20389
|
const asteriskMatches = lastParagraph.match(doubleAsteriskPattern);
|
|
20345
|
-
|
|
20390
|
+
const asteriskCount = asteriskMatches ? asteriskMatches.length : 0;
|
|
20391
|
+
const underscoreMatches = lastParagraph.match(doubleUnderscorePattern);
|
|
20392
|
+
const underscoreCount = underscoreMatches ? underscoreMatches.length : 0;
|
|
20393
|
+
let needsAsteriskCompletion = false;
|
|
20394
|
+
let needsUnderscoreCompletion = false;
|
|
20395
|
+
let needsAsteriskRemoval = false;
|
|
20396
|
+
let needsUnderscoreRemoval = false;
|
|
20397
|
+
if (asteriskCount % 2 === 1) {
|
|
20346
20398
|
const lastStarPos = lastParagraph.lastIndexOf("**");
|
|
20347
|
-
if (lastParagraph.substring(lastStarPos + 2).trim().length > 0)
|
|
20348
|
-
else
|
|
20349
|
-
let result = content$2.slice(0, -2);
|
|
20350
|
-
if (trailingStandaloneDashWithNewlinesPattern.test(result)) result = result.replace(trailingStandaloneDashWithNewlinesPattern, "$1");
|
|
20351
|
-
return result;
|
|
20352
|
-
}
|
|
20399
|
+
if (lastParagraph.substring(lastStarPos + 2).trim().length > 0) needsAsteriskCompletion = true;
|
|
20400
|
+
else needsAsteriskRemoval = true;
|
|
20353
20401
|
}
|
|
20354
|
-
|
|
20355
|
-
if ((underscoreMatches ? underscoreMatches.length : 0) % 2 === 1) {
|
|
20402
|
+
if (underscoreCount % 2 === 1) {
|
|
20356
20403
|
const lastUnderscorePos = lastParagraph.lastIndexOf("__");
|
|
20357
|
-
if (lastParagraph.substring(lastUnderscorePos + 2).trim().length > 0)
|
|
20358
|
-
else
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20404
|
+
if (lastParagraph.substring(lastUnderscorePos + 2).trim().length > 0) needsUnderscoreCompletion = true;
|
|
20405
|
+
else needsUnderscoreRemoval = true;
|
|
20406
|
+
}
|
|
20407
|
+
let removedTrailingSingle = false;
|
|
20408
|
+
if (endsWithSingleAsterisk && (needsAsteriskCompletion || needsAsteriskRemoval)) {
|
|
20409
|
+
content$2 = content$2.slice(0, -1);
|
|
20410
|
+
removedTrailingSingle = true;
|
|
20411
|
+
const { lastParagraph: newLastParagraph } = getLastParagraphWithIndex(content$2);
|
|
20412
|
+
const newAsteriskMatches = newLastParagraph.match(doubleAsteriskPattern);
|
|
20413
|
+
if ((newAsteriskMatches ? newAsteriskMatches.length : 0) % 2 === 1) {
|
|
20414
|
+
const lastStarPos = newLastParagraph.lastIndexOf("**");
|
|
20415
|
+
if (newLastParagraph.substring(lastStarPos + 2).trim().length > 0) {
|
|
20416
|
+
needsAsteriskCompletion = true;
|
|
20417
|
+
needsAsteriskRemoval = false;
|
|
20418
|
+
} else {
|
|
20419
|
+
needsAsteriskRemoval = true;
|
|
20420
|
+
needsAsteriskCompletion = false;
|
|
20421
|
+
}
|
|
20422
|
+
}
|
|
20423
|
+
}
|
|
20424
|
+
if (endsWithSingleUnderscore && (needsUnderscoreCompletion || needsUnderscoreRemoval)) {
|
|
20425
|
+
content$2 = content$2.slice(0, -1);
|
|
20426
|
+
removedTrailingSingle = true;
|
|
20427
|
+
const { lastParagraph: newLastParagraph } = getLastParagraphWithIndex(content$2);
|
|
20428
|
+
const newUnderscoreMatches = newLastParagraph.match(doubleUnderscorePattern);
|
|
20429
|
+
if ((newUnderscoreMatches ? newUnderscoreMatches.length : 0) % 2 === 1) {
|
|
20430
|
+
const lastUnderscorePos = newLastParagraph.lastIndexOf("__");
|
|
20431
|
+
if (newLastParagraph.substring(lastUnderscorePos + 2).trim().length > 0) {
|
|
20432
|
+
needsUnderscoreCompletion = true;
|
|
20433
|
+
needsUnderscoreRemoval = false;
|
|
20434
|
+
} else {
|
|
20435
|
+
needsUnderscoreRemoval = true;
|
|
20436
|
+
needsUnderscoreCompletion = false;
|
|
20437
|
+
}
|
|
20438
|
+
}
|
|
20439
|
+
}
|
|
20440
|
+
if (needsAsteriskRemoval) {
|
|
20441
|
+
let result = content$2.slice(0, -2).trimEnd();
|
|
20442
|
+
if (trailingStandaloneDashWithNewlinesPattern.test(result)) result = result.replace(trailingStandaloneDashWithNewlinesPattern, "$1");
|
|
20443
|
+
return result;
|
|
20444
|
+
}
|
|
20445
|
+
if (needsUnderscoreRemoval) {
|
|
20446
|
+
const { lastParagraph: newLastParagraph, startIndex: newParagraphStartIndex } = getLastParagraphWithIndex(content$2);
|
|
20447
|
+
const lastUnderscorePos = newLastParagraph.lastIndexOf("__");
|
|
20448
|
+
const absoluteLastUnderscorePos = calculateParagraphOffset(newParagraphStartIndex, content$2.split("\n")) + lastUnderscorePos;
|
|
20449
|
+
let result = content$2.substring(0, absoluteLastUnderscorePos).trimEnd();
|
|
20450
|
+
if (trailingStandaloneDashWithNewlinesPattern.test(result)) result = result.replace(trailingStandaloneDashWithNewlinesPattern, "$1");
|
|
20451
|
+
return result;
|
|
20452
|
+
}
|
|
20453
|
+
if (needsAsteriskCompletion && needsUnderscoreCompletion) if (lastParagraph.indexOf("**") < lastParagraph.indexOf("__")) return `${content$2}__**`;
|
|
20454
|
+
else return `${content$2}**__`;
|
|
20455
|
+
if (needsAsteriskCompletion) {
|
|
20456
|
+
if (!removedTrailingSingle) {
|
|
20457
|
+
const { lastParagraph: currentLastParagraph } = getLastParagraphWithIndex(content$2);
|
|
20458
|
+
const singleAsteriskMatches = currentLastParagraph.replace(doubleAsteriskPattern, "").match(singleAsteriskPattern);
|
|
20459
|
+
if ((singleAsteriskMatches ? singleAsteriskMatches.length : 0) % 2 === 1) return `${content$2}***`;
|
|
20362
20460
|
}
|
|
20461
|
+
return `${content$2}**`;
|
|
20462
|
+
}
|
|
20463
|
+
if (needsUnderscoreCompletion) {
|
|
20464
|
+
if (!removedTrailingSingle) {
|
|
20465
|
+
const { lastParagraph: currentLastParagraph } = getLastParagraphWithIndex(content$2);
|
|
20466
|
+
const singleUnderscoreMatches = currentLastParagraph.replace(doubleUnderscorePattern, "").match(singleUnderscorePattern);
|
|
20467
|
+
if ((singleUnderscoreMatches ? singleUnderscoreMatches.length : 0) % 2 === 1) return `${content$2}___`;
|
|
20468
|
+
}
|
|
20469
|
+
return `${content$2}__`;
|
|
20363
20470
|
}
|
|
20364
20471
|
return content$2;
|
|
20365
20472
|
}
|
|
@@ -20395,25 +20502,18 @@ function fixStrong(content$2) {
|
|
|
20395
20502
|
function fixTable(content$2) {
|
|
20396
20503
|
const codeBlockMatches = content$2.match(tripleBacktickPattern);
|
|
20397
20504
|
if ((codeBlockMatches ? codeBlockMatches.length : 0) % 2 === 1) return content$2;
|
|
20398
|
-
const
|
|
20399
|
-
|
|
20400
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
20401
|
-
const line = lines[i];
|
|
20402
|
-
if (i === lines.length - 1 && line.trim() === "") continue;
|
|
20403
|
-
if (line.trim() === "") {
|
|
20404
|
-
paragraphStartIndex = i + 1;
|
|
20405
|
-
break;
|
|
20406
|
-
}
|
|
20407
|
-
}
|
|
20408
|
-
const paragraphLines = lines.slice(paragraphStartIndex).join("\n").split("\n").filter((line) => line.trim() !== "");
|
|
20505
|
+
const { lastParagraph } = getLastParagraphWithIndex(content$2, true);
|
|
20506
|
+
const paragraphLines = lastParagraph.split("\n").filter((line) => line.trim() !== "");
|
|
20409
20507
|
if (paragraphLines.length === 0) return content$2;
|
|
20410
20508
|
let headerRowIndex = -1;
|
|
20411
20509
|
let headerRow = "";
|
|
20412
20510
|
for (let i = 0; i < paragraphLines.length; i++) {
|
|
20413
|
-
const line = paragraphLines[i]
|
|
20414
|
-
if (
|
|
20511
|
+
const line = paragraphLines[i];
|
|
20512
|
+
if (!line) continue;
|
|
20513
|
+
const trimmedLine = line.trim();
|
|
20514
|
+
if (tableRowPattern.test(trimmedLine) || trimmedLine.startsWith("|") && trimmedLine.length > 1) {
|
|
20415
20515
|
headerRowIndex = i;
|
|
20416
|
-
headerRow =
|
|
20516
|
+
headerRow = trimmedLine;
|
|
20417
20517
|
break;
|
|
20418
20518
|
}
|
|
20419
20519
|
}
|
|
@@ -20433,7 +20533,9 @@ function fixTable(content$2) {
|
|
|
20433
20533
|
if (newContent.endsWith("\n")) return `${newContent}${separator}`;
|
|
20434
20534
|
else return `${newContent}\n${separator}`;
|
|
20435
20535
|
}
|
|
20436
|
-
const
|
|
20536
|
+
const nextLineRaw = paragraphLines[headerRowIndex + 1];
|
|
20537
|
+
if (!nextLineRaw) return content$2;
|
|
20538
|
+
const nextLine = nextLineRaw.trim();
|
|
20437
20539
|
if (separatorPattern.test(nextLine)) {
|
|
20438
20540
|
if ((nextLine.match(/\|/g) || []).length - 1 === headerColumns) {
|
|
20439
20541
|
if (!isHeaderComplete) return `${beforeHeaderRow}${completedHeaderRow}${afterHeaderRow}`;
|
|
@@ -20443,6 +20545,7 @@ function fixTable(content$2) {
|
|
|
20443
20545
|
const afterLines = afterHeaderRow.split("\n");
|
|
20444
20546
|
if (afterLines.length > 1) {
|
|
20445
20547
|
const nextLineInContent = afterLines[1];
|
|
20548
|
+
if (!nextLineInContent) return content$2;
|
|
20446
20549
|
if (nextLineInContent.startsWith("|") && nextLineInContent.includes("-")) {
|
|
20447
20550
|
const remainingLines = afterLines.slice(2).join("\n");
|
|
20448
20551
|
const newHeader = isHeaderComplete ? headerRow : completedHeaderRow;
|
|
@@ -20498,26 +20601,12 @@ function fixTaskList(content$2) {
|
|
|
20498
20601
|
const lines = content$2.split("\n");
|
|
20499
20602
|
if (lines.length === 0) return content$2;
|
|
20500
20603
|
const lastLine = lines[lines.length - 1];
|
|
20501
|
-
if (
|
|
20502
|
-
|
|
20503
|
-
|
|
20504
|
-
|
|
20505
|
-
|
|
20506
|
-
if (
|
|
20507
|
-
const result = lines.slice(0, -1).join("\n");
|
|
20508
|
-
if (lines.length > 1) return `${result}\n`;
|
|
20509
|
-
return result;
|
|
20510
|
-
}
|
|
20511
|
-
if (incompleteTaskListPattern.test(lastLine)) {
|
|
20512
|
-
const result = lines.slice(0, -1).join("\n");
|
|
20513
|
-
if (lines.length > 1) return `${result}\n`;
|
|
20514
|
-
return result;
|
|
20515
|
-
}
|
|
20516
|
-
if (standaloneDashPattern.test(lastLine) && !taskListPattern.test(lastLine)) {
|
|
20517
|
-
const result = lines.slice(0, -1).join("\n");
|
|
20518
|
-
if (lines.length > 1) return `${result}\n`;
|
|
20519
|
-
return result;
|
|
20520
|
-
}
|
|
20604
|
+
if (!lastLine) return content$2;
|
|
20605
|
+
if (quoteIncompleteTaskListPattern.test(lastLine)) return lines.slice(0, -1).join("\n");
|
|
20606
|
+
if (quoteStandaloneDashPattern.test(lastLine) && !quoteTaskListPattern.test(lastLine)) return lines.slice(0, -1).join("\n");
|
|
20607
|
+
if (incompleteTaskListPattern.test(lastLine)) return lines.slice(0, -1).join("\n");
|
|
20608
|
+
if (standaloneDashPattern.test(lastLine) && !taskListPattern.test(lastLine)) return lines.slice(0, -1).join("\n");
|
|
20609
|
+
if (/^\s*-\s+$/.test(lastLine) && !taskListPattern.test(lastLine)) return lines.slice(0, -1).join("\n");
|
|
20521
20610
|
return content$2;
|
|
20522
20611
|
}
|
|
20523
20612
|
|
|
@@ -20550,8 +20639,8 @@ function proprocessContent(content$2) {
|
|
|
20550
20639
|
function normalize(content$2) {
|
|
20551
20640
|
return flow([proprocessContent, preprocessLaTeX])(content$2);
|
|
20552
20641
|
}
|
|
20553
|
-
function preprocess(content$2) {
|
|
20554
|
-
|
|
20642
|
+
function preprocess(content$2, streamdown = true) {
|
|
20643
|
+
const tasks = [
|
|
20555
20644
|
fixFootnote,
|
|
20556
20645
|
fixStrong,
|
|
20557
20646
|
fixEmphasis,
|
|
@@ -20560,9 +20649,10 @@ function preprocess(content$2) {
|
|
|
20560
20649
|
fixTaskList,
|
|
20561
20650
|
fixLink,
|
|
20562
20651
|
fixTable,
|
|
20563
|
-
fixInlineMath
|
|
20564
|
-
|
|
20565
|
-
|
|
20652
|
+
fixInlineMath
|
|
20653
|
+
];
|
|
20654
|
+
if (streamdown) tasks.push(remend);
|
|
20655
|
+
return flow(tasks)(content$2);
|
|
20566
20656
|
}
|
|
20567
20657
|
|
|
20568
20658
|
//#endregion
|
|
@@ -20733,6 +20823,10 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
20733
20823
|
type: Object,
|
|
20734
20824
|
required: false
|
|
20735
20825
|
},
|
|
20826
|
+
uiOptions: {
|
|
20827
|
+
type: Object,
|
|
20828
|
+
required: false
|
|
20829
|
+
},
|
|
20736
20830
|
isDark: {
|
|
20737
20831
|
type: Boolean,
|
|
20738
20832
|
required: false,
|
|
@@ -20767,14 +20861,16 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
20767
20861
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
20768
20862
|
const props = __props;
|
|
20769
20863
|
const emits = __emit;
|
|
20770
|
-
const { mode, shikiOptions, mermaidOptions, isDark, enableAnimate } = toRefs(props);
|
|
20864
|
+
const { mode, shikiOptions, mermaidOptions, uiOptions, isDark, enableAnimate } = toRefs(props);
|
|
20771
20865
|
const containerRef = ref();
|
|
20772
20866
|
const { provideContext } = useContext();
|
|
20773
20867
|
const markdownParser = new MarkdownParser({
|
|
20774
20868
|
mode: props.mode,
|
|
20775
20869
|
mdastOptions: props.mdastOptions,
|
|
20870
|
+
normalize: props.normalize,
|
|
20871
|
+
preprocess: props.preprocess,
|
|
20776
20872
|
postprocess: props.postprocess,
|
|
20777
|
-
|
|
20873
|
+
extendMarkdownIt: props.extendMarkdownIt
|
|
20778
20874
|
});
|
|
20779
20875
|
const processed = computed(() => markdownParser.parseMarkdown(props.content));
|
|
20780
20876
|
const parsedNodes = computed(() => processed.value.nodes);
|
|
@@ -20794,10 +20890,29 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
20794
20890
|
function getContainer() {
|
|
20795
20891
|
return containerRef.value;
|
|
20796
20892
|
}
|
|
20893
|
+
function getOverlayContainer() {
|
|
20894
|
+
return document.querySelector("#stream-markdown-overlay");
|
|
20895
|
+
}
|
|
20797
20896
|
const { preload: preloadShiki, dispose: disposeShiki } = useShiki({ shikiOptions });
|
|
20798
20897
|
const { preload: preloadMermaid, dispose: disposeMermaid } = useMermaid({ mermaidOptions });
|
|
20799
20898
|
const { preload: preloadKatex, dispose: disposeKatex } = useKatex();
|
|
20899
|
+
function ensureOverlayContainer() {
|
|
20900
|
+
if (!getOverlayContainer()) {
|
|
20901
|
+
const div = document.createElement("div");
|
|
20902
|
+
div.id = "stream-markdown-overlay";
|
|
20903
|
+
div.classList.add("stream-markdown-overlay");
|
|
20904
|
+
div.classList.add(isDark.value ? "dark" : "light");
|
|
20905
|
+
document.body.appendChild(div);
|
|
20906
|
+
}
|
|
20907
|
+
}
|
|
20908
|
+
function updateOverlayContainerTheme() {
|
|
20909
|
+
const overlayContainer = getOverlayContainer();
|
|
20910
|
+
if (!overlayContainer) return;
|
|
20911
|
+
overlayContainer.classList.toggle("dark", isDark.value);
|
|
20912
|
+
overlayContainer.classList.toggle("light", !isDark.value);
|
|
20913
|
+
}
|
|
20800
20914
|
async function bootstrap() {
|
|
20915
|
+
ensureOverlayContainer();
|
|
20801
20916
|
const tasks = [
|
|
20802
20917
|
preloadShiki(),
|
|
20803
20918
|
preloadMermaid(),
|
|
@@ -20811,13 +20926,16 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
20811
20926
|
onMounted(bootstrap);
|
|
20812
20927
|
watch(() => props.mode, () => markdownParser.updateMode(props.mode));
|
|
20813
20928
|
watch(() => props.locale, () => loadLocaleMessages(props.locale));
|
|
20929
|
+
watch(() => props.isDark, () => updateOverlayContainerTheme());
|
|
20814
20930
|
provideContext({
|
|
20815
20931
|
mode,
|
|
20816
20932
|
icons,
|
|
20933
|
+
uiOptions,
|
|
20817
20934
|
isDark,
|
|
20818
20935
|
enableAnimate,
|
|
20819
20936
|
parsedNodes,
|
|
20820
20937
|
getContainer,
|
|
20938
|
+
getOverlayContainer,
|
|
20821
20939
|
onCopied: (content$2) => {
|
|
20822
20940
|
emits("copied", content$2);
|
|
20823
20941
|
}
|