@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
package/README.md
CHANGED
|
@@ -1,3 +1,584 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @coderminer/vue-markdown
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@coderminer/vue-markdown)
|
|
4
|
+
[](https://github.com/coderminer/vue-markdown/actions/workflows/ci.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://coderminer.github.io/vue-markdown/)
|
|
7
|
+
|
|
8
|
+
English | [简体中文](./README.zh-CN.md) | [Changelog](./CHANGELOG.md)
|
|
9
|
+
|
|
10
|
+
A general-purpose, customizable, plugin-driven **Vue 3 Markdown component suite**.
|
|
11
|
+
|
|
12
|
+
`@coderminer/vue-markdown` renders Markdown directly into Vue VNodes with the official
|
|
13
|
+
`unified` pipeline (`remark-parse` + `remark-rehype`). There is no HTML string
|
|
14
|
+
round-trip and no `v-html`. The parsed document is a serializable, DOM-free model,
|
|
15
|
+
so the same run can drive the styled renderer, a headless host, or static HTML
|
|
16
|
+
export.
|
|
17
|
+
|
|
18
|
+
- **Vue-native** — `shallowRef` documents, stable keys, a text fast path, and
|
|
19
|
+
parse memoization keep re-renders cheap.
|
|
20
|
+
- **Customizable** — replace any tag, address every visual part through
|
|
21
|
+
`data-vmd-part` and stable `vmd-*` classes, and theme with `--vmd-*` tokens.
|
|
22
|
+
- **Plugin-driven** — plugins contribute remark/rehype plugins, source and
|
|
23
|
+
document transforms, components, labels, tokens, and lifecycle hooks.
|
|
24
|
+
- **Safe by default** — raw HTML is dropped, URLs are validated, and
|
|
25
|
+
`htmlPlugin()` pairs the parser with the built-in sanitizer when the host opts in.
|
|
26
|
+
- **SSR-ready** — deterministic heading IDs, a synchronous path, and static HTML
|
|
27
|
+
export that applies the same sanitization, filtering, and URL policy.
|
|
28
|
+
- **Optional engines** — highlight.js, Shiki, KaTeX, Mermaid, and CodeMirror
|
|
29
|
+
stay behind their own entries and lazy chunks.
|
|
30
|
+
|
|
31
|
+
**Live documentation:** <https://coderminer.github.io/vue-markdown/>
|
|
32
|
+
|
|
33
|
+
**Chinese documentation:** [docs/zh](docs/zh/index.md) (`/zh/` on the documentation site).
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @coderminer/vue-markdown
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Requires Node 20+ and Vue 3.3+.
|
|
42
|
+
|
|
43
|
+
Optional engines are peer dependencies. Install only the ones you use:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Syntax highlighting
|
|
47
|
+
npm install highlight.js
|
|
48
|
+
# or
|
|
49
|
+
npm install shiki
|
|
50
|
+
|
|
51
|
+
# Math
|
|
52
|
+
npm install katex
|
|
53
|
+
|
|
54
|
+
# Diagrams
|
|
55
|
+
npm install mermaid
|
|
56
|
+
|
|
57
|
+
# Sanitized raw HTML through @coderminer/vue-markdown/html
|
|
58
|
+
npm install rehype-raw
|
|
59
|
+
|
|
60
|
+
# Mermaid live editor
|
|
61
|
+
npm install @codemirror/state @codemirror/view @codemirror/language @codemirror/commands
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Quick start
|
|
65
|
+
|
|
66
|
+
```vue
|
|
67
|
+
<script setup lang="ts">
|
|
68
|
+
import { ref } from 'vue'
|
|
69
|
+
import { MarkdownRenderer } from '@coderminer/vue-markdown'
|
|
70
|
+
import '@coderminer/vue-markdown/style.css'
|
|
71
|
+
|
|
72
|
+
const source = ref(`
|
|
73
|
+
# Hello, Markdown
|
|
74
|
+
|
|
75
|
+
A **bold** paragraph with a [link](https://example.com).
|
|
76
|
+
|
|
77
|
+
- Vue components
|
|
78
|
+
- Safe by default
|
|
79
|
+
- SSR ready
|
|
80
|
+
`)
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<template>
|
|
84
|
+
<MarkdownRenderer v-model:source="source" toc />
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The stylesheet is optional. Every component is semantic and works unstyled.
|
|
89
|
+
|
|
90
|
+
## Basic usage
|
|
91
|
+
|
|
92
|
+
### Input
|
|
93
|
+
|
|
94
|
+
Pass Markdown through `source`, bind it with `v-model:source`, or use the default
|
|
95
|
+
slot:
|
|
96
|
+
|
|
97
|
+
```vue
|
|
98
|
+
<MarkdownRenderer source="# From the prop" />
|
|
99
|
+
<MarkdownRenderer v-model:source="source" />
|
|
100
|
+
<MarkdownRenderer># From the slot</MarkdownRenderer>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`source` is controlled and wins over the slot. The slot is text-only and is
|
|
104
|
+
re-read when its text content changes. A non-string `source` reports a diagnostic
|
|
105
|
+
and renders the empty state instead of throwing.
|
|
106
|
+
|
|
107
|
+
### Styling
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import '@coderminer/vue-markdown/style.css'
|
|
111
|
+
// or import the pieces separately
|
|
112
|
+
import '@coderminer/vue-markdown/styles/tokens.css'
|
|
113
|
+
import '@coderminer/vue-markdown/styles/components.css'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Override tokens on any ancestor or through the `tokens` prop:
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<MarkdownRenderer
|
|
120
|
+
:source="source"
|
|
121
|
+
theme="auto"
|
|
122
|
+
:tokens="{ '--vmd-color-accent': '#8250df' }"
|
|
123
|
+
/>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Every visual part exposes both a stable class and a `data-vmd-part` attribute:
|
|
127
|
+
|
|
128
|
+
```css
|
|
129
|
+
[data-vmd-part='heading'] {
|
|
130
|
+
letter-spacing: -0.01em;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-vmd-part='code'] {
|
|
134
|
+
--vmd-code-bg: #0d1117;
|
|
135
|
+
color: #e6edf3;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Events and actions
|
|
140
|
+
|
|
141
|
+
```vue
|
|
142
|
+
<script setup lang="ts">
|
|
143
|
+
const renderer = ref<InstanceType<typeof MarkdownRenderer>>()
|
|
144
|
+
|
|
145
|
+
function onToc(toc) {
|
|
146
|
+
console.log(toc)
|
|
147
|
+
}
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<template>
|
|
151
|
+
<MarkdownRenderer
|
|
152
|
+
ref="renderer"
|
|
153
|
+
:source="source"
|
|
154
|
+
@toc-change="onToc"
|
|
155
|
+
@link-click="onLink"
|
|
156
|
+
@render-error="onError"
|
|
157
|
+
/>
|
|
158
|
+
</template>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Exposed actions: `scrollToHeading(id)`, `getDocument()`, `getToc()`, `refresh()`,
|
|
162
|
+
and `updateSource(source)`.
|
|
163
|
+
|
|
164
|
+
## Customization
|
|
165
|
+
|
|
166
|
+
Customization is layered and stable: target tags, semantic nodes, regions, design
|
|
167
|
+
tokens, or documented CSS parts. The full guide with a live preview is in the
|
|
168
|
+
[live customization section](https://coderminer.github.io/vue-markdown/guide/customization.html).
|
|
169
|
+
|
|
170
|
+
### Customize your own elements
|
|
171
|
+
|
|
172
|
+
```vue [BadgeLink.vue]
|
|
173
|
+
<script setup lang="ts">
|
|
174
|
+
import type { MarkdownNode } from '@coderminer/vue-markdown'
|
|
175
|
+
|
|
176
|
+
defineProps<{
|
|
177
|
+
node?: MarkdownNode
|
|
178
|
+
href?: string
|
|
179
|
+
}>()
|
|
180
|
+
</script>
|
|
181
|
+
|
|
182
|
+
<template>
|
|
183
|
+
<a :href="href" class="badge-link">
|
|
184
|
+
<span class="badge">link</span>
|
|
185
|
+
<slot />
|
|
186
|
+
</a>
|
|
187
|
+
</template>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```vue [Callout.vue]
|
|
191
|
+
<script setup lang="ts">
|
|
192
|
+
import type { MarkdownNode } from '@coderminer/vue-markdown'
|
|
193
|
+
|
|
194
|
+
defineProps<{ node?: MarkdownNode }>()
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<template>
|
|
198
|
+
<aside class="callout">
|
|
199
|
+
<slot />
|
|
200
|
+
</aside>
|
|
201
|
+
</template>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```vue [App.vue]
|
|
205
|
+
<script setup lang="ts">
|
|
206
|
+
import { MarkdownRenderer } from '@coderminer/vue-markdown'
|
|
207
|
+
import BadgeLink from './BadgeLink.vue'
|
|
208
|
+
import Callout from './Callout.vue'
|
|
209
|
+
|
|
210
|
+
const components = {
|
|
211
|
+
h1: 'h2',
|
|
212
|
+
a: BadgeLink,
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const nodeComponents = {
|
|
216
|
+
blockquote: Callout,
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const regions = {
|
|
220
|
+
toc: MyToc,
|
|
221
|
+
empty: MyEmpty,
|
|
222
|
+
}
|
|
223
|
+
</script>
|
|
224
|
+
|
|
225
|
+
<template>
|
|
226
|
+
<MarkdownRenderer
|
|
227
|
+
:source="source"
|
|
228
|
+
:components="components"
|
|
229
|
+
:node-components="nodeComponents"
|
|
230
|
+
:regions="regions"
|
|
231
|
+
/>
|
|
232
|
+
</template>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
`components` is the tag-keyed map. `nodeComponents` targets the semantic model
|
|
236
|
+
(`code`, `math`, `mermaid`, `custom`, and element tags) and also accepts function
|
|
237
|
+
renderers. `regions` replaces structural areas such as the TOC, content, error,
|
|
238
|
+
empty, and loading states. Named slots are the last layer and receive scoped data
|
|
239
|
+
plus actions. For custom syntax, `customTagsPlugin({ tags: ['x-note'] })` turns
|
|
240
|
+
selected elements into custom nodes that map to your own components. Fenced code
|
|
241
|
+
always wraps through `components.pre`; its inner element resolves through
|
|
242
|
+
`components.code` or `nodeComponents.code`.
|
|
243
|
+
|
|
244
|
+
For a full component-based customization walkthrough, including a
|
|
245
|
+
`CodeBlock`-powered custom element, see the
|
|
246
|
+
[Rich components guide](docs/guide/rich-components.md#build-a-custom-code-block-with-codeblock).
|
|
247
|
+
|
|
248
|
+
### Customize the theme
|
|
249
|
+
|
|
250
|
+
```vue
|
|
251
|
+
<!-- Preset: light | dark | auto | custom -->
|
|
252
|
+
<MarkdownRenderer theme="auto" :source="source" toc />
|
|
253
|
+
|
|
254
|
+
<!-- Per-instance tokens -->
|
|
255
|
+
<MarkdownRenderer
|
|
256
|
+
theme="auto"
|
|
257
|
+
:source="source"
|
|
258
|
+
:tokens="{
|
|
259
|
+
'--vmd-color-accent': '#8250df',
|
|
260
|
+
'--vmd-radius-md': '12px',
|
|
261
|
+
}"
|
|
262
|
+
/>
|
|
263
|
+
|
|
264
|
+
<!-- App-wide defaults -->
|
|
265
|
+
<MarkdownConfigProvider theme="auto" :tokens="brandTokens">
|
|
266
|
+
<MarkdownRenderer :source="source" toc />
|
|
267
|
+
</MarkdownConfigProvider>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The renderer writes `data-vmd-theme` on its own root and never touches the host
|
|
271
|
+
page. `auto` follows `prefers-color-scheme`, while `custom` applies no preset
|
|
272
|
+
colors so your token overrides win unchanged. Tokens cascade from any ancestor,
|
|
273
|
+
so a scoped theme is just a class with `--vmd-*` properties.
|
|
274
|
+
|
|
275
|
+
### Customize CSS
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
import '@coderminer/vue-markdown/style.css'
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
```css
|
|
282
|
+
.my-docs {
|
|
283
|
+
--vmd-font-size: 1.0625rem;
|
|
284
|
+
--vmd-line-height: 1.8;
|
|
285
|
+
--vmd-color-accent: #8250df;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
[data-vmd-part='heading'] {
|
|
289
|
+
letter-spacing: -0.01em;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
[data-vmd-part='code'] {
|
|
293
|
+
--vmd-code-bg: #0d1117;
|
|
294
|
+
color: #e6edf3;
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
The stylesheet is optional and split into `styles/tokens.css` and
|
|
299
|
+
`styles/components.css`. Target the documented `data-vmd-part` / `vmd-*` parts
|
|
300
|
+
and `--vmd-*` tokens, never internal DOM structure, because a host may replace
|
|
301
|
+
any tag component. Unstyled usage keeps the same behavior and accessibility.
|
|
302
|
+
|
|
303
|
+
See [Styled usage](docs/guide/styling.md) and
|
|
304
|
+
[Customization](docs/guide/customization.md) for the full contract.
|
|
305
|
+
|
|
306
|
+
## Advanced usage
|
|
307
|
+
|
|
308
|
+
### Plugins and presets
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
import { defineMarkdownPlugin } from '@coderminer/vue-markdown/plugins'
|
|
312
|
+
import { defineMarkdownPreset, composePresets } from '@coderminer/vue-markdown/presets'
|
|
313
|
+
|
|
314
|
+
export const docsPlugin = defineMarkdownPlugin({
|
|
315
|
+
name: 'docs',
|
|
316
|
+
phase: 'normal',
|
|
317
|
+
remarkPlugins: [],
|
|
318
|
+
rehypePlugins: [],
|
|
319
|
+
components: { h2: 'h3' },
|
|
320
|
+
labels: { toc: 'On this page' },
|
|
321
|
+
tokens: { '--vmd-color-accent': '#8250df' },
|
|
322
|
+
transformDocument(document) {
|
|
323
|
+
return { ...document, frontmatter: { ...document.frontmatter, docs: true } }
|
|
324
|
+
},
|
|
325
|
+
setup() {
|
|
326
|
+
// Runs once per resolved plugin set inside an effectScope.
|
|
327
|
+
return () => {
|
|
328
|
+
// Cleanup on reconfiguration and unmount.
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
})
|
|
332
|
+
|
|
333
|
+
export const docsPreset = composePresets(
|
|
334
|
+
defineMarkdownPreset({ name: 'base', theme: 'auto' }),
|
|
335
|
+
defineMarkdownPreset({ name: 'docs', tokens: { '--vmd-radius-md': '10px' } }),
|
|
336
|
+
)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
```vue
|
|
340
|
+
<script setup lang="ts">
|
|
341
|
+
const plugins = [docsPlugin]
|
|
342
|
+
</script>
|
|
343
|
+
|
|
344
|
+
<template>
|
|
345
|
+
<MarkdownRenderer :source="source" :plugins="plugins" :preset="docsPreset" toc />
|
|
346
|
+
</template>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Order is `pre` → `normal` → `post`, then registration order. Duplicate names
|
|
350
|
+
replace deterministically. Keep the plugin array stable: plugin identity is part
|
|
351
|
+
of the parse memo key, so `:plugins="[docsPlugin]"` created inline in a template
|
|
352
|
+
re-parses on every parent render. A failing plugin is isolated and never corrupts
|
|
353
|
+
the last good document.
|
|
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
|
+
|
|
359
|
+
### Headless rendering
|
|
360
|
+
|
|
361
|
+
```ts
|
|
362
|
+
import { useMarkdownDocument } from '@coderminer/vue-markdown/headless'
|
|
363
|
+
|
|
364
|
+
const { document, toc, status, diagnostics, refresh } = useMarkdownDocument(source, {
|
|
365
|
+
plugins: [docsPlugin],
|
|
366
|
+
})
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
The composable owns parsing, memoization, plugin lifecycle, status, and
|
|
370
|
+
diagnostics. It renders nothing, so a host can map the serializable model to its
|
|
371
|
+
own markup.
|
|
372
|
+
|
|
373
|
+
### Syntax highlighting, math, and diagrams
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
import { highlightjs } from '@coderminer/vue-markdown/highlight'
|
|
377
|
+
import { shiki } from '@coderminer/vue-markdown/highlight/shiki'
|
|
378
|
+
import { fullPlugins } from '@coderminer/vue-markdown/plugins'
|
|
379
|
+
import { mathPlugin, katexEngine } from '@coderminer/vue-markdown/math'
|
|
380
|
+
import { mermaidPlugin, renderMermaid } from '@coderminer/vue-markdown/mermaid'
|
|
381
|
+
import '@coderminer/vue-markdown/styles/math-full.css'
|
|
382
|
+
|
|
383
|
+
const plugins = [...fullPlugins, mathPlugin(), mermaidPlugin()]
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
```vue
|
|
387
|
+
<MarkdownRenderer
|
|
388
|
+
:source="source"
|
|
389
|
+
:highlighter="shiki"
|
|
390
|
+
:math-engine="katexEngine"
|
|
391
|
+
:plugins="plugins"
|
|
392
|
+
/>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Each engine is a small adapter with an `id` and one method, so a host can provide
|
|
396
|
+
its own highlighter, math renderer, or Mermaid renderer. See the
|
|
397
|
+
[highlighting](docs/guide/highlighting.md), [math](docs/guide/math.md), and
|
|
398
|
+
[Mermaid](docs/guide/mermaid.md) guides, or the
|
|
399
|
+
[rich components guide](docs/guide/rich-components.md) for standalone
|
|
400
|
+
`CodeBlock`, `VueSyntaxHighlighter`, `MermaidBlock`, and `MermaidLiveEditor`
|
|
401
|
+
usage.
|
|
402
|
+
|
|
403
|
+
### Server rendering and static export
|
|
404
|
+
|
|
405
|
+
```ts
|
|
406
|
+
import { exportMarkdownHtml, exportMarkdownHtmlSync } from '@coderminer/vue-markdown'
|
|
407
|
+
|
|
408
|
+
const html = exportMarkdownHtmlSync(source)
|
|
409
|
+
const asyncHtml = await exportMarkdownHtml(source, { plugins: [docsPlugin] })
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Export uses the same pipeline, plugins, sanitizer, URL policy, transforms, and
|
|
413
|
+
heading IDs as rendering. `exportMarkdownHtmlSync` requires a synchronous
|
|
414
|
+
pipeline; the official pipeline supports both paths.
|
|
415
|
+
|
|
416
|
+
## Complete example
|
|
417
|
+
|
|
418
|
+
The live docs include a complete docs-portal example that combines:
|
|
419
|
+
|
|
420
|
+
- frontmatter, GFM, search, and TOC
|
|
421
|
+
- presets, plugins, and custom blockquote/link node components
|
|
422
|
+
- KaTeX math and a lazy Mermaid diagram
|
|
423
|
+
- theme switching and static HTML export
|
|
424
|
+
- the same public API used by the rest of the documentation
|
|
425
|
+
|
|
426
|
+
Open the [complete example](https://coderminer.github.io/vue-markdown/guide/complete-example.html),
|
|
427
|
+
or browse [`docs/.vitepress/theme/components/CompleteExample.vue`](docs/.vitepress/theme/components/CompleteExample.vue)
|
|
428
|
+
in the repository.
|
|
429
|
+
|
|
430
|
+
## API reference
|
|
431
|
+
|
|
432
|
+
The full reference, including every slot, region, adapter contract, and
|
|
433
|
+
component manifest, lives in the
|
|
434
|
+
[live API reference](https://coderminer.github.io/vue-markdown/reference/renderer.html).
|
|
435
|
+
|
|
436
|
+
### `MarkdownRenderer` props
|
|
437
|
+
|
|
438
|
+
| Prop | Type | Default | Notes |
|
|
439
|
+
| --- | --- | --- | --- |
|
|
440
|
+
| `source` | `string` | `''` | Controlled Markdown input. Wins over the default slot. Supports `v-model:source`. |
|
|
441
|
+
| `components` | `Record<string, Component \| string>` | `{}` | Tag-keyed overrides. |
|
|
442
|
+
| `regions` | `Partial<Record<string, Component \| string>>` | `{}` | Root, content, TOC, TOC item, code block, Mermaid block, error, empty, and loading region overrides. |
|
|
443
|
+
| `nodeComponents` | `Record<string, Component \| string \| NodeRenderer>` | `{}` | Semantic node overrides and function renderers. |
|
|
444
|
+
| `labels` | `Partial<MarkdownLabels>` | `{}` | String or function labels for built-in text. |
|
|
445
|
+
| `preset` | `MarkdownPreset \| MarkdownPreset[]` | — | Applies one or more presets. |
|
|
446
|
+
| `plugins` | `PluginInput[]` | `defaultPlugins` | Replaces the default plugin set when provided. Add `htmlPlugin()` for sanitized raw HTML. |
|
|
447
|
+
| `disablePlugins` | `string[]` | `[]` | Removes named plugins from the resolved set. Unknown names report a `plugin-unknown` warning. |
|
|
448
|
+
| `remarkPlugins` | `PluggableList` | `[]` | Runs after library remark plugins. |
|
|
449
|
+
| `rehypePlugins` | `PluggableList` | `[]` | Runs after library rehype plugins and the built-in sanitizer. |
|
|
450
|
+
| `remarkRehypeOptions` | `Record<string, unknown>` | `{}` | Merged into the conversion step. |
|
|
451
|
+
| `pipeline` | `MarkdownPipeline` | official | Advanced escape hatch; must return hast. |
|
|
452
|
+
| `slugger` | `MarkdownSlugger` | `github-slugger` | Heading ID generator. |
|
|
453
|
+
| `highlighter` | `MarkdownHighlighter` | — | Syntax highlighting adapter. |
|
|
454
|
+
| `mathEngine` | `MathEngine` | — | Math rendering adapter. |
|
|
455
|
+
| `mermaidRenderer` | `MermaidRenderer` | — | Mermaid rendering adapter. |
|
|
456
|
+
| `diagnosticsFormatter` | `DiagnosticFormatter` | — | Formats render errors. |
|
|
457
|
+
| `allowedElements` | `string[]` | — | Mutually exclusive with `disallowedElements`; wins on conflict. |
|
|
458
|
+
| `disallowedElements` | `string[]` | — | Deny list. |
|
|
459
|
+
| `unwrapDisallowed` | `boolean` | `false` | Keeps the children of removed elements. |
|
|
460
|
+
| `allowElement` | `(node, index, parent) => boolean \| null \| undefined` | — | Runs after the allow/deny lists; any falsy result rejects the element. |
|
|
461
|
+
| `urlTransform` | `(url, key, node) => string \| null \| undefined` | `defaultUrlTransform` | Applies to every URL-bearing attribute; `null` removes it and the result is revalidated. |
|
|
462
|
+
| `linkTarget` | `string` | `'_self'` | Applied to links. |
|
|
463
|
+
| `externalLinkTarget` | `'_self' \| '_blank'` | `'_self'` | `_blank` adds `rel="noopener noreferrer"`. |
|
|
464
|
+
| `baseUrl` | `string` | — | Resolves relative URLs before `urlTransform`. |
|
|
465
|
+
| `idPrefix` | `string` | `''` | Prefixes generated heading IDs. Use a unique prefix for multiple renderers on one page. |
|
|
466
|
+
| `syncHash` | `boolean` | `false` | Updates the URL hash on heading activation. |
|
|
467
|
+
| `toc` | `boolean` | `false` | Renders the TOC region. |
|
|
468
|
+
| `tocDepth` | `number` | `0` | Maximum heading level in the TOC. `0` means every level. |
|
|
469
|
+
| `tocPlacement` | `'top' \| 'left' \| 'right' \| 'hidden'` | `'top'` | Stack the TOC, place it beside the content, or hide it. |
|
|
470
|
+
| `search` | `string` | `''` | Highlights matches and emits `search-change`. |
|
|
471
|
+
| `searchCaseSensitive` | `boolean` | `false` | Makes the `search` match case-sensitive. |
|
|
472
|
+
| `searchDebounce` | `number` | `0` | Milliseconds before a new query is parsed. |
|
|
473
|
+
| `showError` | `boolean` | `true` | Renders the error region on failure. |
|
|
474
|
+
| `tokens` | `Record<string, string>` | `{}` | Inline `--vmd-*` custom properties on the root. |
|
|
475
|
+
| `theme` | `'light' \| 'dark' \| 'auto' \| 'custom'` | `'light'` | Sets `data-vmd-theme` on the root. |
|
|
476
|
+
| `as` | `string \| Component` | `'div'` | Root element or component. |
|
|
477
|
+
|
|
478
|
+
### Events
|
|
479
|
+
|
|
480
|
+
| Event | Payload |
|
|
481
|
+
| --- | --- |
|
|
482
|
+
| `update:source` | `source: string` |
|
|
483
|
+
| `toc-change` | `toc: TocItem[]` |
|
|
484
|
+
| `link-click` | `{ url, target, node, event }` |
|
|
485
|
+
| `custom-tag-click` | `{ tag, props, node, event }` |
|
|
486
|
+
| `task-change` | `{ checked, node }` |
|
|
487
|
+
| `search-change` | `{ query, caseSensitive, matches }` |
|
|
488
|
+
| `math-error` | `MarkdownDiagnostic` |
|
|
489
|
+
| `render-error` | `MarkdownDiagnostic` |
|
|
490
|
+
| `ready` | `MarkdownDocument` |
|
|
491
|
+
|
|
492
|
+
`toc-change` is signature-gated: it only fires when the serialized TOC changes.
|
|
493
|
+
`search-change` follows the `search` prop and reports the current match count
|
|
494
|
+
after the rendered document has settled for that query.
|
|
495
|
+
`ready` fires once for the first successful document.
|
|
496
|
+
|
|
497
|
+
### Slots
|
|
498
|
+
|
|
499
|
+
The `default` slot is raw Markdown text. Named region slots fully replace their
|
|
500
|
+
default region and receive scoped context: `root`, `toc`, `toc-item`, `content`,
|
|
501
|
+
`error`, `empty`, and `loading`. An absent or empty slot keeps the default
|
|
502
|
+
rendering. See the [customization guide](docs/guide/customization.md#slots).
|
|
503
|
+
|
|
504
|
+
### Entry points
|
|
505
|
+
|
|
506
|
+
| Entry | Contents |
|
|
507
|
+
| --- | --- |
|
|
508
|
+
| `@coderminer/vue-markdown` | Renderer, preset components, composables, core helpers |
|
|
509
|
+
| `@coderminer/vue-markdown/headless` | Types, model helpers, composables; no preset components or CSS |
|
|
510
|
+
| `@coderminer/vue-markdown/pipeline` | Official pipeline, custom pipeline validation, identity |
|
|
511
|
+
| `@coderminer/vue-markdown/plugins` | `defineMarkdownPlugin`, registry, built-in plugins |
|
|
512
|
+
| `@coderminer/vue-markdown/presets` | `defineMarkdownPreset`, `composePresets`, configuration types |
|
|
513
|
+
| `@coderminer/vue-markdown/highlight` | highlight.js adapter and normalization helpers |
|
|
514
|
+
| `@coderminer/vue-markdown/highlight/shiki` | Optional Shiki adapter |
|
|
515
|
+
| `@coderminer/vue-markdown/math` | `mathPlugin`, `katexEngine`, math types |
|
|
516
|
+
| `@coderminer/vue-markdown/mermaid` | Lazy Mermaid runtime and SVG sanitizer |
|
|
517
|
+
| `@coderminer/vue-markdown/editor` | Lazy CodeMirror integration |
|
|
518
|
+
| `@coderminer/vue-markdown/html` | `htmlPlugin()` and sanitized raw HTML |
|
|
519
|
+
| `@coderminer/vue-markdown/node-components` | The node component catalog only |
|
|
520
|
+
| `@coderminer/vue-markdown/components/*` | One entry per public component |
|
|
521
|
+
| `@coderminer/vue-markdown/style.css` | Full stylesheet |
|
|
522
|
+
| `@coderminer/vue-markdown/styles/tokens.css` | Design tokens only |
|
|
523
|
+
| `@coderminer/vue-markdown/styles/components.css` | Part-based component styles |
|
|
524
|
+
| `@coderminer/vue-markdown/styles/math.css` | Math container styles; import KaTeX CSS separately |
|
|
525
|
+
| `@coderminer/vue-markdown/styles/math-full.css` | KaTeX CSS plus math container styles |
|
|
526
|
+
|
|
527
|
+
## Security defaults
|
|
528
|
+
|
|
529
|
+
- Raw HTML is dropped. Add `htmlPlugin()` from `@coderminer/vue-markdown/html` to
|
|
530
|
+
enable it; the sanitizer then runs immediately after raw parsing.
|
|
531
|
+
- URL protocols are limited to `http`, `https`, `irc`, `ircs`, `mailto`,
|
|
532
|
+
`xmpp`, and relative URLs.
|
|
533
|
+
- Image `data:` URLs are raster-only; `data:image/svg+xml` is rejected.
|
|
534
|
+
- Event handler attributes and `style` are stripped from raw HTML and custom
|
|
535
|
+
tags.
|
|
536
|
+
- The render path uses no `v-html`, no `eval`, and no inline script.
|
|
537
|
+
- Mermaid is rendered with strict security and its SVG is sanitized before it
|
|
538
|
+
becomes nodes.
|
|
539
|
+
|
|
540
|
+
See [docs/guide/security.md](docs/guide/security.md) for the full policy.
|
|
541
|
+
|
|
542
|
+
## Documentation
|
|
543
|
+
|
|
544
|
+
| Guide | What it covers |
|
|
545
|
+
| --- | --- |
|
|
546
|
+
| [Rich components](docs/guide/rich-components.md) | `CodeBlock`, `VueSyntaxHighlighter`, `MermaidBlock`, and `MermaidLiveEditor` usage |
|
|
547
|
+
| [Styling and themes](docs/guide/styling.md) | Tokens, themes, parts, and unstyled mode |
|
|
548
|
+
| [Customization](docs/guide/customization.md) | Precedence, regions, node components, slots, manifests |
|
|
549
|
+
| [Cookbook](docs/guide/cookbook.md) | Copy-paste recipes for common tasks |
|
|
550
|
+
| [Headless usage](docs/guide/headless.md) | `useMarkdownDocument`, the model, and helper APIs |
|
|
551
|
+
| [Pipeline](docs/guide/pipeline.md) | The official unified pipeline and stage order |
|
|
552
|
+
| [Custom pipeline](docs/guide/custom-pipeline.md) | Authoring and validating a replacement pipeline |
|
|
553
|
+
| [Plugins](docs/guide/plugins.md) | Plugin contracts, ordering, lifecycle, and remark/rehype |
|
|
554
|
+
| [CommonMark and GFM](docs/guide/commonmark-gfm.md) | Syntax coverage and conformance |
|
|
555
|
+
| [Raw HTML and security](docs/guide/security.md) | Sanitization, URL policy, CSP, and custom tags |
|
|
556
|
+
| [Syntax highlighting](docs/guide/highlighting.md) | Adapters, Shiki, caching, and server rendering |
|
|
557
|
+
| [Math](docs/guide/math.md) | `mathPlugin`, delimiters, engines, and fallbacks |
|
|
558
|
+
| [Mermaid](docs/guide/mermaid.md) | Lazy runtime, sanitizer, block states, and editor |
|
|
559
|
+
| [SSR and static export](docs/guide/ssr.md) | Server rendering and static HTML helpers |
|
|
560
|
+
| [Audits](docs/guide/audits.md) | Accessibility, reduced motion, RTL, and cleanup |
|
|
561
|
+
|
|
562
|
+
## Development
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
npm install
|
|
566
|
+
npm run docs:dev # documentation site (VitePress)
|
|
567
|
+
npm run docs:build # static documentation site
|
|
568
|
+
npm run dev # interactive demo
|
|
569
|
+
npm run build:lib # library, declarations, styles
|
|
570
|
+
npm test # node + happy-dom projects
|
|
571
|
+
npm run typecheck
|
|
572
|
+
npm run lint
|
|
573
|
+
npm run size # bundle entry guard
|
|
574
|
+
npm run bench # parse/render budget gate
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
The documentation site is deployed to GitHub Pages by
|
|
578
|
+
`.github/workflows/pages.yml`. The repository also contains `AGENTS.md`, which
|
|
579
|
+
documents the layered architecture and the rules that keep the core DOM-free and
|
|
580
|
+
the dependency direction one-way.
|
|
581
|
+
|
|
582
|
+
## License
|
|
583
|
+
|
|
584
|
+
[MIT](LICENSE) © CoderMiner
|