@hejiayue/x-markdown-test 0.0.1-beta.107
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 +21 -0
- package/README.md +1090 -0
- package/dist/index-BjeepIV6.js +529 -0
- package/dist/index-BjeepIV6.js.map +1 -0
- package/dist/index-CgG50XSZ.cjs +2 -0
- package/dist/index-CgG50XSZ.cjs.map +1 -0
- package/dist/index-DtKeGkdv.cjs +2 -0
- package/dist/index-DtKeGkdv.cjs.map +1 -0
- package/dist/index-Ys7-7uFi.js +1856 -0
- package/dist/index-Ys7-7uFi.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/MarkdownRender/index.d.ts +441 -0
- package/dist/types/core/components.d.ts +4 -0
- package/dist/types/core/hast-to-vnode.d.ts +13 -0
- package/dist/types/core/index.d.ts +6 -0
- package/dist/types/core/useProcessor.d.ts +23 -0
- package/dist/types/hooks/index.d.ts +6 -0
- package/dist/types/hooks/useComponents.d.ts +21 -0
- package/dist/types/hooks/useHighlight.d.ts +26 -0
- package/dist/types/hooks/useMarkdown.d.ts +2 -0
- package/dist/types/hooks/useMermaid.d.ts +22 -0
- package/dist/types/hooks/usePlugins.d.ts +8 -0
- package/dist/types/hooks/useTheme.d.ts +25 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/plugins/rehypePlugin.d.ts +2 -0
- package/dist/x-markdown.cjs.js +2 -0
- package/dist/x-markdown.cjs.js.map +1 -0
- package/dist/x-markdown.es.js +20 -0
- package/dist/x-markdown.es.js.map +1 -0
- package/package.json +98 -0
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.x-md-syntax-code-block[data-v-7cbaa1d1]{width:100%}.x-md-syntax-code-block pre[data-v-7cbaa1d1]{margin:0;padding:16px;overflow:auto;background:transparent!important}.x-md-code-content[data-v-7cbaa1d1]{display:flex;flex-direction:column}.x-md-code-line[data-v-7cbaa1d1]{width:100%;font-size:14px;line-height:1.5;display:flex}.x-md-code-block[data-v-8b0fb0b9]{border-radius:8px;overflow:hidden;font-size:0;background:#00000008}.x-md-code-block.x-md-code-block--dark[data-v-8b0fb0b9]{background:#ffffff21}.x-md-code-header-wrapper--sticky[data-v-8b0fb0b9]{background:#fff;position:sticky;top:0}.x-md-code-block.x-md-code-block--dark .x-md-code-header-wrapper--sticky[data-v-8b0fb0b9]{background:#1a1a1a}.x-md-code-header[data-v-8b0fb0b9]{display:flex;justify-content:space-between;align-items:center;padding:8px 16px;background:#0000000d;color:#333}.x-md-code-block .x-md-code-header-wrapper--sticky .x-md-code-header[data-v-8b0fb0b9]{background:#ebebeb;border-radius:8px 8px 0 0}.x-md-code-block[data-v-8b0fb0b9]:has(.x-md-code-header-wrapper--sticky){overflow:visible}.x-md-code-block.x-md-code-block--dark .x-md-code-header[data-v-8b0fb0b9]{background:#00000040;color:#fff}.x-md-code-block.x-md-code-block--dark .x-md-code-header-wrapper--sticky .x-md-code-header[data-v-8b0fb0b9]{background:#2c2c2c}.x-md-code-block .x-md-code-header-wrapper--collapsed .x-md-code-header[data-v-8b0fb0b9]{border-radius:8px}.x-md-code-header__left[data-v-8b0fb0b9],.x-md-code-header__right[data-v-8b0fb0b9]{display:flex;align-items:center;gap:8px}.x-md-code-lang[data-v-8b0fb0b9]{font-size:12px;font-weight:500;opacity:.6;text-transform:lowercase}.x-md-copy-btn[data-v-8b0fb0b9]{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:transparent;color:inherit;cursor:pointer;opacity:.7;transition:all .2s ease}.x-md-copy-btn[data-v-8b0fb0b9]:hover{opacity:1;background:#00000014}.x-md-code-block.x-md-code-block--dark .x-md-copy-btn[data-v-8b0fb0b9]:hover{background:#ffffff1a}.x-md-copy-btn.x-md-copy-btn--copied[data-v-8b0fb0b9]{opacity:1;color:#22c55e}.x-md-copy-icon[data-v-8b0fb0b9]{flex-shrink:0}.x-md-action-btn[data-v-8b0fb0b9]{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:transparent;color:inherit;cursor:pointer;opacity:.7;transition:all .2s ease}.x-md-action-btn[data-v-8b0fb0b9]:hover{opacity:1;background:#00000014}.x-md-code-block.x-md-code-block--dark .x-md-action-btn[data-v-8b0fb0b9]:hover{background:#ffffff1a}.x-md-action-btn.x-md-action-btn--disabled[data-v-8b0fb0b9]{opacity:.3;cursor:not-allowed;pointer-events:none}.x-md-action-icon[data-v-8b0fb0b9]{display:flex;align-items:center;justify-content:center}.x-md-action-icon[data-v-8b0fb0b9] svg{width:16px;height:16px;flex-shrink:0}.x-md-collapse-btn[data-v-8b0fb0b9]{display:flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:none;border-radius:4px;background:transparent;color:inherit;cursor:pointer;opacity:.5;transition:all .2s ease}.x-md-collapse-btn[data-v-8b0fb0b9]:hover{opacity:1;background:#00000014}.x-md-code-block.x-md-code-block--dark .x-md-collapse-btn[data-v-8b0fb0b9]:hover{background:#ffffff1a}.x-md-collapse-icon[data-v-8b0fb0b9]{transition:transform .2s ease}.x-md-collapse-btn--collapsed .x-md-collapse-icon[data-v-8b0fb0b9]{transform:rotate(-90deg)}.x-md-code-body[data-v-8b0fb0b9]{overflow:hidden;transition:max-height .3s ease,opacity .2s ease}.x-md-code-body--collapsed[data-v-8b0fb0b9]{max-height:0!important;opacity:0}.x-md-inline-code[data-v-97166d5b]{display:inline-block;border-radius:8px;overflow:hidden;font-size:14px;background:#00000008;vertical-align:sub}.x-md-inline-code.x-md-inline-code--dark[data-v-97166d5b]{background:#ffffff21}.x-md-inline-code code[data-v-97166d5b]{background:transparent!important}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.x-md-animated-word{animation:fadeIn .3s ease-in-out}.x-md-renderer pre{margin:16px 0;padding:0;overflow:auto;background:transparent!important}.x-md-renderer pre:has(.x-md-code-header-wrapper--sticky){overflow:unset}.katex-error{color:var(--el-text-color-secondary)!important}.katex-html{overflow:auto hidden;padding:3px}.syntax-mermaid{display:flex;align-items:center;justify-content:center;min-height:200px;overflow:hidden;cursor:grab;position:relative}.syntax-mermaid__render-container{position:absolute;max-height:0;opacity:0;overflow:hidden;pointer-events:none}.syntax-mermaid:active{cursor:grabbing}.syntax-mermaid__content{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.syntax-mermaid__content svg{transform-origin:center center;max-width:100%;max-height:100%}.syntax-mermaid:fullscreen{max-height:100vh}.syntax-mermaid:fullscreen .syntax-mermaid__content{justify-content:center}.syntax-mermaid__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:200px}.syntax-mermaid__loading-text{color:#666;font-size:14px}.syntax-mermaid--dark .syntax-mermaid__loading-text{color:#999}.markdown-mermaid{border-radius:8px;overflow:hidden;font-size:0;background:#00000008}.markdown-mermaid.markdown-mermaid--dark{background:#ffffff21}.markdown-mermaid .toolbar-container{position:relative;z-index:10;flex-shrink:0;background:#0000000d;color:#333}.markdown-mermaid.markdown-mermaid--dark .toolbar-container{background:#00000040;color:#fff}.markdown-mermaid .mermaid-toolbar{display:flex;justify-content:space-between;align-items:center;padding:8px 16px;background:transparent;color:inherit}.markdown-mermaid .mermaid-toolbar .toolbar-left{display:flex;align-items:center}.markdown-mermaid .mermaid-toolbar .segmented-control{display:flex;align-items:center;position:relative;background:#0000000f;border-radius:6px;padding:3px;gap:2px}.markdown-mermaid.markdown-mermaid--dark .mermaid-toolbar .segmented-control{background:#ffffff14}.markdown-mermaid .mermaid-toolbar .segmented-slider{position:absolute;top:3px;left:3px;width:calc(50% - 4px);height:calc(100% - 6px);background:#fff;border-radius:4px;box-shadow:0 1px 3px #0000001a;transition:transform .25s cubic-bezier(.4,0,.2,1);z-index:0}.markdown-mermaid.markdown-mermaid--dark .mermaid-toolbar .segmented-slider{background:#ffffff26;box-shadow:0 1px 3px #0003}.markdown-mermaid .mermaid-toolbar .segmented-slider.slide-right{transform:translate(calc(100% + 2px))}.markdown-mermaid .mermaid-toolbar .segment-item{display:flex;align-items:center;justify-content:center;gap:4px;font-size:12px;border:none;color:inherit;min-width:60px;text-align:center;box-sizing:border-box;font-weight:500;cursor:pointer;border-radius:4px;padding:5px 12px;transition:all .2s ease;background:transparent;opacity:.6;user-select:none;position:relative;z-index:1}.markdown-mermaid .mermaid-toolbar .segment-item.active{opacity:1}.markdown-mermaid.markdown-mermaid--dark .mermaid-toolbar .segment-item.active{color:#fff}.markdown-mermaid .mermaid-toolbar .segment-item:hover{opacity:1}.markdown-mermaid .mermaid-toolbar .segment-item svg{flex-shrink:0}.markdown-mermaid .mermaid-toolbar .toolbar-right{display:flex;align-items:center;gap:16px}.markdown-mermaid .mermaid-toolbar .toolbar-action-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:transparent;color:inherit;cursor:pointer;transition:all .2s ease;opacity:.7}.markdown-mermaid .mermaid-toolbar .toolbar-action-btn:hover{opacity:1;background:#00000014}.markdown-mermaid .mermaid-toolbar .toolbar-action-btn.copy-success{opacity:1;color:#22c55e}.markdown-mermaid.markdown-mermaid--dark .mermaid-toolbar .toolbar-action-btn:hover{background:#ffffff1a}.markdown-mermaid .mermaid-toolbar .toolbar-action-btn.toolbar-action-btn--disabled{opacity:.3;cursor:not-allowed;pointer-events:none}.markdown-mermaid .mermaid-toolbar .mermaid-action-icon{display:flex;align-items:center;justify-content:center}.markdown-mermaid .mermaid-toolbar .mermaid-action-icon :deep(svg){width:16px;height:16px;flex-shrink:0}.markdown-mermaid .mermaid-source-code{position:relative;z-index:1;flex:1;width:100%;overflow:auto;box-sizing:border-box}.toolbar-enter-active,.toolbar-leave-active{transition:opacity .3s ease}.toolbar-enter-from,.toolbar-leave-to{opacity:0}
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { PluggableList } from 'unified';
|
|
3
|
+
import type { CodeBlockAction } from '../components/CodeBlock/types';
|
|
4
|
+
import type { MermaidAction } from '../components/Mermaid/types';
|
|
5
|
+
import type { CustomAttrs, SanitizeOptions } from '../core/types';
|
|
6
|
+
import './index.css';
|
|
7
|
+
/**
|
|
8
|
+
* Markdown 渲染器组件 - 同步版本
|
|
9
|
+
* 直接渲染 Markdown 内容
|
|
10
|
+
*/
|
|
11
|
+
declare const MarkdownRenderer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
markdown: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
allowHtml: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
enableLatex: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
enableAnimate: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
enableBreaks: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
enableGfm: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
isDark: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
shikiTheme: {
|
|
41
|
+
type: PropType<[string, string]>;
|
|
42
|
+
default: () => [string, string];
|
|
43
|
+
};
|
|
44
|
+
showCodeBlockHeader: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
stickyCodeBlockHeader: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
codeMaxHeight: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
codeBlockActions: {
|
|
57
|
+
type: PropType<CodeBlockAction[]>;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
mermaidActions: {
|
|
61
|
+
type: PropType<MermaidAction[]>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
mermaidConfig: {
|
|
65
|
+
type: PropType<Record<string, any>>;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
68
|
+
codeXRender: {
|
|
69
|
+
type: ObjectConstructor;
|
|
70
|
+
default: () => {};
|
|
71
|
+
};
|
|
72
|
+
customAttrs: {
|
|
73
|
+
type: PropType<CustomAttrs>;
|
|
74
|
+
default: () => {};
|
|
75
|
+
};
|
|
76
|
+
remarkPlugins: {
|
|
77
|
+
type: PropType<PluggableList>;
|
|
78
|
+
default: () => never[];
|
|
79
|
+
};
|
|
80
|
+
remarkPluginsAhead: {
|
|
81
|
+
type: PropType<PluggableList>;
|
|
82
|
+
default: () => never[];
|
|
83
|
+
};
|
|
84
|
+
rehypePlugins: {
|
|
85
|
+
type: PropType<PluggableList>;
|
|
86
|
+
default: () => never[];
|
|
87
|
+
};
|
|
88
|
+
rehypePluginsAhead: {
|
|
89
|
+
type: PropType<PluggableList>;
|
|
90
|
+
default: () => never[];
|
|
91
|
+
};
|
|
92
|
+
rehypeOptions: {
|
|
93
|
+
type: PropType<Record<string, any>>;
|
|
94
|
+
default: () => {};
|
|
95
|
+
};
|
|
96
|
+
sanitize: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: boolean;
|
|
99
|
+
};
|
|
100
|
+
sanitizeOptions: {
|
|
101
|
+
type: PropType<SanitizeOptions>;
|
|
102
|
+
default: () => {};
|
|
103
|
+
};
|
|
104
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
105
|
+
[key: string]: any;
|
|
106
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
107
|
+
markdown: {
|
|
108
|
+
type: StringConstructor;
|
|
109
|
+
default: string;
|
|
110
|
+
};
|
|
111
|
+
allowHtml: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
115
|
+
enableLatex: {
|
|
116
|
+
type: BooleanConstructor;
|
|
117
|
+
default: boolean;
|
|
118
|
+
};
|
|
119
|
+
enableAnimate: {
|
|
120
|
+
type: BooleanConstructor;
|
|
121
|
+
default: boolean;
|
|
122
|
+
};
|
|
123
|
+
enableBreaks: {
|
|
124
|
+
type: BooleanConstructor;
|
|
125
|
+
default: boolean;
|
|
126
|
+
};
|
|
127
|
+
enableGfm: {
|
|
128
|
+
type: BooleanConstructor;
|
|
129
|
+
default: boolean;
|
|
130
|
+
};
|
|
131
|
+
isDark: {
|
|
132
|
+
type: BooleanConstructor;
|
|
133
|
+
default: boolean;
|
|
134
|
+
};
|
|
135
|
+
shikiTheme: {
|
|
136
|
+
type: PropType<[string, string]>;
|
|
137
|
+
default: () => [string, string];
|
|
138
|
+
};
|
|
139
|
+
showCodeBlockHeader: {
|
|
140
|
+
type: BooleanConstructor;
|
|
141
|
+
default: boolean;
|
|
142
|
+
};
|
|
143
|
+
stickyCodeBlockHeader: {
|
|
144
|
+
type: BooleanConstructor;
|
|
145
|
+
default: boolean;
|
|
146
|
+
};
|
|
147
|
+
codeMaxHeight: {
|
|
148
|
+
type: StringConstructor;
|
|
149
|
+
default: undefined;
|
|
150
|
+
};
|
|
151
|
+
codeBlockActions: {
|
|
152
|
+
type: PropType<CodeBlockAction[]>;
|
|
153
|
+
default: undefined;
|
|
154
|
+
};
|
|
155
|
+
mermaidActions: {
|
|
156
|
+
type: PropType<MermaidAction[]>;
|
|
157
|
+
default: undefined;
|
|
158
|
+
};
|
|
159
|
+
mermaidConfig: {
|
|
160
|
+
type: PropType<Record<string, any>>;
|
|
161
|
+
default: undefined;
|
|
162
|
+
};
|
|
163
|
+
codeXRender: {
|
|
164
|
+
type: ObjectConstructor;
|
|
165
|
+
default: () => {};
|
|
166
|
+
};
|
|
167
|
+
customAttrs: {
|
|
168
|
+
type: PropType<CustomAttrs>;
|
|
169
|
+
default: () => {};
|
|
170
|
+
};
|
|
171
|
+
remarkPlugins: {
|
|
172
|
+
type: PropType<PluggableList>;
|
|
173
|
+
default: () => never[];
|
|
174
|
+
};
|
|
175
|
+
remarkPluginsAhead: {
|
|
176
|
+
type: PropType<PluggableList>;
|
|
177
|
+
default: () => never[];
|
|
178
|
+
};
|
|
179
|
+
rehypePlugins: {
|
|
180
|
+
type: PropType<PluggableList>;
|
|
181
|
+
default: () => never[];
|
|
182
|
+
};
|
|
183
|
+
rehypePluginsAhead: {
|
|
184
|
+
type: PropType<PluggableList>;
|
|
185
|
+
default: () => never[];
|
|
186
|
+
};
|
|
187
|
+
rehypeOptions: {
|
|
188
|
+
type: PropType<Record<string, any>>;
|
|
189
|
+
default: () => {};
|
|
190
|
+
};
|
|
191
|
+
sanitize: {
|
|
192
|
+
type: BooleanConstructor;
|
|
193
|
+
default: boolean;
|
|
194
|
+
};
|
|
195
|
+
sanitizeOptions: {
|
|
196
|
+
type: PropType<SanitizeOptions>;
|
|
197
|
+
default: () => {};
|
|
198
|
+
};
|
|
199
|
+
}>> & Readonly<{}>, {
|
|
200
|
+
sanitize: boolean;
|
|
201
|
+
markdown: string;
|
|
202
|
+
customAttrs: CustomAttrs;
|
|
203
|
+
remarkPlugins: PluggableList;
|
|
204
|
+
rehypePlugins: PluggableList;
|
|
205
|
+
rehypeOptions: Record<string, any>;
|
|
206
|
+
sanitizeOptions: SanitizeOptions;
|
|
207
|
+
codeXRender: Record<string, any>;
|
|
208
|
+
isDark: boolean;
|
|
209
|
+
shikiTheme: [string, string];
|
|
210
|
+
enableAnimate: boolean;
|
|
211
|
+
showCodeBlockHeader: boolean;
|
|
212
|
+
stickyCodeBlockHeader: boolean;
|
|
213
|
+
codeMaxHeight: string;
|
|
214
|
+
codeBlockActions: CodeBlockAction[];
|
|
215
|
+
mermaidActions: MermaidAction[];
|
|
216
|
+
mermaidConfig: Record<string, any>;
|
|
217
|
+
allowHtml: boolean;
|
|
218
|
+
enableLatex: boolean;
|
|
219
|
+
enableBreaks: boolean;
|
|
220
|
+
enableGfm: boolean;
|
|
221
|
+
rehypePluginsAhead: PluggableList;
|
|
222
|
+
remarkPluginsAhead: PluggableList;
|
|
223
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
224
|
+
/**
|
|
225
|
+
* Markdown 渲染器组件 - 异步版本
|
|
226
|
+
* 异步渲染 Markdown 内容
|
|
227
|
+
*/
|
|
228
|
+
declare const MarkdownRendererAsync: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
229
|
+
markdown: {
|
|
230
|
+
type: StringConstructor;
|
|
231
|
+
default: string;
|
|
232
|
+
};
|
|
233
|
+
allowHtml: {
|
|
234
|
+
type: BooleanConstructor;
|
|
235
|
+
default: boolean;
|
|
236
|
+
};
|
|
237
|
+
enableLatex: {
|
|
238
|
+
type: BooleanConstructor;
|
|
239
|
+
default: boolean;
|
|
240
|
+
};
|
|
241
|
+
enableAnimate: {
|
|
242
|
+
type: BooleanConstructor;
|
|
243
|
+
default: boolean;
|
|
244
|
+
};
|
|
245
|
+
enableBreaks: {
|
|
246
|
+
type: BooleanConstructor;
|
|
247
|
+
default: boolean;
|
|
248
|
+
};
|
|
249
|
+
enableGfm: {
|
|
250
|
+
type: BooleanConstructor;
|
|
251
|
+
default: boolean;
|
|
252
|
+
};
|
|
253
|
+
isDark: {
|
|
254
|
+
type: BooleanConstructor;
|
|
255
|
+
default: boolean;
|
|
256
|
+
};
|
|
257
|
+
shikiTheme: {
|
|
258
|
+
type: PropType<[string, string]>;
|
|
259
|
+
default: () => [string, string];
|
|
260
|
+
};
|
|
261
|
+
showCodeBlockHeader: {
|
|
262
|
+
type: BooleanConstructor;
|
|
263
|
+
default: boolean;
|
|
264
|
+
};
|
|
265
|
+
stickyCodeBlockHeader: {
|
|
266
|
+
type: BooleanConstructor;
|
|
267
|
+
default: boolean;
|
|
268
|
+
};
|
|
269
|
+
codeMaxHeight: {
|
|
270
|
+
type: StringConstructor;
|
|
271
|
+
default: undefined;
|
|
272
|
+
};
|
|
273
|
+
codeBlockActions: {
|
|
274
|
+
type: PropType<CodeBlockAction[]>;
|
|
275
|
+
default: undefined;
|
|
276
|
+
};
|
|
277
|
+
mermaidActions: {
|
|
278
|
+
type: PropType<MermaidAction[]>;
|
|
279
|
+
default: undefined;
|
|
280
|
+
};
|
|
281
|
+
mermaidConfig: {
|
|
282
|
+
type: PropType<Record<string, any>>;
|
|
283
|
+
default: undefined;
|
|
284
|
+
};
|
|
285
|
+
codeXRender: {
|
|
286
|
+
type: ObjectConstructor;
|
|
287
|
+
default: () => {};
|
|
288
|
+
};
|
|
289
|
+
customAttrs: {
|
|
290
|
+
type: PropType<CustomAttrs>;
|
|
291
|
+
default: () => {};
|
|
292
|
+
};
|
|
293
|
+
remarkPlugins: {
|
|
294
|
+
type: PropType<PluggableList>;
|
|
295
|
+
default: () => never[];
|
|
296
|
+
};
|
|
297
|
+
remarkPluginsAhead: {
|
|
298
|
+
type: PropType<PluggableList>;
|
|
299
|
+
default: () => never[];
|
|
300
|
+
};
|
|
301
|
+
rehypePlugins: {
|
|
302
|
+
type: PropType<PluggableList>;
|
|
303
|
+
default: () => never[];
|
|
304
|
+
};
|
|
305
|
+
rehypePluginsAhead: {
|
|
306
|
+
type: PropType<PluggableList>;
|
|
307
|
+
default: () => never[];
|
|
308
|
+
};
|
|
309
|
+
rehypeOptions: {
|
|
310
|
+
type: PropType<Record<string, any>>;
|
|
311
|
+
default: () => {};
|
|
312
|
+
};
|
|
313
|
+
sanitize: {
|
|
314
|
+
type: BooleanConstructor;
|
|
315
|
+
default: boolean;
|
|
316
|
+
};
|
|
317
|
+
sanitizeOptions: {
|
|
318
|
+
type: PropType<SanitizeOptions>;
|
|
319
|
+
default: () => {};
|
|
320
|
+
};
|
|
321
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
322
|
+
[key: string]: any;
|
|
323
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
324
|
+
markdown: {
|
|
325
|
+
type: StringConstructor;
|
|
326
|
+
default: string;
|
|
327
|
+
};
|
|
328
|
+
allowHtml: {
|
|
329
|
+
type: BooleanConstructor;
|
|
330
|
+
default: boolean;
|
|
331
|
+
};
|
|
332
|
+
enableLatex: {
|
|
333
|
+
type: BooleanConstructor;
|
|
334
|
+
default: boolean;
|
|
335
|
+
};
|
|
336
|
+
enableAnimate: {
|
|
337
|
+
type: BooleanConstructor;
|
|
338
|
+
default: boolean;
|
|
339
|
+
};
|
|
340
|
+
enableBreaks: {
|
|
341
|
+
type: BooleanConstructor;
|
|
342
|
+
default: boolean;
|
|
343
|
+
};
|
|
344
|
+
enableGfm: {
|
|
345
|
+
type: BooleanConstructor;
|
|
346
|
+
default: boolean;
|
|
347
|
+
};
|
|
348
|
+
isDark: {
|
|
349
|
+
type: BooleanConstructor;
|
|
350
|
+
default: boolean;
|
|
351
|
+
};
|
|
352
|
+
shikiTheme: {
|
|
353
|
+
type: PropType<[string, string]>;
|
|
354
|
+
default: () => [string, string];
|
|
355
|
+
};
|
|
356
|
+
showCodeBlockHeader: {
|
|
357
|
+
type: BooleanConstructor;
|
|
358
|
+
default: boolean;
|
|
359
|
+
};
|
|
360
|
+
stickyCodeBlockHeader: {
|
|
361
|
+
type: BooleanConstructor;
|
|
362
|
+
default: boolean;
|
|
363
|
+
};
|
|
364
|
+
codeMaxHeight: {
|
|
365
|
+
type: StringConstructor;
|
|
366
|
+
default: undefined;
|
|
367
|
+
};
|
|
368
|
+
codeBlockActions: {
|
|
369
|
+
type: PropType<CodeBlockAction[]>;
|
|
370
|
+
default: undefined;
|
|
371
|
+
};
|
|
372
|
+
mermaidActions: {
|
|
373
|
+
type: PropType<MermaidAction[]>;
|
|
374
|
+
default: undefined;
|
|
375
|
+
};
|
|
376
|
+
mermaidConfig: {
|
|
377
|
+
type: PropType<Record<string, any>>;
|
|
378
|
+
default: undefined;
|
|
379
|
+
};
|
|
380
|
+
codeXRender: {
|
|
381
|
+
type: ObjectConstructor;
|
|
382
|
+
default: () => {};
|
|
383
|
+
};
|
|
384
|
+
customAttrs: {
|
|
385
|
+
type: PropType<CustomAttrs>;
|
|
386
|
+
default: () => {};
|
|
387
|
+
};
|
|
388
|
+
remarkPlugins: {
|
|
389
|
+
type: PropType<PluggableList>;
|
|
390
|
+
default: () => never[];
|
|
391
|
+
};
|
|
392
|
+
remarkPluginsAhead: {
|
|
393
|
+
type: PropType<PluggableList>;
|
|
394
|
+
default: () => never[];
|
|
395
|
+
};
|
|
396
|
+
rehypePlugins: {
|
|
397
|
+
type: PropType<PluggableList>;
|
|
398
|
+
default: () => never[];
|
|
399
|
+
};
|
|
400
|
+
rehypePluginsAhead: {
|
|
401
|
+
type: PropType<PluggableList>;
|
|
402
|
+
default: () => never[];
|
|
403
|
+
};
|
|
404
|
+
rehypeOptions: {
|
|
405
|
+
type: PropType<Record<string, any>>;
|
|
406
|
+
default: () => {};
|
|
407
|
+
};
|
|
408
|
+
sanitize: {
|
|
409
|
+
type: BooleanConstructor;
|
|
410
|
+
default: boolean;
|
|
411
|
+
};
|
|
412
|
+
sanitizeOptions: {
|
|
413
|
+
type: PropType<SanitizeOptions>;
|
|
414
|
+
default: () => {};
|
|
415
|
+
};
|
|
416
|
+
}>> & Readonly<{}>, {
|
|
417
|
+
sanitize: boolean;
|
|
418
|
+
markdown: string;
|
|
419
|
+
customAttrs: CustomAttrs;
|
|
420
|
+
remarkPlugins: PluggableList;
|
|
421
|
+
rehypePlugins: PluggableList;
|
|
422
|
+
rehypeOptions: Record<string, any>;
|
|
423
|
+
sanitizeOptions: SanitizeOptions;
|
|
424
|
+
codeXRender: Record<string, any>;
|
|
425
|
+
isDark: boolean;
|
|
426
|
+
shikiTheme: [string, string];
|
|
427
|
+
enableAnimate: boolean;
|
|
428
|
+
showCodeBlockHeader: boolean;
|
|
429
|
+
stickyCodeBlockHeader: boolean;
|
|
430
|
+
codeMaxHeight: string;
|
|
431
|
+
codeBlockActions: CodeBlockAction[];
|
|
432
|
+
mermaidActions: MermaidAction[];
|
|
433
|
+
mermaidConfig: Record<string, any>;
|
|
434
|
+
allowHtml: boolean;
|
|
435
|
+
enableLatex: boolean;
|
|
436
|
+
enableBreaks: boolean;
|
|
437
|
+
enableGfm: boolean;
|
|
438
|
+
rehypePluginsAhead: PluggableList;
|
|
439
|
+
remarkPluginsAhead: PluggableList;
|
|
440
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
441
|
+
export { MarkdownRenderer, MarkdownRendererAsync };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Element, Root, RootContent } from 'hast';
|
|
2
|
+
import type { MaybeRefOrGetter, Slots, VNode, VNodeArrayChildren } from 'vue';
|
|
3
|
+
import type { AliasList, Context, CustomAttrs } from './types';
|
|
4
|
+
export declare function render(hast: Root, attrs: Record<string, unknown>, slots?: Slots, customAttrs?: MaybeRefOrGetter<CustomAttrs>): VNode;
|
|
5
|
+
export declare function renderChildren(nodeList: (RootContent | Root)[], ctx: Context, parent: Element | Root, slots: Slots, customAttrs: CustomAttrs, keyCounter: {
|
|
6
|
+
[key: string]: number;
|
|
7
|
+
}): VNodeArrayChildren;
|
|
8
|
+
export declare function getVNodeInfos(node: RootContent, parent: Element | Root, context: Context, keyCounter: Record<string, number>, customAttrs: CustomAttrs): {
|
|
9
|
+
attrs: Record<string, unknown>;
|
|
10
|
+
context: Context;
|
|
11
|
+
aliasList: AliasList;
|
|
12
|
+
vnodeProps: Record<string, any>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { VueMarkdown, VueMarkdownAsync } from './components';
|
|
2
|
+
export { getVNodeInfos, render, renderChildren } from './hast-to-vnode';
|
|
3
|
+
export type * from './types';
|
|
4
|
+
export type { CodeLineProps } from '../components/CodeLine/types';
|
|
5
|
+
export type { MarkdownContext } from '../MarkdownRender/types';
|
|
6
|
+
export { createProcessor, useMarkdownProcessor } from './useProcessor';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Root } from 'hast';
|
|
2
|
+
import type { Root as MdastRoot } from 'mdast';
|
|
3
|
+
import type { Options as TRehypeOptions } from 'mdast-util-to-hast';
|
|
4
|
+
import type { PluggableList, Processor } from 'unified';
|
|
5
|
+
import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
6
|
+
import type { SanitizeOptions } from './types';
|
|
7
|
+
export interface TUseMarkdownProcessorOptions {
|
|
8
|
+
remarkPlugins?: MaybeRefOrGetter<PluggableList>;
|
|
9
|
+
rehypePlugins?: MaybeRefOrGetter<PluggableList>;
|
|
10
|
+
rehypeOptions?: MaybeRefOrGetter<Omit<TRehypeOptions, 'file'>>;
|
|
11
|
+
sanitize?: MaybeRefOrGetter<boolean>;
|
|
12
|
+
sanitizeOptions?: MaybeRefOrGetter<SanitizeOptions>;
|
|
13
|
+
}
|
|
14
|
+
export declare function useMarkdownProcessor(options?: TUseMarkdownProcessorOptions): {
|
|
15
|
+
processor: ComputedRef<Processor<MdastRoot, MdastRoot, Root, undefined, undefined>>;
|
|
16
|
+
};
|
|
17
|
+
export declare function createProcessor(options?: {
|
|
18
|
+
prePlugins?: PluggableList;
|
|
19
|
+
rehypePlugins?: PluggableList;
|
|
20
|
+
rehypeOptions?: Omit<TRehypeOptions, 'file'>;
|
|
21
|
+
sanitize?: boolean;
|
|
22
|
+
sanitizeOptions?: SanitizeOptions;
|
|
23
|
+
}): Processor<any, any, any, any, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CodeBlockAction } from '../components/CodeBlock/types';
|
|
2
|
+
import type { MermaidAction } from '../components/Mermaid/types';
|
|
3
|
+
type ShikiThemeName = 'vitesse-light' | 'vitesse-dark' | 'github-light' | 'github-dark' | 'nord' | 'one-dark-pro' | string;
|
|
4
|
+
interface UseComponentsOptions {
|
|
5
|
+
codeXRender?: Record<string, any>;
|
|
6
|
+
isDark?: boolean;
|
|
7
|
+
shikiTheme?: [ShikiThemeName, ShikiThemeName];
|
|
8
|
+
enableAnimate?: boolean;
|
|
9
|
+
showCodeBlockHeader?: boolean;
|
|
10
|
+
stickyCodeBlockHeader?: boolean;
|
|
11
|
+
codeMaxHeight?: string;
|
|
12
|
+
codeBlockActions?: CodeBlockAction[];
|
|
13
|
+
mermaidActions?: MermaidAction[];
|
|
14
|
+
mermaidConfig?: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
declare function useComponents(props?: UseComponentsOptions): {
|
|
17
|
+
code: (raw: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export { useComponents };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Ref, type MaybeRef, type CSSProperties } from 'vue';
|
|
2
|
+
interface HighlightToken {
|
|
3
|
+
content?: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
fontStyle?: 'italic' | null;
|
|
6
|
+
fontWeight?: 'normal' | 'bold' | null;
|
|
7
|
+
htmlStyle?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
interface StreamingHighlightResult {
|
|
10
|
+
colorReplacements?: Record<string, string>;
|
|
11
|
+
lines: HighlightToken[][];
|
|
12
|
+
preStyle?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
interface UseHighlightOptions {
|
|
15
|
+
language: MaybeRef<string>;
|
|
16
|
+
theme?: string | Ref<string>;
|
|
17
|
+
colorReplacements?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
export declare function useHighlight(text: Ref<string>, options: UseHighlightOptions): {
|
|
20
|
+
streaming: Ref<StreamingHighlightResult | undefined, StreamingHighlightResult | undefined>;
|
|
21
|
+
lines: import("vue").ComputedRef<HighlightToken[][]>;
|
|
22
|
+
preStyle: import("vue").ComputedRef<CSSProperties | undefined>;
|
|
23
|
+
isLoading: Ref<boolean, boolean>;
|
|
24
|
+
error: Ref<Error | null, Error | null>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { MermaidZoomControls, UseMermaidZoomOptions, UseMermaidResult } from '../components/Mermaid/types';
|
|
3
|
+
export declare function downloadSvgAsPng(svg: string): void;
|
|
4
|
+
interface UseMermaidOptions {
|
|
5
|
+
id?: string;
|
|
6
|
+
theme?: 'default' | 'dark' | 'forest' | 'neutral' | string;
|
|
7
|
+
config?: any;
|
|
8
|
+
container?: HTMLElement | Ref<HTMLElement | null> | null;
|
|
9
|
+
}
|
|
10
|
+
type UseMermaidOptionsInput = UseMermaidOptions | Ref<UseMermaidOptions>;
|
|
11
|
+
/**
|
|
12
|
+
* 同步检查缓存状态(不触发检测)
|
|
13
|
+
* @returns 缓存状态,null 表示未检测
|
|
14
|
+
*/
|
|
15
|
+
export declare function getMermaidAvailableCache(): boolean | null;
|
|
16
|
+
/**
|
|
17
|
+
* 检测 mermaid 是否可用(全局缓存,只检测一次)
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkMermaidAvailable(): Promise<boolean>;
|
|
20
|
+
export declare function useMermaid(content: string | Ref<string>, options?: UseMermaidOptionsInput): UseMermaidResult;
|
|
21
|
+
export declare function useMermaidZoom(options: UseMermaidZoomOptions): MermaidZoomControls;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
export type ThemeMode = 'light' | 'dark' | 'auto';
|
|
3
|
+
export type ShikiThemeName = string;
|
|
4
|
+
export declare const themeMap: {
|
|
5
|
+
readonly light: "vitesse-light";
|
|
6
|
+
readonly dark: "vitesse-dark";
|
|
7
|
+
};
|
|
8
|
+
export interface UseThemeOptions {
|
|
9
|
+
mode?: ThemeMode | Ref<ThemeMode>;
|
|
10
|
+
theme?: ShikiThemeName | Ref<ShikiThemeName | undefined>;
|
|
11
|
+
lightTheme?: ShikiThemeName;
|
|
12
|
+
darkTheme?: ShikiThemeName;
|
|
13
|
+
}
|
|
14
|
+
export interface UseThemeReturn {
|
|
15
|
+
mode: Ref<ThemeMode>;
|
|
16
|
+
isDark: Ref<boolean>;
|
|
17
|
+
actualTheme: Ref<ShikiThemeName>;
|
|
18
|
+
setMode: (mode: ThemeMode) => void;
|
|
19
|
+
toggleMode: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 主题管理 Hook
|
|
23
|
+
* 支持 light/dark/auto 模式切换
|
|
24
|
+
*/
|
|
25
|
+
export declare function useTheme(options?: UseThemeOptions): UseThemeReturn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* x-markdown-vue 主入口
|
|
3
|
+
*
|
|
4
|
+
* 本库使用显式导出以优化 Tree Shaking
|
|
5
|
+
* 请根据需要按需导入,而不是导入整个库
|
|
6
|
+
*/
|
|
7
|
+
export { VueMarkdown, VueMarkdownAsync } from './core/components';
|
|
8
|
+
export { MarkdownRenderer, MarkdownRendererAsync } from './MarkdownRender';
|
|
9
|
+
export { getVNodeInfos, render, renderChildren } from './core/hast-to-vnode';
|
|
10
|
+
export { createProcessor, useMarkdownProcessor } from './core/useProcessor';
|
|
11
|
+
export { useComponents } from './hooks/useComponents';
|
|
12
|
+
export { useHighlight } from './hooks/useHighlight';
|
|
13
|
+
export { useProcessMarkdown, preprocessLaTeX } from './hooks/useMarkdown';
|
|
14
|
+
export { useMermaid } from './hooks/useMermaid';
|
|
15
|
+
export { usePlugins } from './hooks/usePlugins';
|
|
16
|
+
export { useTheme } from './hooks/useTheme';
|
|
17
|
+
export type * from './core/types';
|
|
18
|
+
export type { CodeLineProps } from './components/CodeLine/types';
|
|
19
|
+
export type { CodeBlockProps } from './components/CodeBlock/types';
|
|
20
|
+
export type { MermaidProps } from './components/Mermaid/types';
|
|
21
|
+
export type { MarkdownContext } from './MarkdownRender/types';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DtKeGkdv.cjs");exports.MarkdownRenderer=e.MarkdownRenderer,exports.MarkdownRendererAsync=e.MarkdownRendererAsync,exports.VueMarkdown=e.VueMarkdown,exports.VueMarkdownAsync=e.VueMarkdownAsync,exports.createProcessor=e.createProcessor,exports.getVNodeInfos=e.getVNodeInfos,exports.preprocessLaTeX=e.preprocessLaTeX,exports.render=e.render,exports.renderChildren=e.renderChildren,exports.useComponents=e.useComponents,exports.useHighlight=e.useHighlight,exports.useMarkdownProcessor=e.useMarkdownProcessor,exports.useMermaid=e.useMermaid,exports.usePlugins=e.usePlugins,exports.useProcessMarkdown=e.useProcessMarkdown,exports.useTheme=e.useTheme;
|
|
2
|
+
//# sourceMappingURL=x-markdown.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-markdown.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|