vue-stream-markdown 0.0.0-alpha.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/LICENSE.md +21 -0
- package/README.md +96 -0
- package/dist/angular-Chs-UKBr.js +29 -0
- package/dist/angular-component-Cc_FANXU.js +29 -0
- package/dist/apache-COYnc6xR.js +35 -0
- package/dist/asciidoc-BabXBDAL.js +24 -0
- package/dist/assembly-CDqKhexW.js +35 -0
- package/dist/astro-C9kftzFG.js +28 -0
- package/dist/bash-Ce4pNIkV.js +27 -0
- package/dist/batch-CHQBRjFL.js +23 -0
- package/dist/bicep-8jxWtuBF.js +46 -0
- package/dist/blockquote-DFANmQEB.css +13 -0
- package/dist/blockquote-DdEg2gww.js +83 -0
- package/dist/button-BClRCjnc.js +5 -0
- package/dist/button-C12sn_G5.css +24 -0
- package/dist/button-D8xx1WIP.js +202 -0
- package/dist/c-FBUef746.js +25 -0
- package/dist/check-C4xOk8um.js +25 -0
- package/dist/chevron-down-cnOJ4h1g.js +25 -0
- package/dist/circle-alert-CLX-h5rZ.js +28 -0
- package/dist/clojure-BulUroSy.js +18 -0
- package/dist/cmake-CW3vz1Mo.js +35 -0
- package/dist/cobol-CIn3oFju.js +24 -0
- package/dist/code-CP6mPwkq.js +106 -0
- package/dist/code-D8LSp8rK.js +25 -0
- package/dist/code-NAXHb0o2.css +4 -0
- package/dist/code-block-C4D_QNTq.js +408 -0
- package/dist/code-block-D2zjJAww.css +57 -0
- package/dist/code-block-Dzw63Lki.js +9 -0
- package/dist/codeowners-CJggXF_b.js +27 -0
- package/dist/coffeescript-CBrVvzGY.js +23 -0
- package/dist/composables-qhB1h_ed.js +1567 -0
- package/dist/copy-Cabve0xf.js +31 -0
- package/dist/cpp-BTKeuyd-.js +31 -0
- package/dist/crystal-DyIYvZbm.js +24 -0
- package/dist/csharp-NqZ1vyF9.js +22 -0
- package/dist/css-BpR5Lajb.js +26 -0
- package/dist/csv-eCMFnKKK.js +24 -0
- package/dist/cue-TY97dGOQ.js +32 -0
- package/dist/d-NftUsdTd.js +24 -0
- package/dist/dart-DJpwZZbk.js +23 -0
- package/dist/database-aZwE71Px.js +24 -0
- package/dist/delete-BdWzKJCy.js +83 -0
- package/dist/delete-Ci7IJDoT.css +4 -0
- package/dist/diff-CYRzypaU.js +35 -0
- package/dist/docker-CxHBuukH.js +24 -0
- package/dist/download-Bnn7rtYw.js +24 -0
- package/dist/dropdown-Ca_PKF_d.js +5 -0
- package/dist/elixir-BKSxVc1h.js +24 -0
- package/dist/elm-DScuAf3X.js +24 -0
- package/dist/emphasis-BseYvUae.css +4 -0
- package/dist/emphasis-CTuGt1Ok.js +83 -0
- package/dist/en-US-Bfc50l3I.js +27 -0
- package/dist/env-CDAKsodl.js +24 -0
- package/dist/erlang-D2M1ZL3m.js +23 -0
- package/dist/error-component-BIPPxd-M.css +21 -0
- package/dist/error-component-CLEJmPmM.js +4 -0
- package/dist/error-component-CzarUjhh.js +61 -0
- package/dist/eye-CdeX8PhP.js +28 -0
- package/dist/fortran-CORyQ0wt.js +24 -0
- package/dist/fsharp-BJz_Jgpl.js +24 -0
- package/dist/git-DgrlTr1E.js +28 -0
- package/dist/gleam-t_xad9Kw.js +29 -0
- package/dist/go-Cvlh1xtL.js +24 -0
- package/dist/graphql-ApIm0mDD.js +24 -0
- package/dist/groovy-CaLnK8PV.js +23 -0
- package/dist/haml-MwijEO_6.js +35 -0
- package/dist/handlebars-CKdUPI9h.js +24 -0
- package/dist/haskell-NPOXEnck.js +24 -0
- package/dist/haxe-DyKBMsDE.js +23 -0
- package/dist/heading-2vpQQtTH.js +88 -0
- package/dist/heading-KxpVX3-u.css +30 -0
- package/dist/html-C5_wsY4-.css +5 -0
- package/dist/html-CMgES1dE.js +28 -0
- package/dist/html-DL0PcUXX.js +102 -0
- package/dist/http-B9FFNmUr.js +23 -0
- package/dist/image-B77jbMUB.css +46 -0
- package/dist/image-CMZAakWu.js +39 -0
- package/dist/image-heJSlrNv.js +215 -0
- package/dist/index.css +43 -0
- package/dist/index.d.ts +762 -0
- package/dist/index.js +18674 -0
- package/dist/inline-code-CBoqhfz7.js +81 -0
- package/dist/inline-code-Eo65bj3F.css +12 -0
- package/dist/inline-math-B4XO1wMP.js +110 -0
- package/dist/inline-math-DgBjIrPT.css +7 -0
- package/dist/java-iU-L9wJz.js +35 -0
- package/dist/javascript-DtnWdTFC.js +23 -0
- package/dist/jinja-CoWszo_D.js +24 -0
- package/dist/json-C80qKCnh.js +24 -0
- package/dist/julia-DG2BCBLx.js +35 -0
- package/dist/kdl-7twRfIlJ.js +40 -0
- package/dist/kotlin-BjrOgP7R.js +18 -0
- package/dist/latex-DIQfUvG8.js +24 -0
- package/dist/less-BJ1yEAWt.js +24 -0
- package/dist/link-BA_j8di3.css +12 -0
- package/dist/link-DOtoFtxu.js +107 -0
- package/dist/link-DeV4CQOB.js +24 -0
- package/dist/liquid-BqKFZ1wQ.js +24 -0
- package/dist/lisp-oekhB2ti.js +23 -0
- package/dist/list-BCiFKGaz.js +88 -0
- package/dist/list-CcVBNIly.css +11 -0
- package/dist/list-item-Y6Cphjrp.css +15 -0
- package/dist/list-item-p-OLUR_9.js +95 -0
- package/dist/log-D1XEqR9q.js +23 -0
- package/dist/lua-C5Q97-1D.js +28 -0
- package/dist/luau-BT8KwqZ2.js +28 -0
- package/dist/makefile-B4a0ciG4.js +28 -0
- package/dist/markdown-DvNyKsiJ.js +24 -0
- package/dist/marko-BzsIf6bg.js +18 -0
- package/dist/math-Byka28HI.js +110 -0
- package/dist/math-Cq89zpB6.css +11 -0
- package/dist/matlab-cMBkmDhQ.js +28 -0
- package/dist/maximize-4PIqBONS.js +25 -0
- package/dist/mermaid-8JIH2gkQ.js +24 -0
- package/dist/mermaid-C9ZUejzK.css +8 -0
- package/dist/mermaid-X0AFRzfF.js +203 -0
- package/dist/minimize-BJ8htyDF.js +25 -0
- package/dist/modal-CWdgVkH_.css +48 -0
- package/dist/modal-CuQR21UD.js +71 -0
- package/dist/modal-DcpxxDDX.js +3 -0
- package/dist/nextflow-DNmqU1xg.js +24 -0
- package/dist/nginx-DDfYF_rj.js +23 -0
- package/dist/nim-D9xEmy4k.js +24 -0
- package/dist/nix-BV1Deshw.js +18 -0
- package/dist/node-list-C9O-A1aZ.css +11 -0
- package/dist/node-list-CGr_EVtn.js +199 -0
- package/dist/node-list-lgY1wbfQ.js +3 -0
- package/dist/ocaml-BkFn4LL3.js +27 -0
- package/dist/paragraph-DYjqr_Sa.js +83 -0
- package/dist/paragraph-wRNmMYAI.css +6 -0
- package/dist/perl-BytUHDE7.js +24 -0
- package/dist/php-BImJJtNM.js +24 -0
- package/dist/postcss-CrZ9_0sT.js +18 -0
- package/dist/powershell-DYSGu7TM.js +23 -0
- package/dist/previewers-Drlf7IQF.js +10 -0
- package/dist/prisma-BhRvcOFY.js +24 -0
- package/dist/prolog-DuaCKek_.js +24 -0
- package/dist/properties-BbIJwuP-.js +24 -0
- package/dist/proto-CE0aVW11.js +18 -0
- package/dist/pug-B1-IC-Tc.js +24 -0
- package/dist/puppet-8nYquiMG.js +24 -0
- package/dist/python-DhRyfBrD.js +35 -0
- package/dist/r-Cjje17IA.js +28 -0
- package/dist/racket-Dx0gMnpg.js +28 -0
- package/dist/razor-DPht_bdD.js +24 -0
- package/dist/renderer-CZ41eK_V.js +43 -0
- package/dist/ruby-B8RxtCzI.js +24 -0
- package/dist/rust-Cjtli6yf.js +23 -0
- package/dist/sass-Dv3DMzjs.js +24 -0
- package/dist/scala-B7bZGKXq.js +24 -0
- package/dist/scheme-B2PsEdVN.js +24 -0
- package/dist/segmented-BEtO1eyl.js +69 -0
- package/dist/segmented-CWoQcX-H.js +6 -0
- package/dist/segmented-DLmggl-e.css +8 -0
- package/dist/shader-BZzu3zGr.js +24 -0
- package/dist/shiki-CMgjqKKu.css +20 -0
- package/dist/shiki-vToM7Pz1.js +114 -0
- package/dist/solidity-CLieFYpL.js +24 -0
- package/dist/spin-B2FU3Sx6.css +19 -0
- package/dist/spin-Bz4zGBEo.js +3 -0
- package/dist/spin-Ds5W7qC_.js +23 -0
- package/dist/stata-C0yUiO47.js +33 -0
- package/dist/strong-CvOjLZiq.js +83 -0
- package/dist/strong-DpeQmP2J.css +4 -0
- package/dist/svelte-rtF4yNGL.js +23 -0
- package/dist/swift-CzvYoIM0.js +24 -0
- package/dist/table-4ec9FVB_.js +59 -0
- package/dist/table-BWn_kG8W.css +19 -0
- package/dist/table-CJzlDdmv.css +34 -0
- package/dist/table-CZLbUHiJ.js +3 -0
- package/dist/table-DjkiVd9L.js +188 -0
- package/dist/terraform-CD_BZGb-.js +24 -0
- package/dist/text-D098eCyi.css +5 -0
- package/dist/text-D1-vbZ7l.js +23 -0
- package/dist/text-DuONUqRA.js +81 -0
- package/dist/thematic-break-C5zxgoE9.css +6 -0
- package/dist/thematic-break-CcNPEI9Y.js +81 -0
- package/dist/theme.css +67 -0
- package/dist/toml-C6jUF0Xd.js +24 -0
- package/dist/tooltip-Ac_2x9ps.js +4 -0
- package/dist/tooltip-DAngu9Wp.css +5 -0
- package/dist/tooltip-RiXixMIt.js +71 -0
- package/dist/twig-C4dfP84J.js +30 -0
- package/dist/typescript-Bk-pp-cK.js +23 -0
- package/dist/typst-DPCpaVSH.js +24 -0
- package/dist/v-nRGMJ2Ki.js +23 -0
- package/dist/vala-B78bKcY0.js +24 -0
- package/dist/vanilla-BZ8bn5Yz.css +4 -0
- package/dist/vanilla-CA9QO96X.js +3 -0
- package/dist/vanilla-DkX6g0dm.js +87 -0
- package/dist/verilog-CRpkl76S.js +23 -0
- package/dist/vim-DpKnut7b.js +24 -0
- package/dist/vue-D5eadhjo.js +23 -0
- package/dist/xml-Dvx5F-hl.js +24 -0
- package/dist/yaml-DJHrmzSe.js +94 -0
- package/dist/yaml-McBkYbxI.css +5 -0
- package/dist/yaml-n1S8nAOh.js +24 -0
- package/dist/zh-CN-CL1XGe0H.js +27 -0
- package/dist/zig-R-iFzxfW.js +24 -0
- package/dist/zoom-container-BDEP09K9.js +6 -0
- package/dist/zoom-container-BENM7TpV.css +28 -0
- package/dist/zoom-container-BfUO3Ocp.js +113 -0
- package/dist/zoomIn-CEukuh3x.js +28 -0
- package/dist/zoomOut-qlzQyQli.js +28 -0
- package/package.json +115 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
import * as vue18 from "vue";
|
|
2
|
+
import { Component, MaybeRef } from "vue";
|
|
3
|
+
import "tippy.js/dist/tippy.css";
|
|
4
|
+
import "tippy.js/themes/light.css";
|
|
5
|
+
import "tippy.js/dist/border.css";
|
|
6
|
+
import "tippy.js/dist/svg-arrow.css";
|
|
7
|
+
import { Zoom } from "medium-zoom";
|
|
8
|
+
import { MarkdownItAsync } from "markdown-it-async";
|
|
9
|
+
import { KatexOptions as KatexOptions$1 } from "katex";
|
|
10
|
+
import "medium-zoom/dist/style.css";
|
|
11
|
+
import { BuiltinLanguage, BuiltinTheme, BundledLanguage, BundledTheme, CodeToTokensOptions, Highlighter, SpecialLanguage, TokensResult } from "shiki";
|
|
12
|
+
import { Mermaid, MermaidConfig } from "mermaid";
|
|
13
|
+
import { Extension, fromMarkdown } from "mdast-util-from-markdown";
|
|
14
|
+
import { Options as Options$1 } from "mdast-util-to-markdown";
|
|
15
|
+
import { Extension as Extension$1 } from "micromark-util-types";
|
|
16
|
+
import { DefaultProps } from "tippy.js";
|
|
17
|
+
|
|
18
|
+
//#region src/components/previewers/index.d.ts
|
|
19
|
+
declare const CODE_PREVIEWERS: Record<string, Component>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/types/core.d.ts
|
|
22
|
+
type SyntaxTree = ReturnType<typeof fromMarkdown>;
|
|
23
|
+
type ParsedNode = SyntaxTree['children'][number] & {
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
};
|
|
26
|
+
type NodeType = ParsedNode['type'];
|
|
27
|
+
type NodeRenderers = Partial<Record<NodeType, Component>>;
|
|
28
|
+
type BlockquoteNode = Extract<ParsedNode, {
|
|
29
|
+
type: 'blockquote';
|
|
30
|
+
}>;
|
|
31
|
+
type BreakNode = Extract<ParsedNode, {
|
|
32
|
+
type: 'break';
|
|
33
|
+
}>;
|
|
34
|
+
type CodeNode = Extract<ParsedNode, {
|
|
35
|
+
type: 'code';
|
|
36
|
+
}>;
|
|
37
|
+
type DefinitionNode = Extract<ParsedNode, {
|
|
38
|
+
type: 'definition';
|
|
39
|
+
}>;
|
|
40
|
+
type DeleteNode = Extract<ParsedNode, {
|
|
41
|
+
type: 'delete';
|
|
42
|
+
}>;
|
|
43
|
+
type EmphasisNode = Extract<ParsedNode, {
|
|
44
|
+
type: 'emphasis';
|
|
45
|
+
}>;
|
|
46
|
+
type FootnoteDefinitionNode = Extract<ParsedNode, {
|
|
47
|
+
type: 'footnoteDefinition';
|
|
48
|
+
}>;
|
|
49
|
+
type FootnoteReferenceNode = Extract<ParsedNode, {
|
|
50
|
+
type: 'footnoteReference';
|
|
51
|
+
}>;
|
|
52
|
+
type HeadingNode = Extract<ParsedNode, {
|
|
53
|
+
type: 'heading';
|
|
54
|
+
}>;
|
|
55
|
+
type HtmlNode = Extract<ParsedNode, {
|
|
56
|
+
type: 'html';
|
|
57
|
+
}>;
|
|
58
|
+
type ImageNode = Extract<ParsedNode, {
|
|
59
|
+
type: 'image';
|
|
60
|
+
}>;
|
|
61
|
+
type ImageReferenceNode = Extract<ParsedNode, {
|
|
62
|
+
type: 'imageReference';
|
|
63
|
+
}>;
|
|
64
|
+
type InlineCodeNode = Extract<ParsedNode, {
|
|
65
|
+
type: 'inlineCode';
|
|
66
|
+
}>;
|
|
67
|
+
type LinkNode = Extract<ParsedNode, {
|
|
68
|
+
type: 'link';
|
|
69
|
+
}>;
|
|
70
|
+
type LinkReferenceNode = Extract<ParsedNode, {
|
|
71
|
+
type: 'linkReference';
|
|
72
|
+
}>;
|
|
73
|
+
type ListNode = Extract<ParsedNode, {
|
|
74
|
+
type: 'list';
|
|
75
|
+
}>;
|
|
76
|
+
type ListItemNode = Extract<ParsedNode, {
|
|
77
|
+
type: 'listItem';
|
|
78
|
+
}>;
|
|
79
|
+
type ParagraphNode = Extract<ParsedNode, {
|
|
80
|
+
type: 'paragraph';
|
|
81
|
+
}>;
|
|
82
|
+
type StrongNode = Extract<ParsedNode, {
|
|
83
|
+
type: 'strong';
|
|
84
|
+
}>;
|
|
85
|
+
type TableNode = Extract<ParsedNode, {
|
|
86
|
+
type: 'table';
|
|
87
|
+
}>;
|
|
88
|
+
type TableCellNode = Extract<ParsedNode, {
|
|
89
|
+
type: 'tableCell';
|
|
90
|
+
}>;
|
|
91
|
+
type TableRowNode = Extract<ParsedNode, {
|
|
92
|
+
type: 'tableRow';
|
|
93
|
+
}>;
|
|
94
|
+
type TextNode = Extract<ParsedNode, {
|
|
95
|
+
type: 'text';
|
|
96
|
+
}>;
|
|
97
|
+
type ThematicBreakNode = Extract<ParsedNode, {
|
|
98
|
+
type: 'thematicBreak';
|
|
99
|
+
}>;
|
|
100
|
+
type YamlNode = Extract<ParsedNode, {
|
|
101
|
+
type: 'yaml';
|
|
102
|
+
}>;
|
|
103
|
+
type MathNode = Extract<ParsedNode, {
|
|
104
|
+
type: 'math';
|
|
105
|
+
}>;
|
|
106
|
+
type InlineMathNode = Extract<ParsedNode, {
|
|
107
|
+
type: 'inlineMath';
|
|
108
|
+
}>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/types/locale.d.ts
|
|
111
|
+
interface LocaleConfig {
|
|
112
|
+
button: {
|
|
113
|
+
zoomIn: string;
|
|
114
|
+
zoomOut: string;
|
|
115
|
+
resetZoom: string;
|
|
116
|
+
preview: string;
|
|
117
|
+
source: string;
|
|
118
|
+
collapse: string;
|
|
119
|
+
copy: string;
|
|
120
|
+
download: string;
|
|
121
|
+
minimize: string;
|
|
122
|
+
maximize: string;
|
|
123
|
+
};
|
|
124
|
+
error: {
|
|
125
|
+
vanilla: string;
|
|
126
|
+
image: string;
|
|
127
|
+
mermaid: string;
|
|
128
|
+
katex: string;
|
|
129
|
+
harden: string;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/types/context.d.ts
|
|
134
|
+
interface StreamMarkdownProps extends StreamMarkdownContext, MarkdownParserOptions {
|
|
135
|
+
mode?: 'static' | 'streaming';
|
|
136
|
+
content?: string;
|
|
137
|
+
nodeRenderers?: NodeRenderers;
|
|
138
|
+
locale?: string | LocaleConfig;
|
|
139
|
+
}
|
|
140
|
+
interface MarkdownParserOptions {
|
|
141
|
+
mdastOptions?: MdastOptions;
|
|
142
|
+
normalize?: (content: string) => string;
|
|
143
|
+
preprocess?: (content: string) => string;
|
|
144
|
+
postprocess?: (content: SyntaxTree) => SyntaxTree;
|
|
145
|
+
extendMarkdownIt?: (md: MarkdownItAsync) => void;
|
|
146
|
+
}
|
|
147
|
+
interface MdastOptions {
|
|
148
|
+
from?: Extension[];
|
|
149
|
+
to?: Options$1[];
|
|
150
|
+
micromark?: Extension$1[];
|
|
151
|
+
}
|
|
152
|
+
interface StreamMarkdownContext {
|
|
153
|
+
controls?: ControlsConfig;
|
|
154
|
+
previewers?: PreviewerConfig;
|
|
155
|
+
shikiOptions?: ShikiOptions;
|
|
156
|
+
mermaidOptions?: MermaidOptions;
|
|
157
|
+
katexOptions?: KatexOptions;
|
|
158
|
+
hardenOptions?: HardenOptions;
|
|
159
|
+
codeOptions?: CodeOptions;
|
|
160
|
+
imageOptions?: ImageOptions;
|
|
161
|
+
isDark?: boolean;
|
|
162
|
+
}
|
|
163
|
+
type TableControlsConfig = boolean | {
|
|
164
|
+
copy?: boolean | string;
|
|
165
|
+
download?: boolean | string;
|
|
166
|
+
};
|
|
167
|
+
type CodeControlsConfig = boolean | {
|
|
168
|
+
collapse?: boolean;
|
|
169
|
+
copy?: boolean;
|
|
170
|
+
download?: boolean;
|
|
171
|
+
fullscreen?: boolean;
|
|
172
|
+
lineNumbers?: boolean;
|
|
173
|
+
};
|
|
174
|
+
type ImageControlsConfig = boolean | {
|
|
175
|
+
download?: boolean;
|
|
176
|
+
};
|
|
177
|
+
type ZoomControlsConfig = boolean | {
|
|
178
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
179
|
+
};
|
|
180
|
+
type ControlsConfig = boolean | {
|
|
181
|
+
table?: boolean | TableControlsConfig;
|
|
182
|
+
code?: boolean | CodeControlsConfig;
|
|
183
|
+
image?: boolean | ImageControlsConfig;
|
|
184
|
+
mermaid?: boolean | ZoomControlsConfig;
|
|
185
|
+
};
|
|
186
|
+
type PreviewerConfig = boolean | {
|
|
187
|
+
html?: boolean | Component;
|
|
188
|
+
mermaid?: boolean | Component;
|
|
189
|
+
};
|
|
190
|
+
interface ShikiOptions {
|
|
191
|
+
theme?: [BuiltinTheme, BuiltinTheme];
|
|
192
|
+
langAlias?: Record<string, string>;
|
|
193
|
+
codeToTokenOptions?: CodeToTokensOptions<BundledLanguage, BundledTheme>;
|
|
194
|
+
}
|
|
195
|
+
interface MermaidOptions {
|
|
196
|
+
theme?: [string, string];
|
|
197
|
+
config?: MermaidConfig;
|
|
198
|
+
errorComponent?: Component;
|
|
199
|
+
}
|
|
200
|
+
interface KatexOptions {
|
|
201
|
+
config?: KatexOptions$1;
|
|
202
|
+
errorComponent?: Component;
|
|
203
|
+
}
|
|
204
|
+
interface ImageOptions {
|
|
205
|
+
fallback?: string;
|
|
206
|
+
caption?: boolean;
|
|
207
|
+
errorComponent?: Component;
|
|
208
|
+
}
|
|
209
|
+
interface CodeOptions {
|
|
210
|
+
languageIcon?: boolean;
|
|
211
|
+
languageName?: boolean;
|
|
212
|
+
lineNumbers?: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface HardenOptions {
|
|
215
|
+
defaultOrigin?: string;
|
|
216
|
+
allowedLinkPrefixes?: string[];
|
|
217
|
+
allowedImagePrefixes?: string[];
|
|
218
|
+
allowedProtocols?: string[];
|
|
219
|
+
allowDataImages?: boolean;
|
|
220
|
+
errorComponent?: Component;
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/markdown-parser.d.ts
|
|
224
|
+
interface Options extends MarkdownParserOptions {
|
|
225
|
+
mode: 'streaming' | 'static';
|
|
226
|
+
}
|
|
227
|
+
declare class MarkdownParser {
|
|
228
|
+
private mode;
|
|
229
|
+
private md;
|
|
230
|
+
private content;
|
|
231
|
+
private syntaxTree;
|
|
232
|
+
private options;
|
|
233
|
+
constructor(options: Options);
|
|
234
|
+
private update;
|
|
235
|
+
updateMode(mode: 'streaming' | 'static'): void;
|
|
236
|
+
parseMarkdown(content: string): ParsedNode[];
|
|
237
|
+
markdownToHtml(content: string): string;
|
|
238
|
+
markdownToAst(content: string, loading?: boolean): SyntaxTree;
|
|
239
|
+
astToMarkdown(data: SyntaxTree | ParsedNode): string;
|
|
240
|
+
hasLoadingNode(nodes?: ParsedNode[]): boolean;
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/types/renderer.d.ts
|
|
244
|
+
interface NodeRendererListProps extends Omit<NodeRendererProps, 'node' | 'indexKey'> {
|
|
245
|
+
nodes?: ParsedNode[];
|
|
246
|
+
indexKey?: number | string;
|
|
247
|
+
}
|
|
248
|
+
interface NodeRendererProps extends StreamMarkdownContext {
|
|
249
|
+
markdownParser: MarkdownParser;
|
|
250
|
+
nodeRenderers: NodeRenderers;
|
|
251
|
+
node: ParsedNode;
|
|
252
|
+
mediumZoom: Zoom;
|
|
253
|
+
indexKey: number | string;
|
|
254
|
+
getContainer: () => HTMLElement | undefined;
|
|
255
|
+
}
|
|
256
|
+
interface BlockquoteNodeRendererProps extends NodeRendererProps {
|
|
257
|
+
node: BlockquoteNode;
|
|
258
|
+
}
|
|
259
|
+
interface BreakNodeRendererProps extends NodeRendererProps {
|
|
260
|
+
node: BreakNode;
|
|
261
|
+
}
|
|
262
|
+
interface CodeNodeRendererProps extends NodeRendererProps {
|
|
263
|
+
node: CodeNode;
|
|
264
|
+
}
|
|
265
|
+
interface DefinitionNodeRendererProps extends NodeRendererProps {
|
|
266
|
+
node: DefinitionNode;
|
|
267
|
+
}
|
|
268
|
+
interface DeleteNodeRendererProps extends NodeRendererProps {
|
|
269
|
+
node: DeleteNode;
|
|
270
|
+
}
|
|
271
|
+
interface EmphasisNodeRendererProps extends NodeRendererProps {
|
|
272
|
+
node: EmphasisNode;
|
|
273
|
+
}
|
|
274
|
+
interface FootnoteDefinitionNodeRendererProps extends NodeRendererProps {
|
|
275
|
+
node: FootnoteDefinitionNode;
|
|
276
|
+
}
|
|
277
|
+
interface FootnoteReferenceNodeRendererProps extends NodeRendererProps {
|
|
278
|
+
node: FootnoteReferenceNode;
|
|
279
|
+
}
|
|
280
|
+
interface HeadingNodeRendererProps extends NodeRendererProps {
|
|
281
|
+
node: HeadingNode;
|
|
282
|
+
}
|
|
283
|
+
interface HtmlNodeRendererProps extends NodeRendererProps {
|
|
284
|
+
node: HtmlNode;
|
|
285
|
+
}
|
|
286
|
+
interface ImageNodeRendererProps extends NodeRendererProps {
|
|
287
|
+
node: ImageNode;
|
|
288
|
+
}
|
|
289
|
+
interface ImageReferenceNodeRendererProps extends NodeRendererProps {
|
|
290
|
+
node: ImageReferenceNode;
|
|
291
|
+
}
|
|
292
|
+
interface InlineCodeNodeRendererProps extends NodeRendererProps {
|
|
293
|
+
node: InlineCodeNode;
|
|
294
|
+
}
|
|
295
|
+
interface LinkNodeRendererProps extends NodeRendererProps {
|
|
296
|
+
node: LinkNode;
|
|
297
|
+
}
|
|
298
|
+
interface LinkReferenceNodeRendererProps extends NodeRendererProps {
|
|
299
|
+
node: LinkReferenceNode;
|
|
300
|
+
}
|
|
301
|
+
interface ListNodeRendererProps extends NodeRendererProps {
|
|
302
|
+
node: ListNode;
|
|
303
|
+
}
|
|
304
|
+
interface ListItemNodeRendererProps extends NodeRendererProps {
|
|
305
|
+
node: ListItemNode;
|
|
306
|
+
}
|
|
307
|
+
interface ParagraphNodeRendererProps extends NodeRendererProps {
|
|
308
|
+
node: ParagraphNode;
|
|
309
|
+
}
|
|
310
|
+
interface StrongNodeRendererProps extends NodeRendererProps {
|
|
311
|
+
node: StrongNode;
|
|
312
|
+
}
|
|
313
|
+
interface TableNodeRendererProps extends NodeRendererProps {
|
|
314
|
+
node: TableNode;
|
|
315
|
+
}
|
|
316
|
+
interface TableRowNodeRendererProps extends NodeRendererProps {
|
|
317
|
+
node: TableRowNode;
|
|
318
|
+
}
|
|
319
|
+
interface TableCellNodeRendererProps extends NodeRendererProps {
|
|
320
|
+
node: TableCellNode;
|
|
321
|
+
}
|
|
322
|
+
interface TextNodeRendererProps extends NodeRendererProps {
|
|
323
|
+
node: TextNode;
|
|
324
|
+
}
|
|
325
|
+
interface ThematicBreakNodeRendererProps extends NodeRendererProps {
|
|
326
|
+
node: ThematicBreakNode;
|
|
327
|
+
}
|
|
328
|
+
interface YamlNodeRendererProps extends NodeRendererProps {
|
|
329
|
+
node: YamlNode;
|
|
330
|
+
}
|
|
331
|
+
interface MathNodeRendererProps extends NodeRendererProps {
|
|
332
|
+
node: MathNode;
|
|
333
|
+
}
|
|
334
|
+
interface InlineMathNodeRendererProps extends NodeRendererProps {
|
|
335
|
+
node: InlineMathNode;
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/types/shared.d.ts
|
|
339
|
+
interface SelectItem {
|
|
340
|
+
label: string;
|
|
341
|
+
value: string;
|
|
342
|
+
icon?: Component;
|
|
343
|
+
}
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/components/renderers/index.d.ts
|
|
346
|
+
declare const NODE_RENDERERS: NodeRenderers;
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/components/index.d.ts
|
|
349
|
+
declare const COMMON_COMPONENTS: Record<string, Component>;
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/composables/use-context.d.ts
|
|
352
|
+
interface Context {
|
|
353
|
+
isDark?: MaybeRef<boolean>;
|
|
354
|
+
getContainer?: () => HTMLElement | undefined;
|
|
355
|
+
onCopied?: (content: string) => void;
|
|
356
|
+
}
|
|
357
|
+
declare function useContext(): {
|
|
358
|
+
context: Context;
|
|
359
|
+
provideContext: (ctx: Partial<Context>) => void;
|
|
360
|
+
injectContext: () => Context;
|
|
361
|
+
isDark: vue18.ComputedRef<boolean>;
|
|
362
|
+
readonly getContainer: () => HTMLElement | undefined;
|
|
363
|
+
readonly onCopied: (content: string) => void;
|
|
364
|
+
};
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region src/composables/use-controls.d.ts
|
|
367
|
+
interface UseControlsOptions {
|
|
368
|
+
controls: MaybeRef<ControlsConfig | undefined>;
|
|
369
|
+
}
|
|
370
|
+
declare function useControls(options: UseControlsOptions): {
|
|
371
|
+
isControlEnabled: (key: string) => boolean;
|
|
372
|
+
};
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/composables/use-harden-sanitizers.d.ts
|
|
375
|
+
interface UseHardenSanitizersOptions {
|
|
376
|
+
url?: MaybeRef<string | undefined>;
|
|
377
|
+
hardenOptions?: MaybeRef<HardenOptions | undefined>;
|
|
378
|
+
loading?: MaybeRef<boolean | undefined>;
|
|
379
|
+
isImage?: MaybeRef<boolean | undefined>;
|
|
380
|
+
}
|
|
381
|
+
declare function useHardenSanitizers(options: UseHardenSanitizersOptions): {
|
|
382
|
+
hardenOptions: vue18.ComputedRef<HardenOptions>;
|
|
383
|
+
transformHardenUrl: (url: string) => string | null;
|
|
384
|
+
transformedUrl: vue18.ComputedRef<string | null>;
|
|
385
|
+
isHardenUrl: vue18.ComputedRef<boolean>;
|
|
386
|
+
};
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/composables/use-hsl-theme.d.ts
|
|
389
|
+
declare function useHslTheme(): void;
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/composables/use-i18n.d.ts
|
|
392
|
+
declare function useI18n(): {
|
|
393
|
+
t: (key: string) => string;
|
|
394
|
+
};
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/composables/use-katex.d.ts
|
|
397
|
+
declare function useKatex(): {
|
|
398
|
+
installed: vue18.Ref<boolean, boolean>;
|
|
399
|
+
render: (code: string, options?: KatexOptions$1) => Promise<{
|
|
400
|
+
html?: string;
|
|
401
|
+
error?: string;
|
|
402
|
+
}>;
|
|
403
|
+
preload: () => Promise<void>;
|
|
404
|
+
dispose: () => void;
|
|
405
|
+
};
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/composables/use-math-renderer.d.ts
|
|
408
|
+
interface UseMathRendererOptions {
|
|
409
|
+
node: MaybeRef<InlineMathNode | MathNode>;
|
|
410
|
+
katexOptions?: MaybeRef<KatexOptions | undefined>;
|
|
411
|
+
throttle?: MaybeRef<number>;
|
|
412
|
+
}
|
|
413
|
+
declare function useMathRenderer(options: UseMathRendererOptions): {
|
|
414
|
+
html: vue18.Ref<string, string>;
|
|
415
|
+
error: vue18.ComputedRef<boolean>;
|
|
416
|
+
errorMessage: vue18.Ref<string, string>;
|
|
417
|
+
};
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/composables/use-mermaid.d.ts
|
|
420
|
+
interface UseMermaidOptions {
|
|
421
|
+
mermaidOptions?: MaybeRef<MermaidOptions | undefined>;
|
|
422
|
+
isDark?: MaybeRef<boolean>;
|
|
423
|
+
}
|
|
424
|
+
declare function useMermaid(options?: UseMermaidOptions): {
|
|
425
|
+
installed: vue18.Ref<boolean, boolean>;
|
|
426
|
+
getMermaid: () => Promise<Mermaid>;
|
|
427
|
+
parseMermaid: (code: string) => Promise<boolean>;
|
|
428
|
+
renderMermaid: (code: string) => Promise<string | null>;
|
|
429
|
+
saveMermaid: (format: "svg" | "png", code?: string, onError?: (error: Error) => void) => Promise<void>;
|
|
430
|
+
preload: () => Promise<void>;
|
|
431
|
+
dispose: () => void;
|
|
432
|
+
};
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/composables/use-shiki.d.ts
|
|
435
|
+
interface UseShikiOptions {
|
|
436
|
+
lang?: MaybeRef<string>;
|
|
437
|
+
shikiOptions?: MaybeRef<ShikiOptions | undefined>;
|
|
438
|
+
isDark?: MaybeRef<boolean>;
|
|
439
|
+
}
|
|
440
|
+
declare function useShiki(options?: UseShikiOptions): {
|
|
441
|
+
installed: vue18.Ref<boolean, boolean>;
|
|
442
|
+
getHighlighter: () => Promise<Highlighter>;
|
|
443
|
+
codeToTokens: (code: string) => Promise<TokensResult>;
|
|
444
|
+
preload: () => Promise<void>;
|
|
445
|
+
dispose: () => void;
|
|
446
|
+
};
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/composables/use-tippy.d.ts
|
|
449
|
+
interface UseTippyOptions {
|
|
450
|
+
isDark?: MaybeRef<boolean>;
|
|
451
|
+
options?: MaybeRef<DefaultProps>;
|
|
452
|
+
}
|
|
453
|
+
declare function useTippy(options?: UseTippyOptions): {
|
|
454
|
+
initTippy: () => void;
|
|
455
|
+
};
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/composables/use-zoom.d.ts
|
|
458
|
+
interface UseZoomOptions {
|
|
459
|
+
minZoom?: number;
|
|
460
|
+
maxZoom?: number;
|
|
461
|
+
zoomStep?: number;
|
|
462
|
+
wheelSensitivity?: number;
|
|
463
|
+
initialZoom?: number;
|
|
464
|
+
initialTranslateX?: number;
|
|
465
|
+
initialTranslateY?: number;
|
|
466
|
+
}
|
|
467
|
+
interface ZoomPanState {
|
|
468
|
+
zoom: number;
|
|
469
|
+
translateX: number;
|
|
470
|
+
translateY: number;
|
|
471
|
+
}
|
|
472
|
+
declare function useZoom(options?: UseZoomOptions): {
|
|
473
|
+
zoom: vue18.Ref<number, number>;
|
|
474
|
+
translateX: vue18.Ref<number, number>;
|
|
475
|
+
translateY: vue18.Ref<number, number>;
|
|
476
|
+
isDragging: vue18.Ref<boolean, boolean>;
|
|
477
|
+
transformStyle: vue18.ComputedRef<{
|
|
478
|
+
transform: string;
|
|
479
|
+
}>;
|
|
480
|
+
zoomIn: () => void;
|
|
481
|
+
zoomOut: () => void;
|
|
482
|
+
resetZoom: () => void;
|
|
483
|
+
setZoom: (value: number) => void;
|
|
484
|
+
startDrag: (e: MouseEvent | TouchEvent) => void;
|
|
485
|
+
onDrag: (e: MouseEvent | TouchEvent) => void;
|
|
486
|
+
stopDrag: () => void;
|
|
487
|
+
handleWheel: (event: WheelEvent, containerElement: HTMLElement) => void;
|
|
488
|
+
getState: () => ZoomPanState;
|
|
489
|
+
setState: (state: Partial<ZoomPanState>) => void;
|
|
490
|
+
};
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/constants/code.d.ts
|
|
493
|
+
declare const DEFAULT_LIGHT_THEME = "github-light";
|
|
494
|
+
declare const DEFAULT_DARK_THEME = "github-dark";
|
|
495
|
+
declare const LANGUAGE_ALIAS: Record<string, BuiltinLanguage>;
|
|
496
|
+
declare const LANGUAGE_EXTENSIONS: Partial<Record<BuiltinLanguage, string>>;
|
|
497
|
+
declare const LANGUAGE_ICONS: Partial<Record<BuiltinLanguage | SpecialLanguage, Component>>;
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/constants/harden.d.ts
|
|
500
|
+
declare const DEFAULT_HARDEN_OPTIONS: HardenOptions;
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/constants/icons.d.ts
|
|
503
|
+
declare const ICONS: Record<string, Component>;
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/index.vue.d.ts
|
|
506
|
+
declare const __VLS_export: vue18.DefineComponent<StreamMarkdownProps, {
|
|
507
|
+
getMarkdownParser: () => MarkdownParser;
|
|
508
|
+
getParsedNodes: () => ParsedNode[];
|
|
509
|
+
}, {}, {}, {}, vue18.ComponentOptionsMixin, vue18.ComponentOptionsMixin, {} & {
|
|
510
|
+
copied: (content: string) => any;
|
|
511
|
+
}, string, vue18.PublicProps, Readonly<StreamMarkdownProps> & Readonly<{
|
|
512
|
+
onCopied?: ((content: string) => any) | undefined;
|
|
513
|
+
}>, {
|
|
514
|
+
mode: "static" | "streaming";
|
|
515
|
+
content: string;
|
|
516
|
+
nodeRenderers: Partial<Record<"blockquote" | "break" | "code" | "definition" | "delete" | "emphasis" | "footnoteDefinition" | "footnoteReference" | "heading" | "html" | "image" | "imageReference" | "inlineCode" | "link" | "linkReference" | "list" | "listItem" | "paragraph" | "strong" | "table" | "tableCell" | "tableRow" | "text" | "thematicBreak" | "yaml" | "inlineMath" | "math", vue18.Component>>;
|
|
517
|
+
locale: string | LocaleConfig;
|
|
518
|
+
controls: ControlsConfig;
|
|
519
|
+
previewers: PreviewerConfig;
|
|
520
|
+
isDark: boolean;
|
|
521
|
+
}, {}, {}, {}, string, vue18.ComponentProvideOptions, false, {}, any>;
|
|
522
|
+
declare const _default: typeof __VLS_export;
|
|
523
|
+
//#endregion
|
|
524
|
+
//#region src/locales/index.d.ts
|
|
525
|
+
declare const SUPPORT_LANGUAGES: string[];
|
|
526
|
+
declare const localesGlob: Record<string, () => Promise<unknown>>;
|
|
527
|
+
declare const localeMessages: vue18.Ref<LocaleConfig | undefined, LocaleConfig | undefined>;
|
|
528
|
+
declare const currentLocale: vue18.Ref<string, string>;
|
|
529
|
+
declare function loadLocaleMessages(language: string | LocaleConfig): Promise<void>;
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/postprocess/text.d.ts
|
|
532
|
+
declare function postFixText(data: SyntaxTree): SyntaxTree;
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/postprocess/index.d.ts
|
|
535
|
+
declare function postprocess(data: SyntaxTree): SyntaxTree;
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/preprocess/code.d.ts
|
|
538
|
+
/**
|
|
539
|
+
* Fix unclosed code syntax in streaming markdown
|
|
540
|
+
*
|
|
541
|
+
* Handles two types of code syntax:
|
|
542
|
+
* 1. Inline code: `code` (single backticks)
|
|
543
|
+
* 2. Code blocks: ```language\ncode\n``` (triple backticks)
|
|
544
|
+
*
|
|
545
|
+
* Only processes the last paragraph (content after the last blank line) for inline code.
|
|
546
|
+
* Code blocks can span multiple paragraphs, so they are processed globally.
|
|
547
|
+
*
|
|
548
|
+
* @param content - Markdown content (potentially incomplete in stream mode)
|
|
549
|
+
* @returns Content with auto-completed code syntax if needed
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* fixCode('Hello `world')
|
|
553
|
+
* // Returns: 'Hello `world`'
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* fixCode('```javascript\nconst x = 1')
|
|
557
|
+
* // Returns: '```javascript\nconst x = 1\n```'
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* fixCode('`')
|
|
561
|
+
* // Returns: '' (no completion, ` has no content)
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* fixCode('```')
|
|
565
|
+
* // Returns: '```' (no completion, code block has no content)
|
|
566
|
+
*/
|
|
567
|
+
declare function fixCode(content: string): string;
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region src/preprocess/delete.d.ts
|
|
570
|
+
/**
|
|
571
|
+
* Fix unclosed strikethrough (~~) syntax in streaming markdown
|
|
572
|
+
*
|
|
573
|
+
* Only processes the last paragraph (content after the last blank line).
|
|
574
|
+
* This respects Markdown's rule that ~~ cannot span across paragraphs.
|
|
575
|
+
*
|
|
576
|
+
* @param content - Markdown content (potentially incomplete in stream mode)
|
|
577
|
+
* @returns Content with auto-completed ~~ if needed
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* fixDelete('Hello ~~world')
|
|
581
|
+
* // Returns: 'Hello ~~world~~'
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* fixDelete('Para1 ~~deleted~~\n\nPara2 ~~text')
|
|
585
|
+
* // Returns: 'Para1 ~~deleted~~\n\nPara2 ~~text~~'
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* fixDelete('List item\n\n~~')
|
|
589
|
+
* // Returns: 'List item\n\n~~' (no completion, ~~ has no content)
|
|
590
|
+
*/
|
|
591
|
+
declare function fixDelete(content: string): string;
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/preprocess/emphasis.d.ts
|
|
594
|
+
/**
|
|
595
|
+
* Fix unclosed emphasis (* or _) syntax in streaming markdown
|
|
596
|
+
*
|
|
597
|
+
* Only processes the last paragraph (content after the last blank line).
|
|
598
|
+
* This respects Markdown's rule that emphasis cannot span across paragraphs.
|
|
599
|
+
*/
|
|
600
|
+
declare function fixEmphasis(content: string): string;
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/preprocess/link.d.ts
|
|
603
|
+
/**
|
|
604
|
+
* Fix unclosed link/image syntax in streaming markdown
|
|
605
|
+
*
|
|
606
|
+
* Link syntax: [text](url "title")
|
|
607
|
+
* Image syntax: 
|
|
608
|
+
*
|
|
609
|
+
* Only processes the last paragraph (content after the last blank line).
|
|
610
|
+
* This respects Markdown's rule that links cannot span across paragraphs.
|
|
611
|
+
*
|
|
612
|
+
* @param content - Markdown content (potentially incomplete in stream mode)
|
|
613
|
+
* @returns Content with auto-completed link/image syntax if needed
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* fixLink('[Google](https://www.goo')
|
|
617
|
+
* // Returns: '[Google](https://www.goo)'
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* fixLink('[text](')
|
|
621
|
+
* // Returns: '[text]()'
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* fixLink('[text]')
|
|
625
|
+
* // Returns: '[text]()'
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* fixLink('[text')
|
|
629
|
+
* // Returns: '[text]()'
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* fixLink('
|
|
633
|
+
* // Returns: ''
|
|
634
|
+
*/
|
|
635
|
+
declare function fixLink(content: string): string;
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region src/preprocess/strong.d.ts
|
|
638
|
+
/**
|
|
639
|
+
* Fix unclosed strong (** or __) syntax in streaming markdown
|
|
640
|
+
*
|
|
641
|
+
* Only processes the last paragraph (content after the last blank line).
|
|
642
|
+
* This respects Markdown's rule that strong formatting cannot span across paragraphs.
|
|
643
|
+
*
|
|
644
|
+
* @param content - Markdown content (potentially incomplete in stream mode)
|
|
645
|
+
* @returns Content with auto-completed ** or __ if needed
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* fixStrong('Hello **world')
|
|
649
|
+
* // Returns: 'Hello **world**'
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* fixStrong('Hello __world')
|
|
653
|
+
* // Returns: 'Hello __world__'
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* fixStrong('Para1 **bold**\n\nPara2 **text')
|
|
657
|
+
* // Returns: 'Para1 **bold**\n\nPara2 **text**'
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* fixStrong('List item\n\n**')
|
|
661
|
+
* // Returns: 'List item\n\n**' (no completion, ** has no content)
|
|
662
|
+
*/
|
|
663
|
+
declare function fixStrong(content: string): string;
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/preprocess/table.d.ts
|
|
666
|
+
/**
|
|
667
|
+
* Fix incomplete table syntax in streaming markdown
|
|
668
|
+
*
|
|
669
|
+
* Handles markdown tables by detecting the header row and ensuring
|
|
670
|
+
* a separator row exists. Only processes the last paragraph for streaming.
|
|
671
|
+
*
|
|
672
|
+
* Table format:
|
|
673
|
+
* | Header 1 | Header 2 |
|
|
674
|
+
* | -------- | -------- |
|
|
675
|
+
* | Cell 1 | Cell 2 |
|
|
676
|
+
*
|
|
677
|
+
* @param content - Markdown content (potentially incomplete in stream mode)
|
|
678
|
+
* @returns Content with auto-completed table separator if needed
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* fixTable('| a | b |\n')
|
|
682
|
+
* // Returns: '| a | b |\n| --- | --- |'
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* fixTable('| a | b |\n| ---')
|
|
686
|
+
* // Returns: '| a | b |\n| --- | --- |'
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* fixTable('| a | b |\n| --- | --- |')
|
|
690
|
+
* // Returns: '| a | b |\n| --- | --- |' (no change, already complete)
|
|
691
|
+
*/
|
|
692
|
+
declare function fixTable(content: string): string;
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/preprocess/vendored/markdown-utils.d.ts
|
|
695
|
+
declare function preprocessLaTeX(content: string): string;
|
|
696
|
+
declare function preprocessThinkTag(content: string): string;
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/preprocess/vendored/parse-incomplete-markdown.d.ts
|
|
699
|
+
declare function parseIncompleteMarkdown(text: string): string;
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region src/preprocess/pattern.d.ts
|
|
702
|
+
declare const crlfPattern: RegExp;
|
|
703
|
+
declare const trailingBackticksPattern: RegExp;
|
|
704
|
+
declare const codeBlockPattern: RegExp;
|
|
705
|
+
declare const singleBacktickPattern: RegExp;
|
|
706
|
+
declare const tripleBacktickPattern: RegExp;
|
|
707
|
+
declare const trailingWhitespacePattern: RegExp;
|
|
708
|
+
declare const doubleAsteriskPattern: RegExp;
|
|
709
|
+
declare const singleAsteriskPattern: RegExp;
|
|
710
|
+
declare const doubleUnderscorePattern: RegExp;
|
|
711
|
+
declare const singleUnderscorePattern: RegExp;
|
|
712
|
+
declare const doubleTildePattern: RegExp;
|
|
713
|
+
declare const doubleDollarPattern: RegExp;
|
|
714
|
+
declare const incompleteBracketPattern: RegExp;
|
|
715
|
+
declare const incompleteLinkTextPattern: RegExp;
|
|
716
|
+
declare const incompleteUrlPattern: RegExp;
|
|
717
|
+
declare const tableRowPattern: RegExp;
|
|
718
|
+
declare const separatorPattern: RegExp;
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/preprocess/index.d.ts
|
|
721
|
+
declare function proprocessContent(content: string): string;
|
|
722
|
+
declare function normalize(content: string): string;
|
|
723
|
+
declare function preprocess(content: string): string;
|
|
724
|
+
//#endregion
|
|
725
|
+
//#region src/utils/harden.d.ts
|
|
726
|
+
declare function transformUrl(url: unknown, allowedPrefixes: string[], defaultOrigin: string, allowDataImages?: boolean, isImage?: boolean, allowedProtocols?: string[]): string | null;
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region src/utils/helper.d.ts
|
|
729
|
+
declare function flow<T>(fns: Array<(arg: T) => T>): (arg: T) => T;
|
|
730
|
+
declare function save(filename: string, content: string | Blob, mimeType: string): void;
|
|
731
|
+
declare function svgToPngBlob(svgString: string, options?: {
|
|
732
|
+
scale?: number;
|
|
733
|
+
}): Promise<Blob>;
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/utils/module.d.ts
|
|
736
|
+
declare function hasShiki(): Promise<boolean>;
|
|
737
|
+
declare function hasMermaid(): Promise<boolean>;
|
|
738
|
+
declare function hasKatex(): Promise<boolean>;
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/utils/parser.d.ts
|
|
741
|
+
declare function findLastLeafNode(nodes: ParsedNode[]): ParsedNode | null;
|
|
742
|
+
declare function findNodeParent(targetNode: ParsedNode, nodes: ParsedNode[], parent?: {
|
|
743
|
+
children: ParsedNode[];
|
|
744
|
+
}): {
|
|
745
|
+
parent: {
|
|
746
|
+
children: ParsedNode[];
|
|
747
|
+
};
|
|
748
|
+
index: number;
|
|
749
|
+
} | null;
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/utils/table.d.ts
|
|
752
|
+
interface TableData {
|
|
753
|
+
headers: string[];
|
|
754
|
+
rows: string[][];
|
|
755
|
+
}
|
|
756
|
+
declare function extractTableDataFromElement(tableElement: HTMLElement): TableData;
|
|
757
|
+
declare function tableDataToCSV(data: TableData): string;
|
|
758
|
+
declare function tableDataToTSV(data: TableData): string;
|
|
759
|
+
declare function escapeMarkdownTableCell(cell: string): string;
|
|
760
|
+
declare function tableDataToMarkdown(data: TableData): string;
|
|
761
|
+
//#endregion
|
|
762
|
+
export { BlockquoteNode, BlockquoteNodeRendererProps, BreakNode, BreakNodeRendererProps, CODE_PREVIEWERS, COMMON_COMPONENTS, CodeControlsConfig, CodeNode, CodeNodeRendererProps, CodeOptions, ControlsConfig, DEFAULT_DARK_THEME, DEFAULT_HARDEN_OPTIONS, DEFAULT_LIGHT_THEME, DefinitionNode, DefinitionNodeRendererProps, DeleteNode, DeleteNodeRendererProps, EmphasisNode, EmphasisNodeRendererProps, FootnoteDefinitionNode, FootnoteDefinitionNodeRendererProps, FootnoteReferenceNode, FootnoteReferenceNodeRendererProps, HardenOptions, HeadingNode, HeadingNodeRendererProps, HtmlNode, HtmlNodeRendererProps, ICONS, ImageControlsConfig, ImageNode, ImageNodeRendererProps, ImageOptions, ImageReferenceNode, ImageReferenceNodeRendererProps, InlineCodeNode, InlineCodeNodeRendererProps, InlineMathNode, InlineMathNodeRendererProps, KatexOptions, LANGUAGE_ALIAS, LANGUAGE_EXTENSIONS, LANGUAGE_ICONS, LinkNode, LinkNodeRendererProps, LinkReferenceNode, LinkReferenceNodeRendererProps, ListItemNode, ListItemNodeRendererProps, ListNode, ListNodeRendererProps, LocaleConfig, _default as Markdown, MarkdownParser, MarkdownParserOptions, MathNode, MathNodeRendererProps, MdastOptions, MermaidOptions, NODE_RENDERERS, NodeRendererListProps, NodeRendererProps, NodeRenderers, NodeType, Options, ParagraphNode, ParagraphNodeRendererProps, ParsedNode, PreviewerConfig, SUPPORT_LANGUAGES, SelectItem, ShikiOptions, StreamMarkdownContext, StreamMarkdownProps, StrongNode, StrongNodeRendererProps, SyntaxTree, TableCellNode, TableCellNodeRendererProps, TableControlsConfig, TableData, TableNode, TableNodeRendererProps, TableRowNode, TableRowNodeRendererProps, TextNode, TextNodeRendererProps, ThematicBreakNode, ThematicBreakNodeRendererProps, UseMathRendererOptions, UseZoomOptions, YamlNode, YamlNodeRendererProps, ZoomControlsConfig, ZoomPanState, codeBlockPattern, crlfPattern, currentLocale, doubleAsteriskPattern, doubleDollarPattern, doubleTildePattern, doubleUnderscorePattern, escapeMarkdownTableCell, extractTableDataFromElement, findLastLeafNode, findNodeParent, fixCode, fixDelete, fixEmphasis, fixLink, fixStrong, fixTable, flow, hasKatex, hasMermaid, hasShiki, incompleteBracketPattern, incompleteLinkTextPattern, incompleteUrlPattern, loadLocaleMessages, localeMessages, localesGlob, normalize, parseIncompleteMarkdown, postFixText, postprocess, preprocess, preprocessLaTeX, preprocessThinkTag, proprocessContent, save, separatorPattern, singleAsteriskPattern, singleBacktickPattern, singleUnderscorePattern, svgToPngBlob, tableDataToCSV, tableDataToMarkdown, tableDataToTSV, tableRowPattern, trailingBackticksPattern, trailingWhitespacePattern, transformUrl, tripleBacktickPattern, useContext, useControls, useHardenSanitizers, useHslTheme, useI18n, useKatex, useMathRenderer, useMermaid, useShiki, useTippy, useZoom };
|