@coderminer/vue-markdown 1.0.0 → 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 +116 -0
- package/README.md +7 -2
- package/README.zh-CN.md +6 -3
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +0 -2
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js +0 -2
- package/dist/chunks/MarkdownCode-B1k9tmW5.js +0 -2
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +0 -2
- package/dist/chunks/MarkdownContent-BAK6dqo7.js +0 -2
- package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js +0 -2
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +0 -2
- package/dist/chunks/MarkdownError-C0sPs5W0.js +0 -2
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +0 -2
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +0 -2
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js +0 -2
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +0 -2
- package/dist/chunks/MarkdownHtml-66lYkvwM.js +0 -2
- package/dist/chunks/MarkdownImage-BRy76svs.js +0 -2
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +0 -2
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js +0 -2
- package/dist/chunks/MarkdownList-BJ-_C71k.js +0 -2
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js +0 -2
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js +0 -2
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +0 -2
- package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js +0 -2
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +0 -2
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +0 -2
- package/dist/chunks/MarkdownTable-DmBTg_CR.js +0 -2
- package/dist/chunks/MarkdownTableCell-eiCJe847.js +0 -2
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js +0 -2
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js +0 -2
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +0 -2
- package/dist/chunks/{MarkdownToc-BdOHF-Yo.js → MarkdownToc-DHWWoH6t.js} +1 -3
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +0 -2
- package/dist/chunks/{MermaidLiveEditor-W-qf3G-5.js → MermaidLiveEditor-1TKkI5bp.js} +1 -3
- package/dist/chunks/{VueSyntaxHighlighter-DyLsYMwy.js → VueSyntaxHighlighter-BWpCO-cX.js} +1 -3
- package/dist/chunks/adapters-CMwX_NEI.js +0 -2
- package/dist/chunks/{blank-line-Cb-JBP_5.js → blank-line-CKKsFeKR.js} +1 -3
- package/dist/chunks/codemirror-DyphMAEg.js +0 -2
- package/dist/chunks/config-aRYo2R8_.js +0 -2
- package/dist/chunks/context-8NfW6fxI.js +0 -2
- package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
- package/dist/chunks/default-ZQ5aHh-N.js +3 -0
- package/dist/chunks/diagnostics-CtHoJyiX.js +0 -2
- package/dist/chunks/{export-DZQ3cUry.js → export-BrgMLgUp.js} +13 -14
- package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
- package/dist/chunks/{lib-BQiWGWpu.js → hast-util-from-html-D3e_iQ89.js} +495 -494
- package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
- package/dist/chunks/{identity-jZEhX2d5.js → identity-Bi27FKyx.js} +7 -8
- package/dist/chunks/labels-BtHiUTQI.js +0 -2
- package/dist/chunks/lib-CCnkLL6S.js +252 -0
- package/dist/chunks/longest-streak-DZE_EqsU.js +0 -2
- package/dist/chunks/{micromark-factory-space-Db040TnW.js → micromark-factory-space-CpXAnYUY.js} +2 -4
- package/dist/chunks/{normalize-CRYv3Wqt.js → normalize-VKfQXZiK.js} +57 -51
- package/dist/chunks/{plugin-DqkFHyny.js → plugin-YWo5uqTh.js} +1 -2
- package/dist/chunks/preset-BjaOuJUL.js +0 -2
- package/dist/chunks/{registry-DLjr93-V.js → registry-B7BfEkuy.js} +1051 -1045
- package/dist/chunks/{render-Cs8iKrgz.js → render-DAqK0w5J.js} +524 -494
- package/dist/chunks/{default-DWVS-I_8.js → rolldown-runtime-QGRDbDUS.js} +1 -5
- package/dist/chunks/{runtime-DJMnzjah.js → runtime-D95F41zG.js} +145 -117
- package/dist/chunks/security-y4EwUyAs.js +0 -2
- package/dist/chunks/{shared-DNAvZ-UY.js → shared-NjFDPmkb.js} +18 -27
- package/dist/chunks/{space-separated-tokens-CmBjEPdR.js → space-separated-tokens-1ebNqf35.js} +1 -3
- package/dist/chunks/url-D2BoivaE.js +0 -2
- package/dist/chunks/{useActiveHeading-BaGVMJnB.js → useActiveHeading-CnyGTG1u.js} +165 -122
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/MarkdownCustomTag.js +1 -1
- package/dist/components/MarkdownMath.js +1 -1
- package/dist/components/MarkdownMermaid.d.ts +3 -3
- package/dist/components/MarkdownMermaid.js +1 -1
- package/dist/components/MarkdownRenderer.d.ts +16 -19
- package/dist/components/MarkdownRenderer.js +1 -1
- package/dist/components/MarkdownToc.js +1 -1
- package/dist/components/MermaidBlock.js +1 -1
- package/dist/components/MermaidLiveEditor.js +1 -1
- package/dist/components/VueSyntaxHighlighter.js +1 -1
- package/dist/components/context.d.ts +2 -2
- package/dist/components/index.js +6 -6
- package/dist/components/types.d.ts +34 -2
- package/dist/composables/useMarkdownDocument.d.ts +2 -0
- package/dist/core/hast-nodes.d.ts +0 -3
- package/dist/core/hast-to-nodes.d.ts +9 -0
- package/dist/core/normalize.d.ts +10 -0
- package/dist/core/parts.d.ts +1 -0
- package/dist/core/slugger.d.ts +7 -0
- package/dist/core/types.d.ts +3 -1
- package/dist/headless.js +8 -8
- package/dist/highlight/convert-hast.d.ts +8 -0
- package/dist/highlight/index.d.ts +2 -1
- package/dist/highlight/index.js +4 -3
- package/dist/highlight/shared.d.ts +0 -5
- package/dist/highlight/shiki.js +2 -3
- package/dist/html/index.js +0 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +47 -49
- package/dist/math/index.js +18 -16
- package/dist/mermaid/index.d.ts +2 -1
- package/dist/mermaid/index.js +8 -3
- package/dist/mermaid/plugin.d.ts +3 -0
- package/dist/mermaid/runtime.d.ts +3 -1
- 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 +6 -2
- package/dist/node-components.js +6 -6
- package/dist/pipeline.js +1 -1
- package/dist/plugins.js +1 -1
- package/dist/styles/components.css +25 -0
- package/package.json +6 -3
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js.map +0 -1
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js.map +0 -1
- package/dist/chunks/MarkdownCode-B1k9tmW5.js.map +0 -1
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js.map +0 -1
- package/dist/chunks/MarkdownContent-BAK6dqo7.js.map +0 -1
- package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js +0 -42
- package/dist/chunks/MarkdownCustomTag-BBdn3-WO.js.map +0 -1
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js.map +0 -1
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js.map +0 -1
- package/dist/chunks/MarkdownError-C0sPs5W0.js.map +0 -1
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js.map +0 -1
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js.map +0 -1
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js.map +0 -1
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js.map +0 -1
- package/dist/chunks/MarkdownHtml-66lYkvwM.js.map +0 -1
- package/dist/chunks/MarkdownImage-BRy76svs.js.map +0 -1
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js.map +0 -1
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js.map +0 -1
- package/dist/chunks/MarkdownList-BJ-_C71k.js.map +0 -1
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js.map +0 -1
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js.map +0 -1
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js.map +0 -1
- package/dist/chunks/MarkdownRenderer-DLRRfsdI.js +0 -416
- package/dist/chunks/MarkdownRenderer-DLRRfsdI.js.map +0 -1
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js.map +0 -1
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js.map +0 -1
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js.map +0 -1
- package/dist/chunks/MarkdownTable-DmBTg_CR.js.map +0 -1
- package/dist/chunks/MarkdownTableCell-eiCJe847.js.map +0 -1
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js.map +0 -1
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js.map +0 -1
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js.map +0 -1
- package/dist/chunks/MarkdownToc-BdOHF-Yo.js.map +0 -1
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js.map +0 -1
- package/dist/chunks/MermaidLiveEditor-W-qf3G-5.js.map +0 -1
- package/dist/chunks/VueSyntaxHighlighter-DyLsYMwy.js.map +0 -1
- package/dist/chunks/adapters-CMwX_NEI.js.map +0 -1
- package/dist/chunks/blank-line-Cb-JBP_5.js.map +0 -1
- package/dist/chunks/codemirror-DyphMAEg.js.map +0 -1
- package/dist/chunks/config-aRYo2R8_.js.map +0 -1
- package/dist/chunks/context-8NfW6fxI.js.map +0 -1
- package/dist/chunks/default-DWVS-I_8.js.map +0 -1
- package/dist/chunks/diagnostics-CtHoJyiX.js.map +0 -1
- package/dist/chunks/export-DZQ3cUry.js.map +0 -1
- package/dist/chunks/hast-nodes-C0bX3M5Z.js +0 -35
- package/dist/chunks/hast-nodes-C0bX3M5Z.js.map +0 -1
- package/dist/chunks/highlightjs-BEh-YwEG.js +0 -6041
- package/dist/chunks/highlightjs-BEh-YwEG.js.map +0 -1
- package/dist/chunks/identity-jZEhX2d5.js.map +0 -1
- package/dist/chunks/labels-BtHiUTQI.js.map +0 -1
- package/dist/chunks/lib-BQiWGWpu.js.map +0 -1
- package/dist/chunks/lib-LwqA_W3J.js +0 -127
- package/dist/chunks/lib-LwqA_W3J.js.map +0 -1
- package/dist/chunks/longest-streak-DZE_EqsU.js.map +0 -1
- package/dist/chunks/micromark-factory-space-Db040TnW.js.map +0 -1
- package/dist/chunks/normalize-CRYv3Wqt.js.map +0 -1
- package/dist/chunks/plugin-DqkFHyny.js.map +0 -1
- package/dist/chunks/preset-BjaOuJUL.js.map +0 -1
- package/dist/chunks/registry-DLjr93-V.js.map +0 -1
- package/dist/chunks/render-Cs8iKrgz.js.map +0 -1
- package/dist/chunks/runtime-DJMnzjah.js.map +0 -1
- package/dist/chunks/security-y4EwUyAs.js.map +0 -1
- package/dist/chunks/shared-DNAvZ-UY.js.map +0 -1
- package/dist/chunks/space-separated-tokens-CmBjEPdR.js.map +0 -1
- package/dist/chunks/url-D2BoivaE.js.map +0 -1
- package/dist/chunks/useActiveHeading-BaGVMJnB.js.map +0 -1
- package/dist/highlight/shiki.js.map +0 -1
- package/dist/html/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/math/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,122 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@coderminer/vue-markdown` are documented here.
|
|
4
4
|
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- The Vue peer range is now `>=3.3.0 <4.0.0`. CI runs the full suite against
|
|
10
|
+
Vue 3.3 and 3.4 in addition to the latest 3.x release.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- String tag overrides (`components: { h1: 'h2' }`), unknown-tag fallbacks, and
|
|
15
|
+
raw HTML element nodes render their children on Vue 3.3 and 3.4. The renderer
|
|
16
|
+
passed a slot function to an element vnode, which only Vue 3.5 resolves.
|
|
17
|
+
|
|
18
|
+
## [1.0.1] - 2026-11-02
|
|
19
|
+
|
|
20
|
+
Patch release that closes runtime and contract issues found after 1.0.0. The
|
|
21
|
+
package has no external users yet, so it includes intentional contract
|
|
22
|
+
tightenings: the `externalLinkTarget` type is narrowed and `mermaidPlugin()`
|
|
23
|
+
rejects non-object arguments.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- The `MarkdownRenderer` `searchDebounce` prop delays parsing after the last
|
|
28
|
+
search query change, so search-as-you-type can avoid re-parsing large
|
|
29
|
+
documents on every keystroke. The initial query still applies immediately for
|
|
30
|
+
server rendering.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- `toc-change` no longer emits a transient empty array before the first parse
|
|
35
|
+
settles. A first document that really has no headings still emits one settled
|
|
36
|
+
`[]`. The TOC change check compares every field directly instead of
|
|
37
|
+
serializing the array.
|
|
38
|
+
- `customTagsPlugin()` and `MarkdownCustomTag` normalize kebab-case attributes
|
|
39
|
+
to camelCase props (`start-line` becomes `startLine`). `data-*` and `aria-*`
|
|
40
|
+
stay in their DOM form. The click payload and host component bindings use the
|
|
41
|
+
normalized props.
|
|
42
|
+
- `MermaidBlock` resets zoom on every render (retry, theme, renderer, and
|
|
43
|
+
source changes) and when returning from the source tab, not only when the
|
|
44
|
+
source text changes. The default error/fallback regions include a visible
|
|
45
|
+
retry button.
|
|
46
|
+
- The Mermaid runtime clears a rejected lazy import so retry can recover from a
|
|
47
|
+
transient chunk failure. Initialization is keyed by the full configuration
|
|
48
|
+
and checked inside the render queue, so blocks with different themes cannot
|
|
49
|
+
reuse stale global Mermaid state.
|
|
50
|
+
- `useMarkdownDocument` publishes a deduplicated diagnostics list for each run,
|
|
51
|
+
including failed runs, and exposes `clearDiagnostics()`. Entries count as
|
|
52
|
+
duplicates only when their code, message, severity, phase, plugin, source
|
|
53
|
+
range, and details all match, so distinct occurrences are preserved. Setup
|
|
54
|
+
diagnostics are snapshotted when plugin setup runs, so a plugin that retains
|
|
55
|
+
the setup context cannot append to the list on later runs. The renderer prunes
|
|
56
|
+
its reported-diagnostic set to the currently active entries instead of growing
|
|
57
|
+
it indefinitely.
|
|
58
|
+
- `MarkdownRendererEvents` and `MermaidBlockEvents` are exported typed event
|
|
59
|
+
maps, and the event payload conventions are documented so consumers do not
|
|
60
|
+
need to discover each shape separately. Interaction events include the
|
|
61
|
+
originating DOM event; the docs no longer claim every payload is serializable.
|
|
62
|
+
- The default `searchPlugin()` no longer walks the document tree when the query
|
|
63
|
+
is empty, and the renderer skips match counting for an empty query.
|
|
64
|
+
- A side TOC column now constrains its height and scrolls internally when the
|
|
65
|
+
table of contents is longer than the viewport. The stacked mobile layout
|
|
66
|
+
resets that cap so the TOC expands above the content.
|
|
67
|
+
- `MarkdownRenderer` now validates every scalar prop at runtime, not only the
|
|
68
|
+
enum props. Invalid enums, booleans, strings, and numeric values report a
|
|
69
|
+
`prop-*` warning and use the documented fallback instead of reaching the
|
|
70
|
+
renderer or pipeline. An omitted optional `baseUrl` is valid and emits no
|
|
71
|
+
diagnostic. The `externalLinkTarget` prop and document option are typed as
|
|
72
|
+
`'_self' | '_blank'` instead of `string`, and `theme` is inferred as a runtime
|
|
73
|
+
string prop.
|
|
74
|
+
- `MermaidBlock` invalidates in-flight renders on unmount, so a late result
|
|
75
|
+
cannot emit `rendered`/`error` or write state after the component is gone.
|
|
76
|
+
`resetMermaidRuntime()` keeps the serialized queue tail and monotonic render
|
|
77
|
+
counter, so an explicit reset cannot interleave renders or reuse DOM IDs.
|
|
78
|
+
- `mermaidPlugin()` rejects non-object arguments with a clear error instead of
|
|
79
|
+
silently ignoring them. Its only supported option remains `languages`.
|
|
80
|
+
- The built library no longer resolves Node-only dependency variants. This
|
|
81
|
+
removes `node:process`, `node:path`, and `node:url` imports (including
|
|
82
|
+
`process.cwd`) from browser output and prevents crashes when rendering.
|
|
83
|
+
- `renderMermaid()` and `MermaidBlock` now report a clear error for non-string
|
|
84
|
+
sources, such as an un-awaited `renderMermaid()` Promise, instead of throwing
|
|
85
|
+
`trim is not a function`. Empty and non-browser sources also explain how to
|
|
86
|
+
recover.
|
|
87
|
+
- `MermaidBlock` now distinguishes an invalid renderer result, empty renderer
|
|
88
|
+
output, and SVG rejected completely by sanitization, with an actionable hint
|
|
89
|
+
for each. Thrown renderer errors are prefixed with the failure stage. The
|
|
90
|
+
invalid `mermaidRenderer` diagnostic now names the actual fallback, the
|
|
91
|
+
built-in runtime.
|
|
92
|
+
- Default heading IDs collapse consecutive whitespace and hyphen runs, so
|
|
93
|
+
`My - Heading` becomes `my-heading` instead of `my-----heading`. Custom
|
|
94
|
+
sluggers keep their own formatting; only duplicate suffixes are added.
|
|
95
|
+
- The base renderer no longer statically includes the HTML parser. Mermaid SVG
|
|
96
|
+
sanitization loads it only after a diagram renders, the math entry uses it for
|
|
97
|
+
KaTeX markup, and the default highlight.js adapter now produces hast through
|
|
98
|
+
`lowlight` instead of parsing HTML. The highlight entry no longer pulls the
|
|
99
|
+
HTML parser, and the highlight entry resolves `highlight.js` language subpaths
|
|
100
|
+
from the host peer dependency instead of bundling a second copy.
|
|
101
|
+
- Published JavaScript no longer contains `sourceMappingURL` comments for maps
|
|
102
|
+
that are excluded from the tarball.
|
|
103
|
+
- The `highlight` entry no longer exports `highlightedNodesFromHtml`; adapters
|
|
104
|
+
that already produce hast use `highlightedNodesFromHast`. This keeps the HTML
|
|
105
|
+
parser out of the highlight entry.
|
|
106
|
+
|
|
107
|
+
### Documentation
|
|
108
|
+
|
|
109
|
+
- Document the Mermaid renderer layers and their precedence: per-block
|
|
110
|
+
`renderer` > provider/preset `mermaidRenderer` > built-in runtime. Clarify
|
|
111
|
+
that `mermaidPlugin()` only converts fences and that `renderMermaid()` is an
|
|
112
|
+
async function, not a `MermaidRenderer` object, so it must be wrapped when
|
|
113
|
+
passed explicitly. Explain why `resetMermaidRuntime()` is not a lifecycle
|
|
114
|
+
hook and cannot unload the browser module cache.
|
|
115
|
+
- Document the raw-HTML attribute casing rule: HTML lowercases attribute names,
|
|
116
|
+
so use kebab-case (`start-line`) for camelCase custom props (`startLine`).
|
|
117
|
+
- Add a complete sample plugin (`demo/plugins/samplePlugin.ts`) and a
|
|
118
|
+
step-by-step plugin guide that exercises source, remark, rehype, component,
|
|
119
|
+
document, label, token, setup/cleanup, and error hooks.
|
|
120
|
+
|
|
5
121
|
## [1.0.0] - 2026-11-01
|
|
6
122
|
|
|
7
123
|
First stable release of the Vue 3 Markdown component suite.
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ export.
|
|
|
38
38
|
npm install @coderminer/vue-markdown
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Requires Node 20+ and Vue 3.
|
|
41
|
+
Requires Node 20+ and Vue 3.3+.
|
|
42
42
|
|
|
43
43
|
Optional engines are peer dependencies. Install only the ones you use:
|
|
44
44
|
|
|
@@ -352,6 +352,10 @@ of the parse memo key, so `:plugins="[docsPlugin]"` created inline in a template
|
|
|
352
352
|
re-parses on every parent render. A failing plugin is isolated and never corrupts
|
|
353
353
|
the last good document.
|
|
354
354
|
|
|
355
|
+
`disablePlugins` matches the plugin `name`, not the exported factory name.
|
|
356
|
+
Unknown names report a `plugin-unknown` warning. See the
|
|
357
|
+
[plugin name table](docs/guide/plugins.md#disableplugins-names) for the full list.
|
|
358
|
+
|
|
355
359
|
### Headless rendering
|
|
356
360
|
|
|
357
361
|
```ts
|
|
@@ -440,7 +444,7 @@ component manifest, lives in the
|
|
|
440
444
|
| `labels` | `Partial<MarkdownLabels>` | `{}` | String or function labels for built-in text. |
|
|
441
445
|
| `preset` | `MarkdownPreset \| MarkdownPreset[]` | — | Applies one or more presets. |
|
|
442
446
|
| `plugins` | `PluginInput[]` | `defaultPlugins` | Replaces the default plugin set when provided. Add `htmlPlugin()` for sanitized raw HTML. |
|
|
443
|
-
| `disablePlugins` | `string[]` | `[]` | Removes named plugins from the resolved set. |
|
|
447
|
+
| `disablePlugins` | `string[]` | `[]` | Removes named plugins from the resolved set. Unknown names report a `plugin-unknown` warning. |
|
|
444
448
|
| `remarkPlugins` | `PluggableList` | `[]` | Runs after library remark plugins. |
|
|
445
449
|
| `rehypePlugins` | `PluggableList` | `[]` | Runs after library rehype plugins and the built-in sanitizer. |
|
|
446
450
|
| `remarkRehypeOptions` | `Record<string, unknown>` | `{}` | Merged into the conversion step. |
|
|
@@ -465,6 +469,7 @@ component manifest, lives in the
|
|
|
465
469
|
| `tocPlacement` | `'top' \| 'left' \| 'right' \| 'hidden'` | `'top'` | Stack the TOC, place it beside the content, or hide it. |
|
|
466
470
|
| `search` | `string` | `''` | Highlights matches and emits `search-change`. |
|
|
467
471
|
| `searchCaseSensitive` | `boolean` | `false` | Makes the `search` match case-sensitive. |
|
|
472
|
+
| `searchDebounce` | `number` | `0` | Milliseconds before a new query is parsed. |
|
|
468
473
|
| `showError` | `boolean` | `true` | Renders the error region on failure. |
|
|
469
474
|
| `tokens` | `Record<string, string>` | `{}` | Inline `--vmd-*` custom properties on the root. |
|
|
470
475
|
| `theme` | `'light' \| 'dark' \| 'auto' \| 'custom'` | `'light'` | Sets `data-vmd-theme` on the root. |
|
package/README.zh-CN.md
CHANGED
|
@@ -36,7 +36,7 @@ Markdown 直接渲染成 Vue VNode:不经过 HTML 字符串往返,也不使
|
|
|
36
36
|
npm install @coderminer/vue-markdown
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
需要 Node 20+ 和 Vue 3.
|
|
39
|
+
需要 Node 20+ 和 Vue 3.3+。
|
|
40
40
|
|
|
41
41
|
可选引擎都是 peer 依赖,只安装实际用到的部分:
|
|
42
42
|
|
|
@@ -319,7 +319,9 @@ const plugins = [docsPlugin]
|
|
|
319
319
|
会被隔离,不会破坏上一份正常文档。
|
|
320
320
|
|
|
321
321
|
`toc`、`code`、`link` 是内核不变标记:即使写进 `disablePlugins` 也不会被移除,只会
|
|
322
|
-
报告一条 `plugin-core`
|
|
322
|
+
报告一条 `plugin-core` 诊断。`disablePlugins` 匹配插件的 `name`,不是导出的工厂函数名;
|
|
323
|
+
未知名称会报告 `plugin-unknown` 警告。完整列表见
|
|
324
|
+
[插件名称表](docs/zh/guide/plugins.md#disableplugins-名称)。
|
|
323
325
|
|
|
324
326
|
### 无头渲染
|
|
325
327
|
|
|
@@ -411,7 +413,7 @@ const asyncHtml = await exportMarkdownHtml(source, { plugins: [docsPlugin] })
|
|
|
411
413
|
| `labels` | `Partial<MarkdownLabels>` | `{}` | 内置文案,支持字符串或函数。 |
|
|
412
414
|
| `preset` | `MarkdownPreset \| MarkdownPreset[]` | — | 应用一个或多个预设。 |
|
|
413
415
|
| `plugins` | `PluginInput[]` | `defaultPlugins` | 传入后替换默认插件集合;加入 `htmlPlugin()` 可启用净化后的原始 HTML。 |
|
|
414
|
-
| `disablePlugins` | `string[]` | `[]` |
|
|
416
|
+
| `disablePlugins` | `string[]` | `[]` | 按名称移除解析后的非内核插件;未知名称会报告 `plugin-unknown` 警告。 |
|
|
415
417
|
| `remarkPlugins` | `PluggableList` | `[]` | 在库内置 remark 插件之后运行。 |
|
|
416
418
|
| `rehypePlugins` | `PluggableList` | `[]` | 在库内置 rehype 插件和内置净化器之后运行。 |
|
|
417
419
|
| `remarkRehypeOptions` | `Record<string, unknown>` | `{}` | 合并到 mdast → hast 转换步骤。 |
|
|
@@ -436,6 +438,7 @@ const asyncHtml = await exportMarkdownHtml(source, { plugins: [docsPlugin] })
|
|
|
436
438
|
| `tocPlacement` | `'top' \| 'left' \| 'right' \| 'hidden'` | `'top'` | 目录置顶、放在内容左侧/右侧,或隐藏。 |
|
|
437
439
|
| `search` | `string` | `''` | 高亮匹配项并触发 `search-change`。 |
|
|
438
440
|
| `searchCaseSensitive` | `boolean` | `false` | 让 `search` 区分大小写。 |
|
|
441
|
+
| `searchDebounce` | `number` | `0` | 新查询解析前的等待毫秒数。 |
|
|
439
442
|
| `showError` | `boolean` | `true` | 失败时渲染错误区域。 |
|
|
440
443
|
| `tokens` | `Record<string, string>` | `{}` | 写在根元素上的内联 `--vmd-*` 自定义属性。 |
|
|
441
444
|
| `theme` | `'light' \| 'dark' \| 'auto' \| 'custom'` | `'light'` | 设置根元素的 `data-vmd-theme`。 |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { i as e } from "./normalize-VKfQXZiK.js";
|
|
2
|
+
import { t } from "./objectSpread2-CtBNx0TF.js";
|
|
3
|
+
import { r as n } from "./context-8NfW6fxI.js";
|
|
4
|
+
import { computed as r, createBlock as i, defineComponent as a, mergeProps as o, openBlock as s, renderSlot as c, resolveDynamicComponent as l, withCtx as u } from "vue";
|
|
5
|
+
// src/components/MarkdownCustomTag.vue
|
|
6
|
+
var d = /* @__PURE__ */ a(t(t({}, {
|
|
7
|
+
name: "MarkdownCustomTag",
|
|
8
|
+
inheritAttrs: !1
|
|
9
|
+
}), {}, {
|
|
10
|
+
__name: "MarkdownCustomTag",
|
|
11
|
+
props: {
|
|
12
|
+
node: {},
|
|
13
|
+
children: {},
|
|
14
|
+
tag: {},
|
|
15
|
+
customProps: {}
|
|
16
|
+
},
|
|
17
|
+
setup(a) {
|
|
18
|
+
let d = a, f = n(), p = r(() => {
|
|
19
|
+
var e;
|
|
20
|
+
return (e = d.tag) == null ? d.node.tag : e;
|
|
21
|
+
}), m = r(() => f.components[p.value]), h = r(() => {
|
|
22
|
+
let e = m.value;
|
|
23
|
+
return typeof e == "string" || typeof e == "object" || typeof e == "function" ? e : "span";
|
|
24
|
+
}), g = r(() => {
|
|
25
|
+
var n;
|
|
26
|
+
return t(t(t({}, e(d.node.attrs)), d.node.props), (n = d.customProps) == null ? {} : n);
|
|
27
|
+
});
|
|
28
|
+
function _(e) {
|
|
29
|
+
f.onCustomTagClick({
|
|
30
|
+
tag: p.value,
|
|
31
|
+
props: g.value,
|
|
32
|
+
node: d.node,
|
|
33
|
+
event: e
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return (e, t) => (s(), i(l(h.value), o(g.value, {
|
|
37
|
+
"data-vmd-part": "custom-tag",
|
|
38
|
+
class: "vmd-custom-tag",
|
|
39
|
+
onClick: _
|
|
40
|
+
}), {
|
|
41
|
+
default: u(() => [c(e.$slots, "default")]),
|
|
42
|
+
_: 3
|
|
43
|
+
}, 16));
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
export { d as t };
|