@coderminer/vue-markdown 0.0.0-stage → 1.0.1
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/CHANGELOG.md +226 -0
- package/LICENSE +21 -0
- package/README.md +584 -3
- package/README.zh-CN.md +550 -0
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +16 -0
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js +16 -0
- package/dist/chunks/MarkdownCode-B1k9tmW5.js +63 -0
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +49 -0
- package/dist/chunks/MarkdownContent-BAK6dqo7.js +13 -0
- package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js +16 -0
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +14 -0
- package/dist/chunks/MarkdownError-C0sPs5W0.js +17 -0
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +22 -0
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +21 -0
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js +29 -0
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +16 -0
- package/dist/chunks/MarkdownHtml-66lYkvwM.js +13 -0
- package/dist/chunks/MarkdownImage-BRy76svs.js +51 -0
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +16 -0
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js +45 -0
- package/dist/chunks/MarkdownList-BJ-_C71k.js +20 -0
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js +16 -0
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js +15 -0
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +16 -0
- package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js +23 -0
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +16 -0
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +16 -0
- package/dist/chunks/MarkdownTable-DmBTg_CR.js +16 -0
- package/dist/chunks/MarkdownTableCell-eiCJe847.js +31 -0
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js +16 -0
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js +24 -0
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +38 -0
- package/dist/chunks/MarkdownToc-DHWWoH6t.js +49 -0
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +25 -0
- package/dist/chunks/MermaidLiveEditor-1TKkI5bp.js +414 -0
- package/dist/chunks/VueSyntaxHighlighter-BWpCO-cX.js +260 -0
- package/dist/chunks/adapters-CMwX_NEI.js +26 -0
- package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
- package/dist/chunks/blank-line-CKKsFeKR.js +88 -0
- package/dist/chunks/codemirror-DyphMAEg.js +82 -0
- package/dist/chunks/config-aRYo2R8_.js +10 -0
- package/dist/chunks/context-8NfW6fxI.js +30 -0
- package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
- package/dist/chunks/default-ZQ5aHh-N.js +3 -0
- package/dist/chunks/diagnostics-CtHoJyiX.js +23 -0
- package/dist/chunks/export-BrgMLgUp.js +1574 -0
- package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
- package/dist/chunks/hast-util-from-html-D3e_iQ89.js +5088 -0
- package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
- package/dist/chunks/identity-Bi27FKyx.js +6243 -0
- package/dist/chunks/labels-BtHiUTQI.js +47 -0
- package/dist/chunks/lib-CCnkLL6S.js +252 -0
- package/dist/chunks/longest-streak-DZE_EqsU.js +8 -0
- package/dist/chunks/micromark-factory-space-CpXAnYUY.js +137 -0
- package/dist/chunks/normalize-VKfQXZiK.js +226 -0
- package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
- package/dist/chunks/plugin-YWo5uqTh.js +27 -0
- package/dist/chunks/preset-BjaOuJUL.js +44 -0
- package/dist/chunks/registry-B7BfEkuy.js +6150 -0
- package/dist/chunks/render-DAqK0w5J.js +1754 -0
- package/dist/chunks/rolldown-runtime-QGRDbDUS.js +19 -0
- package/dist/chunks/runtime-D95F41zG.js +574 -0
- package/dist/chunks/security-y4EwUyAs.js +212 -0
- package/dist/chunks/shared-NjFDPmkb.js +67 -0
- package/dist/chunks/space-separated-tokens-1ebNqf35.js +1097 -0
- package/dist/chunks/url-D2BoivaE.js +24 -0
- package/dist/chunks/useActiveHeading-CnyGTG1u.js +359 -0
- package/dist/components/CodeBlock.d.ts +73 -0
- package/dist/components/CodeBlock.js +1 -0
- package/dist/components/Icon.d.ts +6 -0
- package/dist/components/MarkdownBlockquote.d.ts +18 -0
- package/dist/components/MarkdownBlockquote.js +1 -0
- package/dist/components/MarkdownBreak.d.ts +8 -0
- package/dist/components/MarkdownBreak.js +1 -0
- package/dist/components/MarkdownChildren.d.ts +17 -0
- package/dist/components/MarkdownCode.d.ts +29 -0
- package/dist/components/MarkdownCode.js +1 -0
- package/dist/components/MarkdownConfigProvider.d.ts +33 -0
- package/dist/components/MarkdownConfigProvider.js +1 -0
- package/dist/components/MarkdownContent.d.ts +16 -0
- package/dist/components/MarkdownContent.js +1 -0
- package/dist/components/MarkdownCustomTag.d.ts +20 -0
- package/dist/components/MarkdownCustomTag.js +1 -0
- package/dist/components/MarkdownEmphasis.d.ts +18 -0
- package/dist/components/MarkdownEmphasis.js +1 -0
- package/dist/components/MarkdownEmpty.d.ts +8 -0
- package/dist/components/MarkdownEmpty.js +1 -0
- package/dist/components/MarkdownError.d.ts +11 -0
- package/dist/components/MarkdownError.js +1 -0
- package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
- package/dist/components/MarkdownFootnoteReference.js +1 -0
- package/dist/components/MarkdownFootnotes.d.ts +17 -0
- package/dist/components/MarkdownFootnotes.js +1 -0
- package/dist/components/MarkdownHeading.d.ts +18 -0
- package/dist/components/MarkdownHeading.js +1 -0
- package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
- package/dist/components/MarkdownHorizontalRule.js +1 -0
- package/dist/components/MarkdownHtml.d.ts +8 -0
- package/dist/components/MarkdownHtml.js +1 -0
- package/dist/components/MarkdownImage.d.ts +15 -0
- package/dist/components/MarkdownImage.js +1 -0
- package/dist/components/MarkdownInlineCode.d.ts +18 -0
- package/dist/components/MarkdownInlineCode.js +1 -0
- package/dist/components/MarkdownLink.d.ts +22 -0
- package/dist/components/MarkdownLink.js +1 -0
- package/dist/components/MarkdownList.d.ts +18 -0
- package/dist/components/MarkdownList.js +1 -0
- package/dist/components/MarkdownListItem.d.ts +18 -0
- package/dist/components/MarkdownListItem.js +1 -0
- package/dist/components/MarkdownLoading.d.ts +8 -0
- package/dist/components/MarkdownLoading.js +1 -0
- package/dist/components/MarkdownMath.d.ts +12 -0
- package/dist/components/MarkdownMath.js +1 -0
- package/dist/components/MarkdownMermaid.d.ts +78 -0
- package/dist/components/MarkdownMermaid.js +1 -0
- package/dist/components/MarkdownParagraph.d.ts +18 -0
- package/dist/components/MarkdownParagraph.js +1 -0
- package/dist/components/MarkdownRenderer.d.ts +167 -0
- package/dist/components/MarkdownRenderer.js +1 -0
- package/dist/components/MarkdownRoot.d.ts +24 -0
- package/dist/components/MarkdownRoot.js +1 -0
- package/dist/components/MarkdownStrikethrough.d.ts +18 -0
- package/dist/components/MarkdownStrikethrough.js +1 -0
- package/dist/components/MarkdownStrong.d.ts +18 -0
- package/dist/components/MarkdownStrong.js +1 -0
- package/dist/components/MarkdownTable.d.ts +18 -0
- package/dist/components/MarkdownTable.js +1 -0
- package/dist/components/MarkdownTableCell.d.ts +20 -0
- package/dist/components/MarkdownTableCell.js +1 -0
- package/dist/components/MarkdownTableRow.d.ts +18 -0
- package/dist/components/MarkdownTableRow.js +1 -0
- package/dist/components/MarkdownTableSection.d.ts +18 -0
- package/dist/components/MarkdownTableSection.js +1 -0
- package/dist/components/MarkdownTaskItem.d.ts +20 -0
- package/dist/components/MarkdownTaskItem.js +1 -0
- package/dist/components/MarkdownToc.d.ts +36 -0
- package/dist/components/MarkdownToc.js +1 -0
- package/dist/components/MarkdownTocItem.d.ts +14 -0
- package/dist/components/MarkdownTocItem.js +1 -0
- package/dist/components/MermaidBlock.d.ts +50 -0
- package/dist/components/MermaidBlock.js +1 -0
- package/dist/components/MermaidLiveEditor.d.ts +44 -0
- package/dist/components/MermaidLiveEditor.js +1 -0
- package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
- package/dist/components/VueSyntaxHighlighter.js +1 -0
- package/dist/components/codeRegion.d.ts +14 -0
- package/dist/components/config.d.ts +7 -0
- package/dist/components/context.d.ts +45 -0
- package/dist/components/index.d.ts +42 -0
- package/dist/components/index.js +38 -0
- package/dist/components/render.d.ts +9 -0
- package/dist/components/scroll-lock.d.ts +7 -0
- package/dist/components/types.d.ts +61 -0
- package/dist/composables/useActiveHeading.d.ts +12 -0
- package/dist/composables/useCodeHighlighter.d.ts +30 -0
- package/dist/composables/useLineWindow.d.ts +38 -0
- package/dist/composables/useMarkdownDocument.d.ts +25 -0
- package/dist/core/adapters.d.ts +7 -0
- package/dist/core/config.d.ts +5 -0
- package/dist/core/diagnostics.d.ts +9 -0
- package/dist/core/finalize.d.ts +18 -0
- package/dist/core/hast-nodes.d.ts +3 -0
- package/dist/core/hast-to-nodes.d.ts +9 -0
- package/dist/core/highlight-lines.d.ts +8 -0
- package/dist/core/identity.d.ts +4 -0
- package/dist/core/labels.d.ts +4 -0
- package/dist/core/manifest.d.ts +38 -0
- package/dist/core/memo.d.ts +5 -0
- package/dist/core/model-hast.d.ts +8 -0
- package/dist/core/model.d.ts +10 -0
- package/dist/core/normalize.d.ts +37 -0
- package/dist/core/parts.d.ts +136 -0
- package/dist/core/preset.d.ts +10 -0
- package/dist/core/run.d.ts +16 -0
- package/dist/core/search.d.ts +5 -0
- package/dist/core/security.d.ts +21 -0
- package/dist/core/slugger.d.ts +13 -0
- package/dist/core/types.d.ts +392 -0
- package/dist/core/url.d.ts +10 -0
- package/dist/editor/codemirror.d.ts +14 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.js +1 -0
- package/dist/export/index.d.ts +6 -0
- package/dist/headless.d.ts +21 -0
- package/dist/headless.js +12 -0
- package/dist/highlight/convert-hast.d.ts +8 -0
- package/dist/highlight/highlightjs.d.ts +7 -0
- package/dist/highlight/index.d.ts +4 -0
- package/dist/highlight/index.js +4 -0
- package/dist/highlight/shared.d.ts +11 -0
- package/dist/highlight/shiki.d.ts +7 -0
- package/dist/highlight/shiki.js +75 -0
- package/dist/html/index.d.ts +17 -0
- package/dist/html/index.js +11 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +53 -0
- package/dist/math/index.d.ts +4 -0
- package/dist/math/index.js +585 -0
- package/dist/math/katex.d.ts +4 -0
- package/dist/math/plugin.d.ts +20 -0
- package/dist/mermaid/index.d.ts +6 -0
- package/dist/mermaid/index.js +8 -0
- package/dist/mermaid/plugin.d.ts +17 -0
- package/dist/mermaid/runtime.d.ts +14 -0
- package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
- package/dist/mermaid/sanitize-svg.d.ts +3 -0
- package/dist/mermaid/sanitize.d.ts +16 -0
- package/dist/node-components.d.ts +1 -0
- package/dist/node-components.js +39 -0
- package/dist/pipeline/custom.d.ts +8 -0
- package/dist/pipeline/identity.d.ts +12 -0
- package/dist/pipeline/index.d.ts +5 -0
- package/dist/pipeline/official.d.ts +6 -0
- package/dist/pipeline.d.ts +1 -0
- package/dist/pipeline.js +1 -0
- package/dist/plugins/builtin.d.ts +15 -0
- package/dist/plugins/define.d.ts +7 -0
- package/dist/plugins/registry.d.ts +16 -0
- package/dist/plugins/source.d.ts +7 -0
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js +1 -0
- package/dist/presets.d.ts +3 -0
- package/dist/presets.js +1 -0
- package/dist/style.css +2 -0
- package/dist/styles/components.css +737 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/math-full.css +3 -0
- package/dist/styles/math.css +18 -0
- package/dist/styles/tokens.css +96 -0
- package/package.json +214 -6
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { Root } from 'hast';
|
|
2
|
+
import { PluggableList } from 'unified';
|
|
3
|
+
/** A position inside the original Markdown source. */
|
|
4
|
+
export interface SourcePosition {
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
}
|
|
9
|
+
/** A half-open range inside the original Markdown source. */
|
|
10
|
+
export interface SourceRange {
|
|
11
|
+
start: SourcePosition;
|
|
12
|
+
end: SourcePosition;
|
|
13
|
+
}
|
|
14
|
+
/** A piece of a text node, optionally marked as a search match. */
|
|
15
|
+
export interface MarkdownTextSegment {
|
|
16
|
+
value: string;
|
|
17
|
+
match?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface MarkdownTextNode {
|
|
20
|
+
kind: 'text';
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
segments?: MarkdownTextSegment[];
|
|
24
|
+
source?: SourceRange;
|
|
25
|
+
}
|
|
26
|
+
export interface MarkdownElementNode {
|
|
27
|
+
kind: 'element';
|
|
28
|
+
key: string;
|
|
29
|
+
tag: string;
|
|
30
|
+
attrs: Record<string, string>;
|
|
31
|
+
children: MarkdownNode[];
|
|
32
|
+
source?: SourceRange;
|
|
33
|
+
}
|
|
34
|
+
export interface MarkdownCodeNode {
|
|
35
|
+
kind: 'code';
|
|
36
|
+
key: string;
|
|
37
|
+
code: string;
|
|
38
|
+
language: string;
|
|
39
|
+
highlighted?: MarkdownNode[];
|
|
40
|
+
source?: SourceRange;
|
|
41
|
+
}
|
|
42
|
+
export interface MarkdownMathNode {
|
|
43
|
+
kind: 'math';
|
|
44
|
+
key: string;
|
|
45
|
+
tex: string;
|
|
46
|
+
displayMode: boolean;
|
|
47
|
+
rendered?: MarkdownNode[];
|
|
48
|
+
source?: SourceRange;
|
|
49
|
+
}
|
|
50
|
+
export interface MarkdownMermaidNode {
|
|
51
|
+
kind: 'mermaid';
|
|
52
|
+
key: string;
|
|
53
|
+
code: string;
|
|
54
|
+
complete: boolean;
|
|
55
|
+
index: number;
|
|
56
|
+
source?: SourceRange;
|
|
57
|
+
}
|
|
58
|
+
export interface MarkdownCustomTagNode {
|
|
59
|
+
kind: 'custom';
|
|
60
|
+
key: string;
|
|
61
|
+
tag: string;
|
|
62
|
+
props: Record<string, unknown>;
|
|
63
|
+
attrs: Record<string, string>;
|
|
64
|
+
children: MarkdownNode[];
|
|
65
|
+
source?: SourceRange;
|
|
66
|
+
}
|
|
67
|
+
export interface MarkdownPluginNode {
|
|
68
|
+
kind: 'plugin';
|
|
69
|
+
key: string;
|
|
70
|
+
type: string;
|
|
71
|
+
payload: unknown;
|
|
72
|
+
children?: MarkdownNode[];
|
|
73
|
+
source?: SourceRange;
|
|
74
|
+
}
|
|
75
|
+
/** The immutable, serializable document model. */
|
|
76
|
+
export type MarkdownNode = MarkdownTextNode | MarkdownElementNode | MarkdownCodeNode | MarkdownMathNode | MarkdownMermaidNode | MarkdownCustomTagNode | MarkdownPluginNode;
|
|
77
|
+
export interface TocItem {
|
|
78
|
+
id: string;
|
|
79
|
+
text: string;
|
|
80
|
+
level: number;
|
|
81
|
+
}
|
|
82
|
+
/** Renderer-level search state emitted with `search-change`. */
|
|
83
|
+
export interface SearchChangePayload {
|
|
84
|
+
query: string;
|
|
85
|
+
caseSensitive: boolean;
|
|
86
|
+
matches: number;
|
|
87
|
+
}
|
|
88
|
+
/** Options for segmenting text nodes into search matches. */
|
|
89
|
+
export interface SearchOptions {
|
|
90
|
+
query?: string;
|
|
91
|
+
caseSensitive?: boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface CustomTagInstance {
|
|
94
|
+
key: string;
|
|
95
|
+
tag: string;
|
|
96
|
+
props: Record<string, unknown>;
|
|
97
|
+
attrs: Record<string, string>;
|
|
98
|
+
}
|
|
99
|
+
export interface MarkdownDocument {
|
|
100
|
+
nodes: MarkdownNode[];
|
|
101
|
+
toc: TocItem[];
|
|
102
|
+
customTags: CustomTagInstance[];
|
|
103
|
+
frontmatter?: Record<string, unknown>;
|
|
104
|
+
plugins: string[];
|
|
105
|
+
pipeline: string;
|
|
106
|
+
}
|
|
107
|
+
export type DiagnosticSeverity = 'error' | 'warning';
|
|
108
|
+
export type DiagnosticPhase = 'setup' | 'source' | 'remark' | 'rehype' | 'normalize' | 'document' | 'search' | 'render' | 'pipeline';
|
|
109
|
+
export interface MarkdownDiagnostic {
|
|
110
|
+
code: string;
|
|
111
|
+
message: string;
|
|
112
|
+
severity: DiagnosticSeverity;
|
|
113
|
+
phase?: DiagnosticPhase;
|
|
114
|
+
plugin?: string;
|
|
115
|
+
source?: SourceRange;
|
|
116
|
+
/** Optional raw parser/engine detail shown only by opt-in UI. */
|
|
117
|
+
details?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A component reference accepted by the core types.
|
|
121
|
+
*
|
|
122
|
+
* The core stays free of Vue types; the Vue-facing aliases in
|
|
123
|
+
* `components/types.ts` narrow this to Vue's `Component`.
|
|
124
|
+
*/
|
|
125
|
+
export type MarkdownComponentValue = string | object | ((...args: never[]) => unknown) | undefined;
|
|
126
|
+
export type MarkdownTagComponents = Record<string, MarkdownComponentValue>;
|
|
127
|
+
export type MarkdownNodeComponents = Record<string, MarkdownComponentValue>;
|
|
128
|
+
export interface MarkdownRegionComponents {
|
|
129
|
+
root?: MarkdownComponentValue;
|
|
130
|
+
content?: MarkdownComponentValue;
|
|
131
|
+
toc?: MarkdownComponentValue;
|
|
132
|
+
tocItem?: MarkdownComponentValue;
|
|
133
|
+
codeBlock?: MarkdownComponentValue;
|
|
134
|
+
mermaidBlock?: MarkdownComponentValue;
|
|
135
|
+
error?: MarkdownComponentValue;
|
|
136
|
+
empty?: MarkdownComponentValue;
|
|
137
|
+
loading?: MarkdownComponentValue;
|
|
138
|
+
}
|
|
139
|
+
export type MarkdownLabelContext = Record<string, unknown>;
|
|
140
|
+
export type MarkdownLabelValue = string | ((context: MarkdownLabelContext) => string);
|
|
141
|
+
export interface MarkdownLabels {
|
|
142
|
+
toc: MarkdownLabelValue;
|
|
143
|
+
error: MarkdownLabelValue;
|
|
144
|
+
empty: MarkdownLabelValue;
|
|
145
|
+
loading: MarkdownLabelValue;
|
|
146
|
+
headingAnchor: MarkdownLabelValue;
|
|
147
|
+
externalLink: MarkdownLabelValue;
|
|
148
|
+
copy: MarkdownLabelValue;
|
|
149
|
+
copied: MarkdownLabelValue;
|
|
150
|
+
copyFailed: MarkdownLabelValue;
|
|
151
|
+
download: MarkdownLabelValue;
|
|
152
|
+
footnoteReference: MarkdownLabelValue;
|
|
153
|
+
footnotes: MarkdownLabelValue;
|
|
154
|
+
math: MarkdownLabelValue;
|
|
155
|
+
mermaid: MarkdownLabelValue;
|
|
156
|
+
mermaidFallback: MarkdownLabelValue;
|
|
157
|
+
preview: MarkdownLabelValue;
|
|
158
|
+
source: MarkdownLabelValue;
|
|
159
|
+
retry: MarkdownLabelValue;
|
|
160
|
+
showAll: MarkdownLabelValue;
|
|
161
|
+
showLess: MarkdownLabelValue;
|
|
162
|
+
exportPng: MarkdownLabelValue;
|
|
163
|
+
fullscreen: MarkdownLabelValue;
|
|
164
|
+
exitFullscreen: MarkdownLabelValue;
|
|
165
|
+
zoomIn: MarkdownLabelValue;
|
|
166
|
+
zoomOut: MarkdownLabelValue;
|
|
167
|
+
reset: MarkdownLabelValue;
|
|
168
|
+
editor: MarkdownLabelValue;
|
|
169
|
+
editorEmpty: MarkdownLabelValue;
|
|
170
|
+
editorLine: MarkdownLabelValue;
|
|
171
|
+
editorSplitter: MarkdownLabelValue;
|
|
172
|
+
editorDiagnostics: MarkdownLabelValue;
|
|
173
|
+
editorReset: MarkdownLabelValue;
|
|
174
|
+
editorSyntaxError: MarkdownLabelValue;
|
|
175
|
+
editorParseError: MarkdownLabelValue;
|
|
176
|
+
}
|
|
177
|
+
export type MarkdownTheme = 'light' | 'dark' | 'auto' | 'custom';
|
|
178
|
+
export interface HighlightOptions {
|
|
179
|
+
theme?: string;
|
|
180
|
+
colorScheme?: 'light' | 'dark';
|
|
181
|
+
[option: string]: unknown;
|
|
182
|
+
}
|
|
183
|
+
export interface HighlightResult {
|
|
184
|
+
language: string;
|
|
185
|
+
nodes: MarkdownNode[];
|
|
186
|
+
mode?: 'content' | 'block';
|
|
187
|
+
className?: string;
|
|
188
|
+
}
|
|
189
|
+
/** A 1-based line number or an inclusive `start-end` range string. */
|
|
190
|
+
export type HighlightLine = number | string;
|
|
191
|
+
export interface CodeBlockAction {
|
|
192
|
+
key: string;
|
|
193
|
+
label: MarkdownLabelValue;
|
|
194
|
+
run(context: {
|
|
195
|
+
code: string;
|
|
196
|
+
language: string;
|
|
197
|
+
copy(): Promise<void>;
|
|
198
|
+
download(): Promise<void>;
|
|
199
|
+
}): void | Promise<void>;
|
|
200
|
+
}
|
|
201
|
+
export interface MermaidAction {
|
|
202
|
+
key: string;
|
|
203
|
+
label: MarkdownLabelValue;
|
|
204
|
+
run(context: {
|
|
205
|
+
source: string;
|
|
206
|
+
copy(): Promise<void>;
|
|
207
|
+
exportPng(): Promise<void>;
|
|
208
|
+
downloadSvg(): void;
|
|
209
|
+
fullscreen(): Promise<void> | void;
|
|
210
|
+
retry(): Promise<void>;
|
|
211
|
+
zoomIn(): void;
|
|
212
|
+
zoomOut(): void;
|
|
213
|
+
resetZoom(): void;
|
|
214
|
+
}): void | Promise<void>;
|
|
215
|
+
}
|
|
216
|
+
export interface MarkdownHighlighter {
|
|
217
|
+
id: string;
|
|
218
|
+
load?(): Promise<void>;
|
|
219
|
+
languages?: string[];
|
|
220
|
+
loadLanguage?(language: string): Promise<void>;
|
|
221
|
+
highlight(code: string, language: string, options: HighlightOptions): HighlightResult;
|
|
222
|
+
}
|
|
223
|
+
export interface MathRenderOptions {
|
|
224
|
+
displayMode?: boolean;
|
|
225
|
+
[option: string]: unknown;
|
|
226
|
+
}
|
|
227
|
+
export interface MathRenderResult {
|
|
228
|
+
nodes: MarkdownNode[];
|
|
229
|
+
error?: string;
|
|
230
|
+
}
|
|
231
|
+
export interface MathEngine {
|
|
232
|
+
id: string;
|
|
233
|
+
load?(): Promise<void>;
|
|
234
|
+
render(tex: string, options: MathRenderOptions): MathRenderResult;
|
|
235
|
+
}
|
|
236
|
+
export interface MermaidRenderOptions {
|
|
237
|
+
theme?: MarkdownTheme;
|
|
238
|
+
id?: string;
|
|
239
|
+
[option: string]: unknown;
|
|
240
|
+
}
|
|
241
|
+
export interface MermaidRenderResult {
|
|
242
|
+
nodes: MarkdownNode[];
|
|
243
|
+
svg?: string;
|
|
244
|
+
error?: string;
|
|
245
|
+
}
|
|
246
|
+
export interface MermaidRenderer {
|
|
247
|
+
id: string;
|
|
248
|
+
render(source: string, options: MermaidRenderOptions): MermaidRenderResult | Promise<MermaidRenderResult>;
|
|
249
|
+
}
|
|
250
|
+
export interface DiagnosticFormatter {
|
|
251
|
+
id?: string;
|
|
252
|
+
format(error: unknown, source: string): MarkdownDiagnostic;
|
|
253
|
+
}
|
|
254
|
+
/** Parsed configuration shared by the provider, presets, and the renderer. */
|
|
255
|
+
export interface MarkdownConfig {
|
|
256
|
+
theme?: MarkdownTheme;
|
|
257
|
+
tokens?: Record<string, string>;
|
|
258
|
+
labels?: Partial<MarkdownLabels>;
|
|
259
|
+
components?: MarkdownTagComponents;
|
|
260
|
+
regions?: MarkdownRegionComponents;
|
|
261
|
+
nodeComponents?: MarkdownNodeComponents;
|
|
262
|
+
plugins?: PluginInput[];
|
|
263
|
+
pipeline?: MarkdownPipeline;
|
|
264
|
+
highlighter?: MarkdownHighlighter;
|
|
265
|
+
mathEngine?: MathEngine;
|
|
266
|
+
mermaidRenderer?: MermaidRenderer;
|
|
267
|
+
diagnosticsFormatter?: DiagnosticFormatter;
|
|
268
|
+
slugger?: MarkdownSlugger;
|
|
269
|
+
urlTransform?: MarkdownUrlTransform;
|
|
270
|
+
}
|
|
271
|
+
/** A named, declarative bundle of configuration. Not JSON-serializable. */
|
|
272
|
+
export interface MarkdownPreset extends MarkdownConfig {
|
|
273
|
+
name: string;
|
|
274
|
+
}
|
|
275
|
+
export interface MarkdownSlugger {
|
|
276
|
+
slug(value: string): string;
|
|
277
|
+
reset?(): void;
|
|
278
|
+
}
|
|
279
|
+
export interface MarkdownElementLike {
|
|
280
|
+
tag: string;
|
|
281
|
+
attrs: Record<string, string>;
|
|
282
|
+
}
|
|
283
|
+
export type MarkdownUrlTransform = (url: string, key: string, node: MarkdownElementLike) => string | null | undefined;
|
|
284
|
+
export type AllowElement = (node: MarkdownElementNode, index: number | undefined, parent: MarkdownElementNode | undefined) => boolean | null | undefined;
|
|
285
|
+
/** Result of a pipeline run: hast plus optional document metadata. */
|
|
286
|
+
export interface PipelineResult {
|
|
287
|
+
hast: Root;
|
|
288
|
+
frontmatter?: Record<string, unknown>;
|
|
289
|
+
}
|
|
290
|
+
export interface PipelineCapabilities {
|
|
291
|
+
/** The pipeline exposes a synchronous path. */
|
|
292
|
+
sync?: boolean;
|
|
293
|
+
/** The pipeline reports plugin names. */
|
|
294
|
+
plugins?: boolean;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Add-only extension for the built-in raw HTML sanitizer. Property names use
|
|
298
|
+
* hast property casing (for example `srcSet`, `dateTime`). Extensions cannot
|
|
299
|
+
* remove the built-in strip list, change the URL policy, or bypass the core
|
|
300
|
+
* attribute policy.
|
|
301
|
+
*/
|
|
302
|
+
export interface HtmlSchemaExtension {
|
|
303
|
+
/** Extra tag names to allow. Dangerous tags remain stripped. */
|
|
304
|
+
tags?: string[];
|
|
305
|
+
/** Extra properties per tag; `'*'` applies to every tag. */
|
|
306
|
+
attributes?: Record<string, string[]>;
|
|
307
|
+
}
|
|
308
|
+
export interface PluginContext {
|
|
309
|
+
source: string;
|
|
310
|
+
options: MarkdownDocumentOptions;
|
|
311
|
+
diagnostics: MarkdownDiagnostic[];
|
|
312
|
+
addDiagnostic(diagnostic: MarkdownDiagnostic): void;
|
|
313
|
+
document?: MarkdownDocument;
|
|
314
|
+
}
|
|
315
|
+
export interface MarkdownPlugin {
|
|
316
|
+
name: string;
|
|
317
|
+
/**
|
|
318
|
+
* Core invariant markers cannot be disabled. Their names remain in the
|
|
319
|
+
* resolved set for ordering and diagnostics only.
|
|
320
|
+
*/
|
|
321
|
+
core?: boolean;
|
|
322
|
+
phase?: 'pre' | 'normal' | 'post';
|
|
323
|
+
/**
|
|
324
|
+
* This plugin enables raw HTML parsing. Its rehype plugins run before the
|
|
325
|
+
* built-in sanitizer, and the official pipeline always sanitizes the result.
|
|
326
|
+
*/
|
|
327
|
+
html?: boolean;
|
|
328
|
+
/** Add-only extension for the built-in raw HTML sanitizer. */
|
|
329
|
+
htmlSchema?: HtmlSchemaExtension;
|
|
330
|
+
remarkPlugins?: PluggableList;
|
|
331
|
+
rehypePlugins?: PluggableList;
|
|
332
|
+
remarkRehypeOptions?: Record<string, unknown>;
|
|
333
|
+
transformSource?(source: string, ctx: PluginContext): string;
|
|
334
|
+
transformDocument?(document: MarkdownDocument, ctx: PluginContext): MarkdownDocument | void;
|
|
335
|
+
nodeComponents?: MarkdownNodeComponents;
|
|
336
|
+
components?: MarkdownTagComponents;
|
|
337
|
+
regions?: MarkdownRegionComponents;
|
|
338
|
+
labels?: Partial<MarkdownLabels>;
|
|
339
|
+
tokens?: Record<string, string>;
|
|
340
|
+
setup?(ctx: PluginContext): void | (() => void);
|
|
341
|
+
onError?(error: unknown, phase: DiagnosticPhase, ctx: PluginContext): void;
|
|
342
|
+
}
|
|
343
|
+
export type PluginInput = MarkdownPlugin | false | null | undefined;
|
|
344
|
+
export interface PipelineContext {
|
|
345
|
+
source: string;
|
|
346
|
+
/**
|
|
347
|
+
* The options that produced this run. Optional for custom pipelines that do
|
|
348
|
+
* not need plugin callbacks.
|
|
349
|
+
*/
|
|
350
|
+
options?: MarkdownDocumentOptions;
|
|
351
|
+
plugins: MarkdownPlugin[];
|
|
352
|
+
remarkPlugins: PluggableList;
|
|
353
|
+
rehypePlugins: PluggableList;
|
|
354
|
+
remarkRehypeOptions: Record<string, unknown>;
|
|
355
|
+
slugger: MarkdownSlugger;
|
|
356
|
+
idPrefix: string;
|
|
357
|
+
diagnostics: MarkdownDiagnostic[];
|
|
358
|
+
}
|
|
359
|
+
export interface MarkdownPipeline {
|
|
360
|
+
name: string;
|
|
361
|
+
capabilities?: PipelineCapabilities;
|
|
362
|
+
process(source: string, ctx: PipelineContext): Promise<PipelineResult>;
|
|
363
|
+
processSync?(source: string, ctx: PipelineContext): PipelineResult;
|
|
364
|
+
dispose?(): void;
|
|
365
|
+
}
|
|
366
|
+
/** Target applied to links whose destination is outside the current base URL. */
|
|
367
|
+
export type MarkdownExternalLinkTarget = '_self' | '_blank';
|
|
368
|
+
export interface MarkdownDocumentOptions {
|
|
369
|
+
components?: MarkdownTagComponents;
|
|
370
|
+
nodeComponents?: MarkdownNodeComponents;
|
|
371
|
+
regions?: MarkdownRegionComponents;
|
|
372
|
+
labels?: Partial<MarkdownLabels>;
|
|
373
|
+
tokens?: Record<string, string>;
|
|
374
|
+
plugins?: PluginInput[];
|
|
375
|
+
disablePlugins?: string[];
|
|
376
|
+
remarkPlugins?: PluggableList;
|
|
377
|
+
rehypePlugins?: PluggableList;
|
|
378
|
+
remarkRehypeOptions?: Record<string, unknown>;
|
|
379
|
+
pipeline?: MarkdownPipeline;
|
|
380
|
+
slugger?: MarkdownSlugger;
|
|
381
|
+
allowedElements?: string[];
|
|
382
|
+
disallowedElements?: string[];
|
|
383
|
+
unwrapDisallowed?: boolean;
|
|
384
|
+
allowElement?: AllowElement;
|
|
385
|
+
urlTransform?: MarkdownUrlTransform;
|
|
386
|
+
linkTarget?: string;
|
|
387
|
+
externalLinkTarget?: MarkdownExternalLinkTarget;
|
|
388
|
+
baseUrl?: string;
|
|
389
|
+
idPrefix?: string;
|
|
390
|
+
/** Host-provided search state; search segments are recomputed when set. */
|
|
391
|
+
search?: SearchOptions;
|
|
392
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-markdown-compatible URL transform.
|
|
3
|
+
*
|
|
4
|
+
* Relative URLs and the documented protocol set pass through. Dangerous
|
|
5
|
+
* protocols are removed. Image data URLs are accepted for raster formats only;
|
|
6
|
+
* `image/svg+xml` is rejected because it can carry script.
|
|
7
|
+
*/
|
|
8
|
+
export declare function defaultUrlTransform(url: string, key?: string): string;
|
|
9
|
+
export declare function isExternalUrl(url: string): boolean;
|
|
10
|
+
export declare function resolveUrl(url: string, baseUrl: string | undefined): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EditorView } from '@codemirror/view';
|
|
2
|
+
export interface MermaidEditorHandle {
|
|
3
|
+
destroy(): void;
|
|
4
|
+
focus(): void;
|
|
5
|
+
setValue(value: string): void;
|
|
6
|
+
focusLine(line: number): void;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateEditorOptions {
|
|
9
|
+
value: string;
|
|
10
|
+
theme?: 'light' | 'dark' | 'auto' | 'custom';
|
|
11
|
+
onChange(value: string): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function createMermaidEditor(parent: HTMLElement, options: CreateEditorOptions): Promise<MermaidEditorHandle>;
|
|
14
|
+
export type { EditorView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as createMermaidEditor } from "../chunks/codemirror-DyphMAEg.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MarkdownDocumentOptions } from '../core/types';
|
|
2
|
+
export type StaticHtmlOptions = MarkdownDocumentOptions;
|
|
3
|
+
/** Render Markdown to static HTML with the same normalized document as rendering. */
|
|
4
|
+
export declare function exportMarkdownHtml(source: string, options?: StaticHtmlOptions): Promise<string>;
|
|
5
|
+
/** Synchronous static HTML export when every configured plugin is synchronous. */
|
|
6
|
+
export declare function exportMarkdownHtmlSync(source: string, options?: StaticHtmlOptions): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './core/types';
|
|
2
|
+
export * from './core/parts';
|
|
3
|
+
export * from './core/labels';
|
|
4
|
+
export * from './core/diagnostics';
|
|
5
|
+
export * from './core/url';
|
|
6
|
+
export * from './core/model';
|
|
7
|
+
export * from './core/normalize';
|
|
8
|
+
export * from './core/search';
|
|
9
|
+
export * from './core/slugger';
|
|
10
|
+
export * from './core/manifest';
|
|
11
|
+
export * from './core/config';
|
|
12
|
+
export * from './core/preset';
|
|
13
|
+
export * from './core/adapters';
|
|
14
|
+
export * from './export';
|
|
15
|
+
export * from './core/memo';
|
|
16
|
+
export * from './pipeline';
|
|
17
|
+
export * from './plugins/define';
|
|
18
|
+
export * from './plugins/builtin';
|
|
19
|
+
export * from './plugins/registry';
|
|
20
|
+
export * from './composables/useMarkdownDocument';
|
|
21
|
+
export * from './composables/useActiveHeading';
|
package/dist/headless.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./chunks/export-BrgMLgUp.js";
|
|
2
|
+
import { n as p, t as m } from "./chunks/labels-BtHiUTQI.js";
|
|
3
|
+
import { n as h, t as g } from "./chunks/diagnostics-CtHoJyiX.js";
|
|
4
|
+
import { n as _, r as v, t as y } from "./chunks/url-D2BoivaE.js";
|
|
5
|
+
import { a as b, i as x, n as S, o as C, r as w, t as T } from "./chunks/normalize-VKfQXZiK.js";
|
|
6
|
+
import { a as E, d as D, f as O, i as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I } from "./chunks/useActiveHeading-CnyGTG1u.js";
|
|
7
|
+
import { _ as L, a as R, c as z, d as B, f as V, g as H, h as U, i as W, l as G, n as K, o as q, p as J, r as Y, s as X, t as Z, u as Q } from "./chunks/registry-B7BfEkuy.js";
|
|
8
|
+
import { a as $, i as ee, n as te, r as ne, t as re } from "./chunks/preset-BjaOuJUL.js";
|
|
9
|
+
import { a as ie, i as ae, n as oe, o as se, r as ce, t as le } from "./chunks/adapters-CMwX_NEI.js";
|
|
10
|
+
import { a as ue, i as de, n as fe, o as pe, r as me, s as he, t as ge } from "./chunks/identity-Bi27FKyx.js";
|
|
11
|
+
import "./pipeline.js";
|
|
12
|
+
export { l as COMPONENT_MANIFESTS, m as DEFAULT_LABELS, u as PARTS, t as PART_NAMES, a as TOKENS, f as TOKEN_NAMES, n as VMD_CLASS_PREFIX, me as assertPipelineResult, O as buildDocument, K as codePlugin, T as collectCustomTags, re as composePresets, U as countSearchMatches, I as createDefaultSlugger, g as createDiagnostic, ge as createMemoKey, he as createOfficialPipeline, fe as createPipelineIdentity, B as createPluginContext, Y as customTagsPlugin, W as defaultPlugins, y as defaultUrlTransform, de as defineMarkdownPipeline, V as defineMarkdownPlugin, te as defineMarkdownPreset, h as errorMessage, d as exportMarkdownHtml, o as exportMarkdownHtmlSync, S as extractToc, w as filterTocByDepth, F as findElementById, R as frontmatterPlugin, q as fullPlugins, i as getComponentManifest, X as gfmPlugin, _ as isExternalUrl, le as isValidDiagnosticFormatter, oe as isValidHighlighter, ce as isValidMathEngine, ae as isValidMermaidRenderer, ie as isValidSlugger, se as isValidUrlTransform, z as linkPlugin, k as memoClear, E as memoGet, j as memoSet, P as memoSize, ee as mergeMarkdownConfig, $ as mergeMarkdownPreset, x as normalizeCustomTagProps, b as normalizeHast, r as partAttrs, c as partClass, p as resolveLabel, ue as resolvePipeline, Z as resolvePlugins, ne as resolvePreset, v as resolveUrl, H as searchDocument, G as searchPlugin, L as segmentSearch, Q as tocPlugin, A as useActiveHeading, N as useMarkdownDocument, e as validateManifest, s as validateManifestRegistry, pe as validatePipeline, J as validatePlugin, C as walkNodes, M as withDerivedDocument, D as withUniqueSlugs };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MarkdownNode } from '../core/types';
|
|
2
|
+
import { hastToMarkdownNodes } from '../core/hast-to-nodes';
|
|
3
|
+
/**
|
|
4
|
+
* Convert an already-parsed hast subtree into normalized nodes. This path has
|
|
5
|
+
* no HTML parser dependency, which keeps hast-first adapters such as Shiki
|
|
6
|
+
* parser-free.
|
|
7
|
+
*/
|
|
8
|
+
export declare function highlightedNodesFromHast(nodes: Parameters<typeof hastToMarkdownNodes>[0]): MarkdownNode[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MarkdownHighlighter } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Default highlight.js adapter. It is intentionally synchronous so the
|
|
4
|
+
* renderer can produce highlighted output without blocking.
|
|
5
|
+
*/
|
|
6
|
+
export declare const highlightjs: MarkdownHighlighter;
|
|
7
|
+
export default highlightjs;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../chunks/shared-NjFDPmkb.js";
|
|
2
|
+
import { t as i } from "../chunks/highlightjs-BxJFpKS1.js";
|
|
3
|
+
import { t as a } from "../chunks/convert-hast-C4Rg2ZuF.js";
|
|
4
|
+
export { r as clearHighlightCache, i as default, i as highlightjs, a as highlightedNodesFromHast, t as plaintextHighlight, n as runHighlighter, e as splitHighlightLines };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HighlightOptions, HighlightResult, MarkdownHighlighter, MarkdownNode } from '../core/types';
|
|
2
|
+
export declare function plaintextHighlight(code: string, language?: string): HighlightResult;
|
|
3
|
+
export declare function cacheKey(highlighter: MarkdownHighlighter, code: string, language: string, options: HighlightOptions): string;
|
|
4
|
+
export declare function clearHighlightCache(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Run one adapter safely. Invalid adapters, thrown errors, and malformed
|
|
7
|
+
* results fall back to plain text instead of breaking the document.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runHighlighter(highlighter: MarkdownHighlighter | undefined, code: string, language: string, options?: HighlightOptions): HighlightResult;
|
|
10
|
+
/** Split highlighted nodes into lines while preserving element wrappers. */
|
|
11
|
+
export declare function splitHighlightLines(nodes: readonly MarkdownNode[]): MarkdownNode[][];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MarkdownHighlighter } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Optional Shiki adapter. The highlighter, themes, and requested languages
|
|
4
|
+
* load asynchronously; until then callers see plain text.
|
|
5
|
+
*/
|
|
6
|
+
export declare const shiki: MarkdownHighlighter;
|
|
7
|
+
export default shiki;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { t as e } from "../chunks/objectSpread2-CtBNx0TF.js";
|
|
2
|
+
import { t } from "../chunks/asyncToGenerator-ChigusFD.js";
|
|
3
|
+
import { n } from "../chunks/shared-NjFDPmkb.js";
|
|
4
|
+
import { t as r } from "../chunks/convert-hast-C4Rg2ZuF.js";
|
|
5
|
+
import { createHighlighter as i } from "shiki";
|
|
6
|
+
// src/highlight/shiki.ts
|
|
7
|
+
var a = {
|
|
8
|
+
light: "github-light",
|
|
9
|
+
dark: "github-dark"
|
|
10
|
+
}, o = [
|
|
11
|
+
"bash",
|
|
12
|
+
"css",
|
|
13
|
+
"diff",
|
|
14
|
+
"go",
|
|
15
|
+
"html",
|
|
16
|
+
"javascript",
|
|
17
|
+
"json",
|
|
18
|
+
"markdown",
|
|
19
|
+
"python",
|
|
20
|
+
"rust",
|
|
21
|
+
"shell",
|
|
22
|
+
"sql",
|
|
23
|
+
"tsx",
|
|
24
|
+
"typescript",
|
|
25
|
+
"xml",
|
|
26
|
+
"yaml"
|
|
27
|
+
], s, c;
|
|
28
|
+
function l() {
|
|
29
|
+
return u.apply(this, arguments);
|
|
30
|
+
}
|
|
31
|
+
function u() {
|
|
32
|
+
return u = t(function* () {
|
|
33
|
+
return c || (s || (s = i({
|
|
34
|
+
themes: [a.light, a.dark],
|
|
35
|
+
langs: o
|
|
36
|
+
}).then((e) => (c = e, e))), s);
|
|
37
|
+
}), u.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
function d(e) {
|
|
40
|
+
var t, n, r;
|
|
41
|
+
let i = e[0], a = i == null || (t = i.children) == null ? void 0 : t.find((e) => e.tagName === "pre"), o = a == null || (n = a.children) == null ? void 0 : n.find((e) => e.tagName === "code");
|
|
42
|
+
return (r = o == null ? void 0 : o.children) == null ? [] : r;
|
|
43
|
+
}
|
|
44
|
+
var f = {
|
|
45
|
+
id: "shiki",
|
|
46
|
+
languages: o,
|
|
47
|
+
load: function() {
|
|
48
|
+
var e = t(function* () {
|
|
49
|
+
yield l();
|
|
50
|
+
});
|
|
51
|
+
return function() {
|
|
52
|
+
return e.apply(this, arguments);
|
|
53
|
+
};
|
|
54
|
+
}(),
|
|
55
|
+
loadLanguage(e) {
|
|
56
|
+
return t(function* () {
|
|
57
|
+
let t = yield l();
|
|
58
|
+
t.getLoadedLanguages().includes(e) || (yield t.loadLanguage(e));
|
|
59
|
+
})();
|
|
60
|
+
},
|
|
61
|
+
highlight(t, i, o) {
|
|
62
|
+
var s;
|
|
63
|
+
if (!c) return n(t, i);
|
|
64
|
+
let l = c.getLoadedLanguages().includes(i) ? i : "text", u = (s = o.colorScheme) == null ? o.theme === "dark" ? "dark" : "light" : s, f = c.codeToHast(t, e({
|
|
65
|
+
lang: l,
|
|
66
|
+
themes: a,
|
|
67
|
+
defaultColor: u
|
|
68
|
+
}, o.theme ? { theme: o.theme } : {}));
|
|
69
|
+
return {
|
|
70
|
+
language: l,
|
|
71
|
+
nodes: r(d([f]))
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export { f as default, f as shiki };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HtmlSchemaExtension, MarkdownPlugin } from '../core/types';
|
|
2
|
+
export interface HtmlPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Add-only extension for the built-in raw HTML sanitizer. Property names use
|
|
5
|
+
* hast casing, for example `srcSet` and `dateTime`.
|
|
6
|
+
*/
|
|
7
|
+
schema?: HtmlSchemaExtension;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Enable sanitized raw HTML in the official pipeline.
|
|
11
|
+
*
|
|
12
|
+
* The plugin contributes `rehype-raw`; the official pipeline runs it before the
|
|
13
|
+
* built-in sanitizer and ignores manual `rehype-raw` entries. Importing this
|
|
14
|
+
* entry is the only supported way to render raw HTML.
|
|
15
|
+
*/
|
|
16
|
+
export declare function htmlPlugin(options?: HtmlPluginOptions): MarkdownPlugin;
|
|
17
|
+
export type { HtmlSchemaExtension };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const version = "1.0.1";
|
|
2
|
+
export * from './core/types';
|
|
3
|
+
export * from './core/parts';
|
|
4
|
+
export * from './core/labels';
|
|
5
|
+
export * from './core/diagnostics';
|
|
6
|
+
export * from './core/url';
|
|
7
|
+
export * from './core/model';
|
|
8
|
+
export * from './core/normalize';
|
|
9
|
+
export * from './core/search';
|
|
10
|
+
export * from './core/slugger';
|
|
11
|
+
export * from './core/manifest';
|
|
12
|
+
export * from './core/config';
|
|
13
|
+
export * from './core/preset';
|
|
14
|
+
export * from './core/adapters';
|
|
15
|
+
export * from './export';
|
|
16
|
+
export * from './core/memo';
|
|
17
|
+
export * from './pipeline';
|
|
18
|
+
export * from './plugins/define';
|
|
19
|
+
export * from './plugins/builtin';
|
|
20
|
+
export * from './plugins/registry';
|
|
21
|
+
export * from './mermaid/plugin';
|
|
22
|
+
export * from './composables/useMarkdownDocument';
|
|
23
|
+
export * from './composables/useActiveHeading';
|
|
24
|
+
export * from './components';
|