markstream-vue2 0.0.26 → 0.0.28
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 +8 -0
- package/dist/chunks/{cssMode-2e2be6eb.cjs → cssMode-86e8d6e4.cjs} +1 -1
- package/dist/chunks/{htmlMode-b62439a8.cjs → htmlMode-f84c7583.cjs} +1 -1
- package/dist/chunks/index.legacy-70f0e155.cjs +1 -0
- package/dist/chunks/{jsonMode-bb4aa400.cjs → jsonMode-e60229b9.cjs} +1 -1
- package/dist/chunks/{tsMode-1535ecd2.cjs → tsMode-5b9a0ba1.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +65 -2328
- package/dist/index.js +515 -75
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/AdmonitionNode/AdmonitionNode.vue.d.ts +33 -0
- package/dist/types/components/AdmonitionNode/index.d.ts +2 -0
- package/dist/types/components/BlockquoteNode/BlockquoteNode.vue.d.ts +28 -0
- package/dist/types/components/BlockquoteNode/index.d.ts +2 -0
- package/dist/types/components/CheckboxNode/CheckboxNode.vue.d.ts +18 -0
- package/dist/types/components/CheckboxNode/index.d.ts +2 -0
- package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +210 -0
- package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.vue.d.ts +17 -0
- package/dist/types/components/CodeBlockNode/index.d.ts +2 -0
- package/dist/types/components/CodeBlockNode/monaco.d.ts +1 -0
- package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +3 -0
- package/dist/types/components/D2BlockNode/D2BlockNode.vue.d.ts +66 -0
- package/dist/types/components/D2BlockNode/d2.d.ts +6 -0
- package/dist/types/components/D2BlockNode/index.d.ts +2 -0
- package/dist/types/components/DefinitionListNode/DefinitionListNode.vue.d.ts +36 -0
- package/dist/types/components/DefinitionListNode/index.d.ts +2 -0
- package/dist/types/components/EmojiNode/EmojiNode.vue.d.ts +19 -0
- package/dist/types/components/EmojiNode/index.d.ts +2 -0
- package/dist/types/components/EmphasisNode/EmphasisNode.vue.d.ts +25 -0
- package/dist/types/components/EmphasisNode/index.d.ts +2 -0
- package/dist/types/components/FootnoteAnchorNode/FootnoteAnchorNode.vue.d.ts +18 -0
- package/dist/types/components/FootnoteAnchorNode/index.d.ts +2 -0
- package/dist/types/components/FootnoteNode/FootnoteNode.vue.d.ts +28 -0
- package/dist/types/components/FootnoteNode/index.d.ts +2 -0
- package/dist/types/components/FootnoteReferenceNode/FootnoteReferenceNode.vue.d.ts +19 -0
- package/dist/types/components/FootnoteReferenceNode/index.d.ts +2 -0
- package/dist/types/components/HardBreakNode/HardBreakNode.vue.d.ts +18 -0
- package/dist/types/components/HardBreakNode/index.d.ts +2 -0
- package/dist/types/components/HeadingNode/HeadingNode.vue.d.ts +28 -0
- package/dist/types/components/HeadingNode/index.d.ts +2 -0
- package/dist/types/components/HighlightNode/HighlightNode.vue.d.ts +25 -0
- package/dist/types/components/HighlightNode/index.d.ts +2 -0
- package/dist/types/components/HtmlBlockNode/HtmlBlockNode.vue.d.ts +42 -0
- package/dist/types/components/HtmlBlockNode/index.d.ts +2 -0
- package/dist/types/components/HtmlInlineNode/HtmlInlineNode.vue.d.ts +21 -0
- package/dist/types/components/HtmlInlineNode/index.d.ts +2 -0
- package/dist/types/components/ImageNode/ImageNode.vue.d.ts +104 -0
- package/dist/types/components/ImageNode/index.d.ts +2 -0
- package/dist/types/components/InfographicBlockNode/InfographicBlockNode.vue.d.ts +86 -0
- package/dist/types/components/InfographicBlockNode/index.d.ts +2 -0
- package/dist/types/components/InfographicBlockNode/infographic.d.ts +1 -0
- package/dist/types/components/InlineCodeNode/InlineCodeNode.vue.d.ts +18 -0
- package/dist/types/components/InlineCodeNode/index.d.ts +2 -0
- package/dist/types/components/InsertNode/InsertNode.vue.d.ts +25 -0
- package/dist/types/components/InsertNode/index.d.ts +2 -0
- package/dist/types/components/LinkNode/LinkNode.vue.d.ts +49 -0
- package/dist/types/components/LinkNode/index.d.ts +2 -0
- package/dist/types/components/ListItemNode/ListItemNode.vue.d.ts +30 -0
- package/dist/types/components/ListItemNode/index.d.ts +2 -0
- package/dist/types/components/ListNode/ListNode.vue.d.ts +36 -0
- package/dist/types/components/ListNode/index.d.ts +2 -0
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +193 -0
- package/dist/types/components/MarkdownCodeBlockNode/index.d.ts +2 -0
- package/dist/types/components/MarkdownRenderCompat.vue.d.ts +94 -0
- package/dist/types/components/MathBlockNode/MathBlockNode.vue.d.ts +20 -0
- package/dist/types/components/MathBlockNode/index.d.ts +2 -0
- package/dist/types/components/MathInlineNode/MathInlineNode.vue.d.ts +40 -0
- package/dist/types/components/MathInlineNode/index.d.ts +2 -0
- package/dist/types/components/MathInlineNode/katex.d.ts +6 -0
- package/dist/types/components/MermaidBlockNode/MermaidBlockNode.vue.d.ts +134 -0
- package/dist/types/components/MermaidBlockNode/index.d.ts +2 -0
- package/dist/types/components/MermaidBlockNode/mermaid.d.ts +6 -0
- package/dist/types/components/NestedRenderer/NestedRenderer.vue.d.ts +30 -0
- package/dist/types/components/NestedRenderer/index.d.ts +2 -0
- package/dist/types/components/NodeRenderer/FallbackComponent.vue.d.ts +16 -0
- package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +53 -0
- package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +139 -0
- package/dist/types/components/NodeRenderer/asyncComponent.d.ts +2 -0
- package/dist/types/components/NodeRenderer/index.d.ts +2 -0
- package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +1 -0
- package/dist/types/components/ParagraphNode/ParagraphNode.vue.d.ts +25 -0
- package/dist/types/components/ParagraphNode/index.d.ts +2 -0
- package/dist/types/components/Portal/Portal.vue.d.ts +31 -0
- package/dist/types/components/Portal/index.d.ts +2 -0
- package/dist/types/components/PreCodeNode/PreCodeNode.vue.d.ts +14 -0
- package/dist/types/components/PreCodeNode/index.d.ts +2 -0
- package/dist/types/components/ReferenceNode/ReferenceNode.vue.d.ts +24 -0
- package/dist/types/components/ReferenceNode/index.d.ts +2 -0
- package/dist/types/components/StrikethroughNode/StrikethroughNode.vue.d.ts +25 -0
- package/dist/types/components/StrikethroughNode/index.d.ts +2 -0
- package/dist/types/components/StrongNode/StrongNode.vue.d.ts +25 -0
- package/dist/types/components/StrongNode/index.d.ts +2 -0
- package/dist/types/components/SubscriptNode/SubscriptNode.vue.d.ts +25 -0
- package/dist/types/components/SubscriptNode/index.d.ts +2 -0
- package/dist/types/components/SuperscriptNode/SuperscriptNode.vue.d.ts +25 -0
- package/dist/types/components/SuperscriptNode/index.d.ts +2 -0
- package/dist/types/components/TableNode/TableNode.vue.d.ts +59 -0
- package/dist/types/components/TableNode/index.d.ts +2 -0
- package/dist/types/components/TextNode/TextNode.vue.d.ts +21 -0
- package/dist/types/components/TextNode/index.d.ts +2 -0
- package/dist/types/components/TextNode/streamingTextState.d.ts +11 -0
- package/dist/types/components/ThematicBreakNode/ThematicBreakNode.vue.d.ts +2 -0
- package/dist/types/components/ThematicBreakNode/index.d.ts +2 -0
- package/dist/types/components/Tooltip/Tooltip.vue.d.ts +22 -0
- package/dist/types/components/Tooltip/index.d.ts +2 -0
- package/dist/types/components/VmrContainerNode/VmrContainerNode.vue.d.ts +28 -0
- package/dist/types/components/VmrContainerNode/index.d.ts +2 -0
- package/dist/types/composables/useKatexReady.d.ts +1 -0
- package/dist/types/composables/useSafeI18n.d.ts +10 -0
- package/dist/types/composables/useSingletonTooltip.d.ts +14 -0
- package/dist/types/composables/viewportPriority.d.ts +20 -0
- package/dist/types/exports.d.ts +70 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/tailwind-entry.d.ts +2 -0
- package/dist/types/types/component-props.d.ts +210 -0
- package/dist/types/types/index.d.ts +271 -0
- package/dist/types/utils/htmlRenderer.d.ts +43 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/katex-threshold.d.ts +20 -0
- package/dist/types/utils/languageIcon.d.ts +8 -0
- package/dist/types/utils/languageIconExtended.d.ts +1 -0
- package/dist/types/utils/mathRenderCache.d.ts +7 -0
- package/dist/types/utils/nestedHtml.d.ts +19 -0
- package/dist/types/utils/nestedNodes.d.ts +14 -0
- package/dist/types/utils/nodeComponents.d.ts +20 -0
- package/dist/types/utils/performance-monitor.d.ts +121 -0
- package/dist/types/utils/safeRaf.d.ts +2 -0
- package/dist/types/utils/vue26.d.ts +8 -0
- package/dist/types/workers/katexCdnWorker.d.ts +52 -0
- package/dist/types/workers/katexRenderer.worker.d.ts +0 -0
- package/dist/types/workers/katexWorkerClient.d.ts +48 -0
- package/dist/types/workers/mermaidCdnWorker.d.ts +35 -0
- package/dist/types/workers/mermaidParser.worker.d.ts +1 -0
- package/dist/types/workers/mermaidWorkerClient.d.ts +21 -0
- package/package.json +2 -2
- package/dist/chunks/index.legacy-bcde4164.cjs +0 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { CodeBlockNode } from 'stream-markdown-parser';
|
|
2
|
+
export interface CodeBlockMonacoThemeObject {
|
|
3
|
+
name: string;
|
|
4
|
+
base?: string;
|
|
5
|
+
inherit?: boolean;
|
|
6
|
+
colors?: Record<string, string>;
|
|
7
|
+
rules?: Array<Record<string, unknown>>;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export type CodeBlockMonacoTheme = string | CodeBlockMonacoThemeObject;
|
|
11
|
+
export type CodeBlockMonacoLanguage = string | ((...args: any[]) => unknown);
|
|
12
|
+
export interface CodeBlockDiffHideUnchangedRegionsOptions {
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
contextLineCount?: number;
|
|
15
|
+
minimumLineCount?: number;
|
|
16
|
+
revealLineCount?: number;
|
|
17
|
+
}
|
|
18
|
+
export type CodeBlockDiffHideUnchangedRegions = boolean | CodeBlockDiffHideUnchangedRegionsOptions;
|
|
19
|
+
export type CodeBlockDiffLineStyle = 'background' | 'bar';
|
|
20
|
+
export type CodeBlockDiffAppearance = 'auto' | 'light' | 'dark';
|
|
21
|
+
export type CodeBlockDiffUnchangedRegionStyle = 'line-info' | 'line-info-basic' | 'metadata' | 'simple';
|
|
22
|
+
export type CodeBlockDiffHunkActionKind = 'revert' | 'stage';
|
|
23
|
+
export type CodeBlockDiffHunkSide = 'upper' | 'lower';
|
|
24
|
+
export interface CodeBlockDiffHunkActionContext {
|
|
25
|
+
action: CodeBlockDiffHunkActionKind;
|
|
26
|
+
side: CodeBlockDiffHunkSide;
|
|
27
|
+
lineChange: unknown;
|
|
28
|
+
originalModel: unknown;
|
|
29
|
+
modifiedModel: unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface CodeBlockMonacoOptions {
|
|
32
|
+
MAX_HEIGHT?: number | string;
|
|
33
|
+
fontSize?: number;
|
|
34
|
+
lineHeight?: number;
|
|
35
|
+
fontFamily?: string;
|
|
36
|
+
tabSize?: number;
|
|
37
|
+
readOnly?: boolean;
|
|
38
|
+
wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded' | string;
|
|
39
|
+
wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent' | string;
|
|
40
|
+
theme?: string;
|
|
41
|
+
themes?: CodeBlockMonacoTheme[];
|
|
42
|
+
languages?: CodeBlockMonacoLanguage[];
|
|
43
|
+
renderSideBySide?: boolean;
|
|
44
|
+
enableSplitViewResizing?: boolean;
|
|
45
|
+
ignoreTrimWhitespace?: boolean;
|
|
46
|
+
maxComputationTime?: number;
|
|
47
|
+
diffAlgorithm?: string;
|
|
48
|
+
renderIndicators?: boolean;
|
|
49
|
+
originalEditable?: boolean;
|
|
50
|
+
revealDebounceMs?: number;
|
|
51
|
+
revealStrategy?: 'bottom' | 'centerIfOutside' | 'center';
|
|
52
|
+
revealBatchOnIdleMs?: number;
|
|
53
|
+
updateThrottleMs?: number;
|
|
54
|
+
diffUpdateThrottleMs?: number;
|
|
55
|
+
diffAutoScroll?: boolean;
|
|
56
|
+
diffHideUnchangedRegions?: CodeBlockDiffHideUnchangedRegions;
|
|
57
|
+
diffLineStyle?: CodeBlockDiffLineStyle;
|
|
58
|
+
diffAppearance?: CodeBlockDiffAppearance;
|
|
59
|
+
diffUnchangedRegionStyle?: CodeBlockDiffUnchangedRegionStyle;
|
|
60
|
+
diffHunkActionsOnHover?: boolean;
|
|
61
|
+
diffHunkHoverHideDelayMs?: number;
|
|
62
|
+
onDiffHunkAction?: (context: CodeBlockDiffHunkActionContext) => void | boolean | Promise<void | boolean>;
|
|
63
|
+
scrollbar?: Record<string, any>;
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
}
|
|
66
|
+
export interface CodeBlockNodeProps {
|
|
67
|
+
node: CodeBlockNode;
|
|
68
|
+
isDark?: boolean;
|
|
69
|
+
loading?: boolean;
|
|
70
|
+
stream?: boolean;
|
|
71
|
+
darkTheme?: CodeBlockMonacoTheme;
|
|
72
|
+
lightTheme?: CodeBlockMonacoTheme;
|
|
73
|
+
isShowPreview?: boolean;
|
|
74
|
+
monacoOptions?: CodeBlockMonacoOptions;
|
|
75
|
+
enableFontSizeControl?: boolean;
|
|
76
|
+
minWidth?: string | number;
|
|
77
|
+
maxWidth?: string | number;
|
|
78
|
+
themes?: CodeBlockMonacoTheme[];
|
|
79
|
+
showHeader?: boolean;
|
|
80
|
+
showCopyButton?: boolean;
|
|
81
|
+
showExpandButton?: boolean;
|
|
82
|
+
showPreviewButton?: boolean;
|
|
83
|
+
showCollapseButton?: boolean;
|
|
84
|
+
showFontSizeButtons?: boolean;
|
|
85
|
+
showTooltips?: boolean;
|
|
86
|
+
customId?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ImageNodeProps {
|
|
89
|
+
node: {
|
|
90
|
+
type: 'image';
|
|
91
|
+
src: string;
|
|
92
|
+
alt: string;
|
|
93
|
+
title: string | null;
|
|
94
|
+
raw: string;
|
|
95
|
+
loading?: boolean;
|
|
96
|
+
};
|
|
97
|
+
fallbackSrc?: string;
|
|
98
|
+
showCaption?: boolean;
|
|
99
|
+
lazy?: boolean;
|
|
100
|
+
svgMinHeight?: string;
|
|
101
|
+
usePlaceholder?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface LinkNodeProps {
|
|
104
|
+
node: {
|
|
105
|
+
type: 'link';
|
|
106
|
+
href: string;
|
|
107
|
+
title: string | null;
|
|
108
|
+
text: string;
|
|
109
|
+
attrs?: [string, string][];
|
|
110
|
+
children: {
|
|
111
|
+
type: string;
|
|
112
|
+
raw: string;
|
|
113
|
+
}[];
|
|
114
|
+
raw: string;
|
|
115
|
+
loading?: boolean;
|
|
116
|
+
};
|
|
117
|
+
indexKey: number | string;
|
|
118
|
+
customId?: string;
|
|
119
|
+
showTooltip?: boolean;
|
|
120
|
+
color?: string;
|
|
121
|
+
underlineHeight?: number;
|
|
122
|
+
underlineBottom?: number | string;
|
|
123
|
+
animationDuration?: number;
|
|
124
|
+
animationOpacity?: number;
|
|
125
|
+
animationTiming?: string;
|
|
126
|
+
animationIteration?: string | number;
|
|
127
|
+
}
|
|
128
|
+
export interface PreCodeNodeProps {
|
|
129
|
+
node: CodeBlockNode;
|
|
130
|
+
}
|
|
131
|
+
export interface MermaidBlockNodeProps {
|
|
132
|
+
node: CodeBlockNode;
|
|
133
|
+
maxHeight?: string | null;
|
|
134
|
+
loading?: boolean;
|
|
135
|
+
isDark?: boolean;
|
|
136
|
+
workerTimeoutMs?: number;
|
|
137
|
+
parseTimeoutMs?: number;
|
|
138
|
+
renderTimeoutMs?: number;
|
|
139
|
+
fullRenderTimeoutMs?: number;
|
|
140
|
+
renderDebounceMs?: number;
|
|
141
|
+
contentStableDelayMs?: number;
|
|
142
|
+
previewPollDelayMs?: number;
|
|
143
|
+
previewPollMaxDelayMs?: number;
|
|
144
|
+
previewPollMaxAttempts?: number;
|
|
145
|
+
showHeader?: boolean;
|
|
146
|
+
showModeToggle?: boolean;
|
|
147
|
+
showCopyButton?: boolean;
|
|
148
|
+
showExportButton?: boolean;
|
|
149
|
+
showFullscreenButton?: boolean;
|
|
150
|
+
showCollapseButton?: boolean;
|
|
151
|
+
showZoomControls?: boolean;
|
|
152
|
+
enableWheelZoom?: boolean;
|
|
153
|
+
isStrict?: boolean;
|
|
154
|
+
showTooltips?: boolean;
|
|
155
|
+
onRenderError?: (error: unknown, code: string, container: HTMLElement) => boolean | void;
|
|
156
|
+
}
|
|
157
|
+
export interface MermaidBlockEvent<TPayload = any> {
|
|
158
|
+
payload?: TPayload;
|
|
159
|
+
defaultPrevented: boolean;
|
|
160
|
+
preventDefault: () => void;
|
|
161
|
+
svgElement?: SVGElement | null;
|
|
162
|
+
svgString?: string | null;
|
|
163
|
+
}
|
|
164
|
+
export interface D2BlockNodeProps {
|
|
165
|
+
node: CodeBlockNode;
|
|
166
|
+
maxHeight?: string | null;
|
|
167
|
+
loading?: boolean;
|
|
168
|
+
isDark?: boolean;
|
|
169
|
+
progressiveRender?: boolean;
|
|
170
|
+
progressiveIntervalMs?: number;
|
|
171
|
+
themeId?: number | null;
|
|
172
|
+
darkThemeId?: number | null;
|
|
173
|
+
showHeader?: boolean;
|
|
174
|
+
showModeToggle?: boolean;
|
|
175
|
+
showCopyButton?: boolean;
|
|
176
|
+
showExportButton?: boolean;
|
|
177
|
+
showCollapseButton?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export interface MathBlockNodeProps {
|
|
180
|
+
node: {
|
|
181
|
+
type: 'math_block';
|
|
182
|
+
content: string;
|
|
183
|
+
raw: string;
|
|
184
|
+
loading?: boolean;
|
|
185
|
+
};
|
|
186
|
+
indexKey?: number | string;
|
|
187
|
+
}
|
|
188
|
+
export interface MathInlineNodeProps {
|
|
189
|
+
node: {
|
|
190
|
+
type: 'math_inline';
|
|
191
|
+
content: string;
|
|
192
|
+
raw: string;
|
|
193
|
+
loading?: boolean;
|
|
194
|
+
markup?: string;
|
|
195
|
+
};
|
|
196
|
+
indexKey?: number | string;
|
|
197
|
+
}
|
|
198
|
+
export interface InfographicBlockNodeProps {
|
|
199
|
+
node: CodeBlockNode;
|
|
200
|
+
maxHeight?: string | null;
|
|
201
|
+
loading?: boolean;
|
|
202
|
+
isDark?: boolean;
|
|
203
|
+
showHeader?: boolean;
|
|
204
|
+
showModeToggle?: boolean;
|
|
205
|
+
showCopyButton?: boolean;
|
|
206
|
+
showCollapseButton?: boolean;
|
|
207
|
+
showExportButton?: boolean;
|
|
208
|
+
showFullscreenButton?: boolean;
|
|
209
|
+
showZoomControls?: boolean;
|
|
210
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { Component } from 'vue-demi';
|
|
2
|
+
export interface BaseNode {
|
|
3
|
+
type: string;
|
|
4
|
+
raw: string;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
code?: string;
|
|
7
|
+
diff?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A catch‑all node type for user extensions.
|
|
11
|
+
* Must still satisfy the renderer contract (`type` + `raw`), but may carry
|
|
12
|
+
* arbitrary extra fields.
|
|
13
|
+
*/
|
|
14
|
+
export type UnknownNode = BaseNode & Record<string, unknown>;
|
|
15
|
+
export interface TextNode extends BaseNode {
|
|
16
|
+
type: 'text';
|
|
17
|
+
content: string;
|
|
18
|
+
center?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface HeadingNode extends BaseNode {
|
|
21
|
+
type: 'heading';
|
|
22
|
+
level: number;
|
|
23
|
+
text: string;
|
|
24
|
+
attrs?: Record<string, string | boolean>;
|
|
25
|
+
children: ParsedNode[];
|
|
26
|
+
}
|
|
27
|
+
export interface ParagraphNode extends BaseNode {
|
|
28
|
+
type: 'paragraph';
|
|
29
|
+
children: ParsedNode[];
|
|
30
|
+
maybeCheckbox?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ListNode extends BaseNode {
|
|
33
|
+
type: 'list';
|
|
34
|
+
ordered: boolean;
|
|
35
|
+
start?: number;
|
|
36
|
+
items: ListItemNode[];
|
|
37
|
+
}
|
|
38
|
+
export interface ListItemNode extends BaseNode {
|
|
39
|
+
type: 'list_item';
|
|
40
|
+
children: ParsedNode[];
|
|
41
|
+
}
|
|
42
|
+
export interface CodeBlockNode extends BaseNode {
|
|
43
|
+
type: 'code_block';
|
|
44
|
+
language: string;
|
|
45
|
+
code: string;
|
|
46
|
+
startLine?: number;
|
|
47
|
+
endLine?: number;
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
diff?: boolean;
|
|
50
|
+
originalCode?: string;
|
|
51
|
+
updatedCode?: string;
|
|
52
|
+
raw: string;
|
|
53
|
+
}
|
|
54
|
+
export interface InlineCodeNode extends BaseNode {
|
|
55
|
+
type: 'inline_code';
|
|
56
|
+
code: string;
|
|
57
|
+
}
|
|
58
|
+
export interface LinkNode extends BaseNode {
|
|
59
|
+
type: 'link';
|
|
60
|
+
href: string;
|
|
61
|
+
title: string | null;
|
|
62
|
+
text: string;
|
|
63
|
+
children: ParsedNode[];
|
|
64
|
+
}
|
|
65
|
+
export interface ImageNode extends BaseNode {
|
|
66
|
+
type: 'image';
|
|
67
|
+
src: string;
|
|
68
|
+
alt: string;
|
|
69
|
+
title: string | null;
|
|
70
|
+
}
|
|
71
|
+
export interface HtmlInlineNode extends BaseNode {
|
|
72
|
+
type: 'html_inline';
|
|
73
|
+
tag?: string;
|
|
74
|
+
content: string;
|
|
75
|
+
children: ParsedNode[];
|
|
76
|
+
autoClosed?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export type CustomComponentAttrs = [string, string][] | Record<string, string | boolean> | Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
value: string | boolean;
|
|
81
|
+
}> | null;
|
|
82
|
+
export interface CustomComponentNode extends BaseNode {
|
|
83
|
+
type: string;
|
|
84
|
+
tag: string;
|
|
85
|
+
content: string;
|
|
86
|
+
attrs?: CustomComponentAttrs;
|
|
87
|
+
children?: ParsedNode[];
|
|
88
|
+
autoClosed?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface ThematicBreakNode extends BaseNode {
|
|
91
|
+
type: 'thematic_break';
|
|
92
|
+
}
|
|
93
|
+
export interface MermaidBlockNode {
|
|
94
|
+
node: {
|
|
95
|
+
type: 'code_block';
|
|
96
|
+
language: string;
|
|
97
|
+
code: string;
|
|
98
|
+
loading?: boolean;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export type MarkdownRender = {
|
|
102
|
+
content: string;
|
|
103
|
+
nodes?: undefined;
|
|
104
|
+
} | {
|
|
105
|
+
content?: undefined;
|
|
106
|
+
nodes: BaseNode[];
|
|
107
|
+
};
|
|
108
|
+
export interface BlockquoteNode extends BaseNode {
|
|
109
|
+
type: 'blockquote';
|
|
110
|
+
children: ParsedNode[];
|
|
111
|
+
}
|
|
112
|
+
export interface TableNode extends BaseNode {
|
|
113
|
+
type: 'table';
|
|
114
|
+
header: TableRowNode;
|
|
115
|
+
rows: TableRowNode[];
|
|
116
|
+
}
|
|
117
|
+
export interface TableRowNode extends BaseNode {
|
|
118
|
+
type: 'table_row';
|
|
119
|
+
cells: TableCellNode[];
|
|
120
|
+
}
|
|
121
|
+
export interface TableCellNode extends BaseNode {
|
|
122
|
+
type: 'table_cell';
|
|
123
|
+
header: boolean;
|
|
124
|
+
children: ParsedNode[];
|
|
125
|
+
}
|
|
126
|
+
export interface DefinitionListNode extends BaseNode {
|
|
127
|
+
type: 'definition_list';
|
|
128
|
+
items: DefinitionItemNode[];
|
|
129
|
+
}
|
|
130
|
+
export interface DefinitionItemNode extends BaseNode {
|
|
131
|
+
type: 'definition_item';
|
|
132
|
+
term: ParsedNode[];
|
|
133
|
+
definition: ParsedNode[];
|
|
134
|
+
}
|
|
135
|
+
export interface FootnoteNode extends BaseNode {
|
|
136
|
+
type: 'footnote';
|
|
137
|
+
id: string;
|
|
138
|
+
children: ParsedNode[];
|
|
139
|
+
}
|
|
140
|
+
export interface FootnoteReferenceNode extends BaseNode {
|
|
141
|
+
type: 'footnote_reference';
|
|
142
|
+
id: string;
|
|
143
|
+
}
|
|
144
|
+
export interface AdmonitionNode extends BaseNode {
|
|
145
|
+
type: 'admonition';
|
|
146
|
+
kind: string;
|
|
147
|
+
title: string;
|
|
148
|
+
children: ParsedNode[];
|
|
149
|
+
}
|
|
150
|
+
export interface StrongNode extends BaseNode {
|
|
151
|
+
type: 'strong';
|
|
152
|
+
children: ParsedNode[];
|
|
153
|
+
}
|
|
154
|
+
export interface EmphasisNode extends BaseNode {
|
|
155
|
+
type: 'emphasis';
|
|
156
|
+
children: ParsedNode[];
|
|
157
|
+
}
|
|
158
|
+
export interface StrikethroughNode extends BaseNode {
|
|
159
|
+
type: 'strikethrough';
|
|
160
|
+
children: ParsedNode[];
|
|
161
|
+
}
|
|
162
|
+
export interface HighlightNode extends BaseNode {
|
|
163
|
+
type: 'highlight';
|
|
164
|
+
children: ParsedNode[];
|
|
165
|
+
}
|
|
166
|
+
export interface InsertNode extends BaseNode {
|
|
167
|
+
type: 'insert';
|
|
168
|
+
children: ParsedNode[];
|
|
169
|
+
}
|
|
170
|
+
export interface SubscriptNode extends BaseNode {
|
|
171
|
+
type: 'subscript';
|
|
172
|
+
children: ParsedNode[];
|
|
173
|
+
}
|
|
174
|
+
export interface SuperscriptNode extends BaseNode {
|
|
175
|
+
type: 'superscript';
|
|
176
|
+
children: ParsedNode[];
|
|
177
|
+
}
|
|
178
|
+
export interface CheckboxNode extends BaseNode {
|
|
179
|
+
type: 'checkbox';
|
|
180
|
+
checked: boolean;
|
|
181
|
+
}
|
|
182
|
+
export interface CheckboxInputNode extends BaseNode {
|
|
183
|
+
type: 'checkbox_input';
|
|
184
|
+
checked: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface EmojiNode extends BaseNode {
|
|
187
|
+
type: 'emoji';
|
|
188
|
+
name: string;
|
|
189
|
+
markup: string;
|
|
190
|
+
}
|
|
191
|
+
export interface HardBreakNode extends BaseNode {
|
|
192
|
+
type: 'hardbreak';
|
|
193
|
+
}
|
|
194
|
+
export interface MathInlineNode extends BaseNode {
|
|
195
|
+
type: 'math_inline';
|
|
196
|
+
content: string;
|
|
197
|
+
markup?: string;
|
|
198
|
+
}
|
|
199
|
+
export interface MathBlockNode extends BaseNode {
|
|
200
|
+
type: 'math_block';
|
|
201
|
+
content: string;
|
|
202
|
+
markup?: string;
|
|
203
|
+
}
|
|
204
|
+
export interface ReferenceNode extends BaseNode {
|
|
205
|
+
type: 'reference';
|
|
206
|
+
id: string;
|
|
207
|
+
}
|
|
208
|
+
export interface MarkdownToken {
|
|
209
|
+
type: string;
|
|
210
|
+
tag?: string;
|
|
211
|
+
content?: string;
|
|
212
|
+
info?: string;
|
|
213
|
+
loading?: boolean;
|
|
214
|
+
children?: MarkdownToken[];
|
|
215
|
+
attrs?: [string, string][];
|
|
216
|
+
markup?: string;
|
|
217
|
+
meta?: any;
|
|
218
|
+
map?: [number, number];
|
|
219
|
+
raw?: string;
|
|
220
|
+
}
|
|
221
|
+
export type ParsedNode = TextNode | HeadingNode | ParagraphNode | ListNode | ListItemNode | CodeBlockNode | InlineCodeNode | LinkNode | ImageNode | HtmlInlineNode | CustomComponentNode | ThematicBreakNode | BlockquoteNode | TableNode | TableRowNode | TableCellNode | StrongNode | EmphasisNode | StrikethroughNode | HighlightNode | InsertNode | SubscriptNode | SuperscriptNode | CheckboxNode | CheckboxInputNode | EmojiNode | DefinitionListNode | DefinitionItemNode | FootnoteNode | FootnoteReferenceNode | AdmonitionNode | HardBreakNode | MathInlineNode | MathBlockNode | ReferenceNode | UnknownNode;
|
|
222
|
+
export interface CustomComponents {
|
|
223
|
+
text?: Component;
|
|
224
|
+
paragraph?: Component;
|
|
225
|
+
heading?: Component;
|
|
226
|
+
code_block?: Component;
|
|
227
|
+
list?: Component;
|
|
228
|
+
list_item?: Component;
|
|
229
|
+
blockquote?: Component;
|
|
230
|
+
table?: Component;
|
|
231
|
+
definition_list?: Component;
|
|
232
|
+
footnote?: Component;
|
|
233
|
+
footnote_reference?: Component;
|
|
234
|
+
footnote_anchor?: Component;
|
|
235
|
+
admonition?: Component;
|
|
236
|
+
hardbreak?: Component;
|
|
237
|
+
link?: Component;
|
|
238
|
+
image?: Component;
|
|
239
|
+
thematic_break?: Component;
|
|
240
|
+
math_inline?: Component;
|
|
241
|
+
math_block?: Component;
|
|
242
|
+
strong?: Component;
|
|
243
|
+
emphasis?: Component;
|
|
244
|
+
strikethrough?: Component;
|
|
245
|
+
highlight?: Component;
|
|
246
|
+
insert?: Component;
|
|
247
|
+
subscript?: Component;
|
|
248
|
+
superscript?: Component;
|
|
249
|
+
emoji?: Component;
|
|
250
|
+
checkbox?: Component;
|
|
251
|
+
inline_code?: Component;
|
|
252
|
+
html_inline?: Component;
|
|
253
|
+
html_block?: Component;
|
|
254
|
+
reference?: Component;
|
|
255
|
+
mermaid?: Component;
|
|
256
|
+
infographic?: Component;
|
|
257
|
+
d2?: Component;
|
|
258
|
+
vmr_container?: Component;
|
|
259
|
+
[key: string]: Component | undefined;
|
|
260
|
+
}
|
|
261
|
+
export type TransformTokensHook = (tokens: MarkdownToken[]) => MarkdownToken[];
|
|
262
|
+
export interface ParseOptions {
|
|
263
|
+
preTransformTokens?: TransformTokensHook;
|
|
264
|
+
postTransformTokens?: TransformTokensHook;
|
|
265
|
+
/**
|
|
266
|
+
* Custom HTML-like tag names that should be emitted as custom nodes
|
|
267
|
+
* instead of `html_inline` when encountered (e.g. ['thinking']).
|
|
268
|
+
*/
|
|
269
|
+
customHtmlTags?: readonly string[];
|
|
270
|
+
}
|
|
271
|
+
export type PostTransformNodesHook = (nodes: ParsedNode[]) => ParsedNode[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Component } from 'vue-demi';
|
|
2
|
+
export interface HtmlToken {
|
|
3
|
+
type: 'text' | 'tag_open' | 'tag_close' | 'self_closing';
|
|
4
|
+
tagName?: string;
|
|
5
|
+
attrs?: Record<string, string>;
|
|
6
|
+
content?: string;
|
|
7
|
+
}
|
|
8
|
+
type CreateElementLike = (tag: any, attrs?: Record<string, any>, children?: any[] | undefined) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Check if a tag name is a custom Vue component
|
|
11
|
+
*/
|
|
12
|
+
export declare function isCustomComponent(tagName: string, customComponents: Record<string, Component>): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Sanitize attributes to remove XSS-prone event handlers
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizeAttrs(attrs: Record<string, string>): Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Convert attribute value to appropriate type
|
|
19
|
+
*/
|
|
20
|
+
export declare function convertPropValue(value: string, key: string): any;
|
|
21
|
+
/**
|
|
22
|
+
* Convert all attribute values to appropriate types
|
|
23
|
+
*/
|
|
24
|
+
export declare function convertAttrsToProps(attrs: Record<string, string>): Record<string, any>;
|
|
25
|
+
/**
|
|
26
|
+
* Simple HTML tokenizer
|
|
27
|
+
* Note: This is a basic implementation. For production use with complex HTML,
|
|
28
|
+
* consider using a proper HTML parser library like htmlparser2.
|
|
29
|
+
*/
|
|
30
|
+
export declare function tokenizeHtml(html: string): HtmlToken[];
|
|
31
|
+
/**
|
|
32
|
+
* Build VNode tree from tokens
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildVNodeTree(tokens: HtmlToken[], customComponents: Record<string, Component>, createElement?: CreateElementLike): any[];
|
|
35
|
+
/**
|
|
36
|
+
* Check if HTML content contains custom components
|
|
37
|
+
*/
|
|
38
|
+
export declare function hasCustomComponents(content: string, customComponents: Record<string, Component>): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Parse HTML content to VNodes
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseHtmlToVNodes(content: string, customComponents: Record<string, Component>, createElement?: CreateElementLike): any[] | null;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recommend when to use Worker based on formula count and complexity.
|
|
3
|
+
*
|
|
4
|
+
* N_threshold ≈ floor(B / (R × (1 - H)))
|
|
5
|
+
* - B: main-thread budget (ms), e.g. 50ms or a stricter 16.7ms
|
|
6
|
+
* - R: avg render time per unique formula (ms)
|
|
7
|
+
* - H: cache hit rate (0~1)
|
|
8
|
+
*/
|
|
9
|
+
export interface ThresholdInput {
|
|
10
|
+
R: number;
|
|
11
|
+
H?: number;
|
|
12
|
+
B?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function recommendWorkerThreshold({ R, H, B }: ThresholdInput): number;
|
|
15
|
+
export declare function estimateRByFormula(sample: string): 'simple' | 'medium' | 'complex';
|
|
16
|
+
export declare function defaultRByClass(cls: 'simple' | 'medium' | 'complex'): number;
|
|
17
|
+
export declare function recommendNForSamples(formulas: string[], opts?: {
|
|
18
|
+
H?: number;
|
|
19
|
+
B?: number;
|
|
20
|
+
}): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type LanguageIconResolver = (lang: string) => string | undefined | null;
|
|
2
|
+
export declare const languageIconsRevision: import('vue-demi').Ref<number>;
|
|
3
|
+
export declare function setLanguageIconResolver(resolver?: LanguageIconResolver | null): void;
|
|
4
|
+
export declare function normalizeLanguageIdentifier(lang?: string | null): string;
|
|
5
|
+
export declare function resolveMonacoLanguageId(lang?: string | null): string;
|
|
6
|
+
export declare function preloadExtendedLanguageIcons(): Promise<void>;
|
|
7
|
+
export declare function getLanguageIcon(lang: string): string;
|
|
8
|
+
export declare const languageMap: Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EXTENDED_LANGUAGE_ICON_MAP: Record<string, string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface CachedMathRender {
|
|
2
|
+
html: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function getCachedMathRender(key: string | null | undefined): CachedMathRender;
|
|
5
|
+
export declare function setCachedMathRender(key: string | null | undefined, html: string): void;
|
|
6
|
+
export declare function clearCachedMathRender(key?: string | null): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseNode, ParsedNode } from 'stream-markdown-parser';
|
|
2
|
+
export type NestedRenderableNode = (ParsedNode | BaseNode) & Record<string, unknown>;
|
|
3
|
+
type NestedClassValue = string | readonly string[] | null | undefined;
|
|
4
|
+
export interface NestedMarkdownHtmlOptions {
|
|
5
|
+
cacheKey?: string;
|
|
6
|
+
customHtmlTags?: readonly string[];
|
|
7
|
+
allowHtml?: boolean;
|
|
8
|
+
customNodeTag?: string;
|
|
9
|
+
customNodeClass?: NestedClassValue | ((node: NestedRenderableNode) => NestedClassValue);
|
|
10
|
+
}
|
|
11
|
+
export interface NestedMarkdownHtmlInput {
|
|
12
|
+
node?: NestedRenderableNode | null;
|
|
13
|
+
nodes?: readonly NestedRenderableNode[] | null;
|
|
14
|
+
content?: string | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function renderNestedMarkdownToHtml(input: NestedMarkdownHtmlInput, options?: NestedMarkdownHtmlOptions): string;
|
|
17
|
+
export declare function renderMarkdownNodesToHtml(nodes: readonly NestedRenderableNode[] | null | undefined, options?: NestedMarkdownHtmlOptions): string;
|
|
18
|
+
export declare function renderMarkdownNodeToHtml(node: NestedRenderableNode | null | undefined, options?: NestedMarkdownHtmlOptions): string;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseNode, MarkdownIt, ParseOptions } from 'stream-markdown-parser';
|
|
2
|
+
export interface NestedMarkdownNodesInput {
|
|
3
|
+
node?: (BaseNode & Record<string, any>) | null;
|
|
4
|
+
nodes?: readonly BaseNode[] | null;
|
|
5
|
+
content?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface NestedMarkdownNodesOptions {
|
|
8
|
+
cacheKey?: string;
|
|
9
|
+
final?: boolean;
|
|
10
|
+
parseOptions?: ParseOptions;
|
|
11
|
+
customHtmlTags?: readonly string[];
|
|
12
|
+
customMarkdownIt?: (markdown: MarkdownIt) => MarkdownIt;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseNestedMarkdownToNodes(input: NestedMarkdownNodesInput, options?: NestedMarkdownNodesOptions): BaseNode[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CustomComponents } from '../types';
|
|
2
|
+
export declare const customComponentsRevision: import('vue-demi').ShallowRef<any>;
|
|
3
|
+
export declare function setCustomComponents(id: string, mapping: Partial<CustomComponents>): void;
|
|
4
|
+
export declare function setCustomComponents(mapping: Partial<CustomComponents>): void;
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve custom components for a given scope id.
|
|
7
|
+
* If no id is provided, returns the legacy/global mapping (if any).
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCustomNodeComponents(customId?: string): Partial<CustomComponents>;
|
|
10
|
+
/**
|
|
11
|
+
* Remove a scoped custom components mapping.
|
|
12
|
+
* Use this to clean up mappings for dynamic or temporary renderers.
|
|
13
|
+
*/
|
|
14
|
+
export declare function removeCustomComponents(id: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Clear the legacy/global custom components mapping.
|
|
17
|
+
* Use this when you want to remove the single-argument mapping set by
|
|
18
|
+
* `setCustomComponents(mapping)`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clearGlobalCustomComponents(): void;
|