@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.
Files changed (232) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/LICENSE +21 -0
  3. package/README.md +584 -3
  4. package/README.zh-CN.md +550 -0
  5. package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +16 -0
  6. package/dist/chunks/MarkdownBreak-BwCi2Itt.js +16 -0
  7. package/dist/chunks/MarkdownCode-B1k9tmW5.js +63 -0
  8. package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +49 -0
  9. package/dist/chunks/MarkdownContent-BAK6dqo7.js +13 -0
  10. package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
  11. package/dist/chunks/MarkdownEmphasis-CppivOEu.js +16 -0
  12. package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +14 -0
  13. package/dist/chunks/MarkdownError-C0sPs5W0.js +17 -0
  14. package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +22 -0
  15. package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +21 -0
  16. package/dist/chunks/MarkdownHeading-DaNcP0_6.js +29 -0
  17. package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +16 -0
  18. package/dist/chunks/MarkdownHtml-66lYkvwM.js +13 -0
  19. package/dist/chunks/MarkdownImage-BRy76svs.js +51 -0
  20. package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +16 -0
  21. package/dist/chunks/MarkdownLink-Dbx3NwgV.js +45 -0
  22. package/dist/chunks/MarkdownList-BJ-_C71k.js +20 -0
  23. package/dist/chunks/MarkdownListItem-Z1EHIY26.js +16 -0
  24. package/dist/chunks/MarkdownLoading-D-RYtXxf.js +15 -0
  25. package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +16 -0
  26. package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
  27. package/dist/chunks/MarkdownRoot-DEE6iVfh.js +23 -0
  28. package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +16 -0
  29. package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +16 -0
  30. package/dist/chunks/MarkdownTable-DmBTg_CR.js +16 -0
  31. package/dist/chunks/MarkdownTableCell-eiCJe847.js +31 -0
  32. package/dist/chunks/MarkdownTableRow-DuJaPntg.js +16 -0
  33. package/dist/chunks/MarkdownTableSection-PFHz-R33.js +24 -0
  34. package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +38 -0
  35. package/dist/chunks/MarkdownToc-DHWWoH6t.js +49 -0
  36. package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +25 -0
  37. package/dist/chunks/MermaidLiveEditor-1TKkI5bp.js +414 -0
  38. package/dist/chunks/VueSyntaxHighlighter-BWpCO-cX.js +260 -0
  39. package/dist/chunks/adapters-CMwX_NEI.js +26 -0
  40. package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
  41. package/dist/chunks/blank-line-CKKsFeKR.js +88 -0
  42. package/dist/chunks/codemirror-DyphMAEg.js +82 -0
  43. package/dist/chunks/config-aRYo2R8_.js +10 -0
  44. package/dist/chunks/context-8NfW6fxI.js +30 -0
  45. package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
  46. package/dist/chunks/default-ZQ5aHh-N.js +3 -0
  47. package/dist/chunks/diagnostics-CtHoJyiX.js +23 -0
  48. package/dist/chunks/export-BrgMLgUp.js +1574 -0
  49. package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
  50. package/dist/chunks/hast-util-from-html-D3e_iQ89.js +5088 -0
  51. package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
  52. package/dist/chunks/identity-Bi27FKyx.js +6243 -0
  53. package/dist/chunks/labels-BtHiUTQI.js +47 -0
  54. package/dist/chunks/lib-CCnkLL6S.js +252 -0
  55. package/dist/chunks/longest-streak-DZE_EqsU.js +8 -0
  56. package/dist/chunks/micromark-factory-space-CpXAnYUY.js +137 -0
  57. package/dist/chunks/normalize-VKfQXZiK.js +226 -0
  58. package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
  59. package/dist/chunks/plugin-YWo5uqTh.js +27 -0
  60. package/dist/chunks/preset-BjaOuJUL.js +44 -0
  61. package/dist/chunks/registry-B7BfEkuy.js +6150 -0
  62. package/dist/chunks/render-DAqK0w5J.js +1754 -0
  63. package/dist/chunks/rolldown-runtime-QGRDbDUS.js +19 -0
  64. package/dist/chunks/runtime-D95F41zG.js +574 -0
  65. package/dist/chunks/security-y4EwUyAs.js +212 -0
  66. package/dist/chunks/shared-NjFDPmkb.js +67 -0
  67. package/dist/chunks/space-separated-tokens-1ebNqf35.js +1097 -0
  68. package/dist/chunks/url-D2BoivaE.js +24 -0
  69. package/dist/chunks/useActiveHeading-CnyGTG1u.js +359 -0
  70. package/dist/components/CodeBlock.d.ts +73 -0
  71. package/dist/components/CodeBlock.js +1 -0
  72. package/dist/components/Icon.d.ts +6 -0
  73. package/dist/components/MarkdownBlockquote.d.ts +18 -0
  74. package/dist/components/MarkdownBlockquote.js +1 -0
  75. package/dist/components/MarkdownBreak.d.ts +8 -0
  76. package/dist/components/MarkdownBreak.js +1 -0
  77. package/dist/components/MarkdownChildren.d.ts +17 -0
  78. package/dist/components/MarkdownCode.d.ts +29 -0
  79. package/dist/components/MarkdownCode.js +1 -0
  80. package/dist/components/MarkdownConfigProvider.d.ts +33 -0
  81. package/dist/components/MarkdownConfigProvider.js +1 -0
  82. package/dist/components/MarkdownContent.d.ts +16 -0
  83. package/dist/components/MarkdownContent.js +1 -0
  84. package/dist/components/MarkdownCustomTag.d.ts +20 -0
  85. package/dist/components/MarkdownCustomTag.js +1 -0
  86. package/dist/components/MarkdownEmphasis.d.ts +18 -0
  87. package/dist/components/MarkdownEmphasis.js +1 -0
  88. package/dist/components/MarkdownEmpty.d.ts +8 -0
  89. package/dist/components/MarkdownEmpty.js +1 -0
  90. package/dist/components/MarkdownError.d.ts +11 -0
  91. package/dist/components/MarkdownError.js +1 -0
  92. package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
  93. package/dist/components/MarkdownFootnoteReference.js +1 -0
  94. package/dist/components/MarkdownFootnotes.d.ts +17 -0
  95. package/dist/components/MarkdownFootnotes.js +1 -0
  96. package/dist/components/MarkdownHeading.d.ts +18 -0
  97. package/dist/components/MarkdownHeading.js +1 -0
  98. package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
  99. package/dist/components/MarkdownHorizontalRule.js +1 -0
  100. package/dist/components/MarkdownHtml.d.ts +8 -0
  101. package/dist/components/MarkdownHtml.js +1 -0
  102. package/dist/components/MarkdownImage.d.ts +15 -0
  103. package/dist/components/MarkdownImage.js +1 -0
  104. package/dist/components/MarkdownInlineCode.d.ts +18 -0
  105. package/dist/components/MarkdownInlineCode.js +1 -0
  106. package/dist/components/MarkdownLink.d.ts +22 -0
  107. package/dist/components/MarkdownLink.js +1 -0
  108. package/dist/components/MarkdownList.d.ts +18 -0
  109. package/dist/components/MarkdownList.js +1 -0
  110. package/dist/components/MarkdownListItem.d.ts +18 -0
  111. package/dist/components/MarkdownListItem.js +1 -0
  112. package/dist/components/MarkdownLoading.d.ts +8 -0
  113. package/dist/components/MarkdownLoading.js +1 -0
  114. package/dist/components/MarkdownMath.d.ts +12 -0
  115. package/dist/components/MarkdownMath.js +1 -0
  116. package/dist/components/MarkdownMermaid.d.ts +78 -0
  117. package/dist/components/MarkdownMermaid.js +1 -0
  118. package/dist/components/MarkdownParagraph.d.ts +18 -0
  119. package/dist/components/MarkdownParagraph.js +1 -0
  120. package/dist/components/MarkdownRenderer.d.ts +167 -0
  121. package/dist/components/MarkdownRenderer.js +1 -0
  122. package/dist/components/MarkdownRoot.d.ts +24 -0
  123. package/dist/components/MarkdownRoot.js +1 -0
  124. package/dist/components/MarkdownStrikethrough.d.ts +18 -0
  125. package/dist/components/MarkdownStrikethrough.js +1 -0
  126. package/dist/components/MarkdownStrong.d.ts +18 -0
  127. package/dist/components/MarkdownStrong.js +1 -0
  128. package/dist/components/MarkdownTable.d.ts +18 -0
  129. package/dist/components/MarkdownTable.js +1 -0
  130. package/dist/components/MarkdownTableCell.d.ts +20 -0
  131. package/dist/components/MarkdownTableCell.js +1 -0
  132. package/dist/components/MarkdownTableRow.d.ts +18 -0
  133. package/dist/components/MarkdownTableRow.js +1 -0
  134. package/dist/components/MarkdownTableSection.d.ts +18 -0
  135. package/dist/components/MarkdownTableSection.js +1 -0
  136. package/dist/components/MarkdownTaskItem.d.ts +20 -0
  137. package/dist/components/MarkdownTaskItem.js +1 -0
  138. package/dist/components/MarkdownToc.d.ts +36 -0
  139. package/dist/components/MarkdownToc.js +1 -0
  140. package/dist/components/MarkdownTocItem.d.ts +14 -0
  141. package/dist/components/MarkdownTocItem.js +1 -0
  142. package/dist/components/MermaidBlock.d.ts +50 -0
  143. package/dist/components/MermaidBlock.js +1 -0
  144. package/dist/components/MermaidLiveEditor.d.ts +44 -0
  145. package/dist/components/MermaidLiveEditor.js +1 -0
  146. package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
  147. package/dist/components/VueSyntaxHighlighter.js +1 -0
  148. package/dist/components/codeRegion.d.ts +14 -0
  149. package/dist/components/config.d.ts +7 -0
  150. package/dist/components/context.d.ts +45 -0
  151. package/dist/components/index.d.ts +42 -0
  152. package/dist/components/index.js +38 -0
  153. package/dist/components/render.d.ts +9 -0
  154. package/dist/components/scroll-lock.d.ts +7 -0
  155. package/dist/components/types.d.ts +61 -0
  156. package/dist/composables/useActiveHeading.d.ts +12 -0
  157. package/dist/composables/useCodeHighlighter.d.ts +30 -0
  158. package/dist/composables/useLineWindow.d.ts +38 -0
  159. package/dist/composables/useMarkdownDocument.d.ts +25 -0
  160. package/dist/core/adapters.d.ts +7 -0
  161. package/dist/core/config.d.ts +5 -0
  162. package/dist/core/diagnostics.d.ts +9 -0
  163. package/dist/core/finalize.d.ts +18 -0
  164. package/dist/core/hast-nodes.d.ts +3 -0
  165. package/dist/core/hast-to-nodes.d.ts +9 -0
  166. package/dist/core/highlight-lines.d.ts +8 -0
  167. package/dist/core/identity.d.ts +4 -0
  168. package/dist/core/labels.d.ts +4 -0
  169. package/dist/core/manifest.d.ts +38 -0
  170. package/dist/core/memo.d.ts +5 -0
  171. package/dist/core/model-hast.d.ts +8 -0
  172. package/dist/core/model.d.ts +10 -0
  173. package/dist/core/normalize.d.ts +37 -0
  174. package/dist/core/parts.d.ts +136 -0
  175. package/dist/core/preset.d.ts +10 -0
  176. package/dist/core/run.d.ts +16 -0
  177. package/dist/core/search.d.ts +5 -0
  178. package/dist/core/security.d.ts +21 -0
  179. package/dist/core/slugger.d.ts +13 -0
  180. package/dist/core/types.d.ts +392 -0
  181. package/dist/core/url.d.ts +10 -0
  182. package/dist/editor/codemirror.d.ts +14 -0
  183. package/dist/editor/index.d.ts +2 -0
  184. package/dist/editor/index.js +1 -0
  185. package/dist/export/index.d.ts +6 -0
  186. package/dist/headless.d.ts +21 -0
  187. package/dist/headless.js +12 -0
  188. package/dist/highlight/convert-hast.d.ts +8 -0
  189. package/dist/highlight/highlightjs.d.ts +7 -0
  190. package/dist/highlight/index.d.ts +4 -0
  191. package/dist/highlight/index.js +4 -0
  192. package/dist/highlight/shared.d.ts +11 -0
  193. package/dist/highlight/shiki.d.ts +7 -0
  194. package/dist/highlight/shiki.js +75 -0
  195. package/dist/html/index.d.ts +17 -0
  196. package/dist/html/index.js +11 -0
  197. package/dist/index.d.ts +24 -0
  198. package/dist/index.js +53 -0
  199. package/dist/math/index.d.ts +4 -0
  200. package/dist/math/index.js +585 -0
  201. package/dist/math/katex.d.ts +4 -0
  202. package/dist/math/plugin.d.ts +20 -0
  203. package/dist/mermaid/index.d.ts +6 -0
  204. package/dist/mermaid/index.js +8 -0
  205. package/dist/mermaid/plugin.d.ts +17 -0
  206. package/dist/mermaid/runtime.d.ts +14 -0
  207. package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
  208. package/dist/mermaid/sanitize-svg.d.ts +3 -0
  209. package/dist/mermaid/sanitize.d.ts +16 -0
  210. package/dist/node-components.d.ts +1 -0
  211. package/dist/node-components.js +39 -0
  212. package/dist/pipeline/custom.d.ts +8 -0
  213. package/dist/pipeline/identity.d.ts +12 -0
  214. package/dist/pipeline/index.d.ts +5 -0
  215. package/dist/pipeline/official.d.ts +6 -0
  216. package/dist/pipeline.d.ts +1 -0
  217. package/dist/pipeline.js +1 -0
  218. package/dist/plugins/builtin.d.ts +15 -0
  219. package/dist/plugins/define.d.ts +7 -0
  220. package/dist/plugins/registry.d.ts +16 -0
  221. package/dist/plugins/source.d.ts +7 -0
  222. package/dist/plugins.d.ts +3 -0
  223. package/dist/plugins.js +1 -0
  224. package/dist/presets.d.ts +3 -0
  225. package/dist/presets.js +1 -0
  226. package/dist/style.css +2 -0
  227. package/dist/styles/components.css +737 -0
  228. package/dist/styles/index.d.ts +1 -0
  229. package/dist/styles/math-full.css +3 -0
  230. package/dist/styles/math.css +18 -0
  231. package/dist/styles/tokens.css +96 -0
  232. package/package.json +214 -6
@@ -0,0 +1,550 @@
1
+ # @coderminer/vue-markdown
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@coderminer/vue-markdown.svg)](https://www.npmjs.com/package/@coderminer/vue-markdown)
4
+ [![CI](https://github.com/coderminer/vue-markdown/workflows/ci.yml/badge.svg)](https://github.com/coderminer/vue-markdown/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+ [![Docs](https://img.shields.io/badge/docs-live-8250df)](https://coderminer.github.io/vue-markdown/)
7
+
8
+ [English](./README.md) | 简体中文 | [更新日志](./CHANGELOG.md)
9
+
10
+ 一个通用、可定制、插件驱动的 **Vue 3 Markdown 组件套件**。
11
+
12
+ `@coderminer/vue-markdown` 用官方 `unified` 管线(`remark-parse` + `remark-rehype`)把
13
+ Markdown 直接渲染成 Vue VNode:不经过 HTML 字符串往返,也不使用 `v-html`。解析结果是
14
+ 可序列化、与 DOM 无关的文档模型,因此同一份结果既可以交给带样式的渲染器,也可以交给
15
+ 无头宿主或静态 HTML 导出。
16
+
17
+ - **Vue 原生** —— 文档存放在 `shallowRef` 中,使用稳定 key 和文本快速路径,并按输入
18
+ 缓存解析结果,重复渲染开销很小。
19
+ - **处处可定制** —— 可以替换任意标签;每个视觉部件都有稳定的 `data-vmd-part` 和
20
+ `vmd-*` 类名;主题通过 `--vmd-*` 设计令牌控制。
21
+ - **插件驱动** —— 插件可以贡献 remark/rehype 插件、源码与文档变换、组件、文案、
22
+ 令牌以及生命周期钩子。
23
+ - **默认安全** —— 原始 HTML 默认被丢弃,URL 会经过校验;宿主通过 `htmlPlugin()`
24
+ 显式开启时,解析器与内置净化器会成对启用。
25
+ - **可用于 SSR** —— 标题 ID 确定性生成,提供同步解析路径,静态 HTML 导出复用同一套
26
+ 净化、过滤和 URL 策略。
27
+ - **可选引擎按需加载** —— highlight.js、Shiki、KaTeX、Mermaid 和 CodeMirror 各自
28
+ 位于独立入口或懒加载分块中。
29
+
30
+ **英文文档:** <https://coderminer.github.io/vue-markdown/>
31
+ **中文文档:** [docs/zh](./docs/zh/index.md)(本地运行 `npm run docs:dev` 后访问 `/zh/`)
32
+
33
+ ## 安装
34
+
35
+ ```bash
36
+ npm install @coderminer/vue-markdown
37
+ ```
38
+
39
+ 需要 Node 20+ 和 Vue 3.3+。
40
+
41
+ 可选引擎都是 peer 依赖,只安装实际用到的部分:
42
+
43
+ ```bash
44
+ # 语法高亮
45
+ npm install highlight.js
46
+ # 或者
47
+ npm install shiki
48
+
49
+ # 数学公式
50
+ npm install katex
51
+
52
+ # 图表
53
+ npm install mermaid
54
+
55
+ # 通过 @coderminer/vue-markdown/html 启用净化后的原始 HTML
56
+ npm install rehype-raw
57
+
58
+ # Mermaid 可视化编辑器
59
+ npm install @codemirror/state @codemirror/view @codemirror/language @codemirror/commands
60
+ ```
61
+
62
+ ## 快速开始
63
+
64
+ ```vue
65
+ <script setup lang="ts">
66
+ import { ref } from 'vue'
67
+ import { MarkdownRenderer } from '@coderminer/vue-markdown'
68
+ import '@coderminer/vue-markdown/style.css'
69
+
70
+ const source = ref(`
71
+ # 你好,Markdown
72
+
73
+ 一段带 **加粗** 和 [链接](https://example.com) 的文字。
74
+
75
+ - Vue 组件
76
+ - 默认安全
77
+ - 支持 SSR
78
+ `)
79
+ </script>
80
+
81
+ <template>
82
+ <MarkdownRenderer v-model:source="source" toc />
83
+ </template>
84
+ ```
85
+
86
+ 就这些。样式表是可选的:不引入样式表时,标记仍然是语义化、可访问的,所有行为也照常
87
+ 工作。
88
+
89
+ ## 基础用法
90
+
91
+ ### 输入
92
+
93
+ Markdown 可以通过 `source` 属性、`v-model:source` 或默认插槽传入:
94
+
95
+ ```vue
96
+ <MarkdownRenderer source="# 来自属性" />
97
+ <MarkdownRenderer v-model:source="source" />
98
+ <MarkdownRenderer># 来自插槽</MarkdownRenderer>
99
+ ```
100
+
101
+ `source` 是受控值,优先级高于插槽。插槽只接受纯文本,其文本内容变化后会被重新读取。
102
+ 传入非字符串的 `source` 会产生一条诊断信息并渲染空状态,而不是抛错。
103
+
104
+ 对于编辑器等频繁变化的输入,请绑定 `source`,让父组件持有数据。
105
+
106
+ ### 样式
107
+
108
+ ```ts
109
+ import '@coderminer/vue-markdown/style.css'
110
+ // 也可以分开引入
111
+ import '@coderminer/vue-markdown/styles/tokens.css'
112
+ import '@coderminer/vue-markdown/styles/components.css'
113
+ ```
114
+
115
+ 在任意祖先元素上覆盖令牌,或通过 `tokens` 属性传入:
116
+
117
+ ```vue
118
+ <MarkdownRenderer
119
+ :source="source"
120
+ theme="auto"
121
+ :tokens="{ '--vmd-color-accent': '#8250df' }"
122
+ />
123
+ ```
124
+
125
+ 每个视觉部件同时暴露稳定类名和 `data-vmd-part` 属性:
126
+
127
+ ```css
128
+ [data-vmd-part='heading'] {
129
+ letter-spacing: -0.01em;
130
+ }
131
+
132
+ [data-vmd-part='code'] {
133
+ --vmd-code-bg: #0d1117;
134
+ color: #e6edf3;
135
+ }
136
+ ```
137
+
138
+ 不要用 `h1`、`pre`、`table` 这类元素选择器写样式,因为宿主可以替换任意标签组件。请以
139
+ 文档中列出的 part 和令牌为准。
140
+
141
+ ### 事件与实例方法
142
+
143
+ ```vue
144
+ <script setup lang="ts">
145
+ import { ref } from 'vue'
146
+ import type { MarkdownRendererInstance, TocItem } from '@coderminer/vue-markdown'
147
+
148
+ const renderer = ref<MarkdownRendererInstance>()
149
+
150
+ function onToc(toc: TocItem[]) {
151
+ console.log(toc)
152
+ }
153
+ </script>
154
+
155
+ <template>
156
+ <MarkdownRenderer
157
+ ref="renderer"
158
+ :source="source"
159
+ toc
160
+ @toc-change="onToc"
161
+ @link-click="onLink"
162
+ @task-change="onTask"
163
+ @render-error="onError"
164
+ @ready="onReady"
165
+ />
166
+ </template>
167
+ ```
168
+
169
+ 实例暴露的方法:
170
+
171
+ | 方法 | 签名 |
172
+ | --- | --- |
173
+ | `scrollToHeading` | `(id: string, options?: ScrollIntoViewOptions) => void` |
174
+ | `getDocument` | `() => MarkdownDocument \| undefined` |
175
+ | `getToc` | `() => TocItem[]` |
176
+ | `refresh` | `() => Promise<void>` |
177
+ | `updateSource` | `(source: string) => void` |
178
+
179
+ ## 定制
180
+
181
+ 定制是分层的,优先级固定:
182
+
183
+ ```text
184
+ 局部属性 > 最近的 Provider > 预设 > 插件默认值 > 内置默认值
185
+ ```
186
+
187
+ ### 替换元素
188
+
189
+ ```vue
190
+ <script setup lang="ts">
191
+ import { MarkdownRenderer } from '@coderminer/vue-markdown'
192
+ import BadgeLink from './BadgeLink.vue'
193
+ import Callout from './Callout.vue'
194
+ import MyToc from './MyToc.vue'
195
+
196
+ const components = {
197
+ h1: 'h2',
198
+ a: BadgeLink,
199
+ }
200
+
201
+ const nodeComponents = {
202
+ blockquote: Callout,
203
+ }
204
+
205
+ const regions = {
206
+ toc: MyToc,
207
+ }
208
+ </script>
209
+
210
+ <template>
211
+ <MarkdownRenderer
212
+ :source="source"
213
+ :components="components"
214
+ :node-components="nodeComponents"
215
+ :regions="regions"
216
+ />
217
+ </template>
218
+ ```
219
+
220
+ - `components` 以标签名为键,值可以是标签名字符串或 Vue 组件。
221
+ - `nodeComponents` 面向语义节点(`code`、`math`、`mermaid`、`custom` 以及元素标签),
222
+ 也接受函数渲染器。
223
+ - `regions` 替换结构性区域:根、内容、目录、目录项、代码块、Mermaid 块、错误、空状态、
224
+ 加载状态。
225
+ - 具名插槽是最后一层,能拿到作用域数据和可执行动作。
226
+
227
+ 围栏代码块始终由 `components.pre` 包裹,内部元素则通过 `components.code` 或
228
+ `nodeComponents.code` 解析。
229
+
230
+ ### 主题
231
+
232
+ ```vue
233
+ <!-- 预设:light | dark | auto | custom -->
234
+ <MarkdownRenderer theme="auto" :source="source" toc />
235
+
236
+ <!-- 单实例令牌 -->
237
+ <MarkdownRenderer
238
+ theme="auto"
239
+ :source="source"
240
+ :tokens="{
241
+ '--vmd-color-accent': '#8250df',
242
+ '--vmd-radius-md': '12px',
243
+ }"
244
+ />
245
+
246
+ <!-- 应用级默认值 -->
247
+ <MarkdownConfigProvider theme="auto" :tokens="brandTokens">
248
+ <MarkdownRenderer :source="source" toc />
249
+ </MarkdownConfigProvider>
250
+ ```
251
+
252
+ 渲染器只在自己的根元素上写入 `data-vmd-theme`,不会影响宿主页面。`auto` 跟随
253
+ `prefers-color-scheme`;`custom` 不应用任何预设颜色,你的令牌覆盖会原样生效。
254
+
255
+ ### CSS
256
+
257
+ ```css
258
+ .my-docs {
259
+ --vmd-font-size: 1.0625rem;
260
+ --vmd-line-height: 1.8;
261
+ --vmd-color-accent: #8250df;
262
+ }
263
+
264
+ [data-vmd-part='heading'] {
265
+ letter-spacing: -0.01em;
266
+ }
267
+ ```
268
+
269
+ 完整约定见中文文档的[样式与主题](./docs/zh/guide/styling.md)和
270
+ [定制](./docs/zh/guide/customization.md)。
271
+
272
+ ## 进阶用法
273
+
274
+ ### 插件与预设
275
+
276
+ ```ts
277
+ import { defineMarkdownPlugin } from '@coderminer/vue-markdown/plugins'
278
+ import { composePresets, defineMarkdownPreset } from '@coderminer/vue-markdown/presets'
279
+
280
+ export const docsPlugin = defineMarkdownPlugin({
281
+ name: 'docs',
282
+ phase: 'normal',
283
+ remarkPlugins: [],
284
+ rehypePlugins: [],
285
+ components: { h2: 'h3' },
286
+ labels: { toc: '本页目录' },
287
+ tokens: { '--vmd-color-accent': '#8250df' },
288
+ transformDocument(document) {
289
+ return { ...document, frontmatter: { ...document.frontmatter, docs: true } }
290
+ },
291
+ setup() {
292
+ // 每个解析后的插件集合执行一次,运行在 effectScope 中。
293
+ return () => {
294
+ // 重新配置或卸载时清理。
295
+ }
296
+ },
297
+ })
298
+
299
+ export const docsPreset = composePresets(
300
+ defineMarkdownPreset({ name: 'base', theme: 'auto' }),
301
+ defineMarkdownPreset({ name: 'docs', tokens: { '--vmd-radius-md': '10px' } }),
302
+ )
303
+ ```
304
+
305
+ ```vue
306
+ <script setup lang="ts">
307
+ // 在模块作用域或 setup 中创建一次,不要在模板里内联创建。
308
+ const plugins = [docsPlugin]
309
+ </script>
310
+
311
+ <template>
312
+ <MarkdownRenderer :source="source" :plugins="plugins" :preset="docsPreset" toc />
313
+ </template>
314
+ ```
315
+
316
+ 排序规则是 `pre` → `normal` → `post`,同阶段内按注册顺序执行。同名插件会确定性地替换
317
+ 前一个,并产生一条诊断信息。插件身份参与解析缓存 key,因此
318
+ `:plugins="[docsPlugin]"` 这种模板内联写法会在每次父组件渲染时重新解析。单个插件失败
319
+ 会被隔离,不会破坏上一份正常文档。
320
+
321
+ `toc`、`code`、`link` 是内核不变标记:即使写进 `disablePlugins` 也不会被移除,只会
322
+ 报告一条 `plugin-core` 诊断。`disablePlugins` 匹配插件的 `name`,不是导出的工厂函数名;
323
+ 未知名称会报告 `plugin-unknown` 警告。完整列表见
324
+ [插件名称表](docs/zh/guide/plugins.md#disableplugins-名称)。
325
+
326
+ ### 无头渲染
327
+
328
+ ```ts
329
+ import { useMarkdownDocument } from '@coderminer/vue-markdown/headless'
330
+
331
+ const {
332
+ document,
333
+ toc,
334
+ status,
335
+ diagnostics,
336
+ refresh,
337
+ } = useMarkdownDocument(source, {
338
+ plugins: [docsPlugin],
339
+ })
340
+ ```
341
+
342
+ 无头组合式函数负责解析、记忆化、插件生命周期、状态和诊断,但不渲染任何内容。你可以
343
+ 把可序列化的模型映射成自己的标记。
344
+
345
+ ### 语法高亮、数学与图表
346
+
347
+ ```ts
348
+ import { highlightjs } from '@coderminer/vue-markdown/highlight'
349
+ import { shiki } from '@coderminer/vue-markdown/highlight/shiki'
350
+ import { fullPlugins } from '@coderminer/vue-markdown/plugins'
351
+ import { mathPlugin, katexEngine } from '@coderminer/vue-markdown/math'
352
+ import { mermaidPlugin, renderMermaid } from '@coderminer/vue-markdown/mermaid'
353
+ import '@coderminer/vue-markdown/styles/math-full.css'
354
+
355
+ const plugins = [...fullPlugins, mathPlugin(), mermaidPlugin()]
356
+ ```
357
+
358
+ ```vue
359
+ <MarkdownRenderer
360
+ :source="source"
361
+ :highlighter="shiki"
362
+ :math-engine="katexEngine"
363
+ :plugins="plugins"
364
+ />
365
+ ```
366
+
367
+ 每个引擎都是一个带 `id` 和单个方法的小适配器,宿主可以接入自己的高亮器、数学渲染器
368
+ 或 Mermaid 渲染器。详细说明见[语法高亮](./docs/zh/guide/highlighting.md)、
369
+ [数学公式](./docs/zh/guide/math.md)、[Mermaid](./docs/zh/guide/mermaid.md)和
370
+ [富组件](./docs/zh/guide/rich-components.md)。
371
+
372
+ ### 服务端渲染与静态导出
373
+
374
+ ```ts
375
+ import { exportMarkdownHtml, exportMarkdownHtmlSync } from '@coderminer/vue-markdown'
376
+
377
+ const html = exportMarkdownHtmlSync(source)
378
+ const asyncHtml = await exportMarkdownHtml(source, { plugins: [docsPlugin] })
379
+ ```
380
+
381
+ 导出与渲染共用同一套管线、插件、净化器、URL 策略、变换和标题 ID。
382
+ `exportMarkdownHtmlSync` 要求管线支持同步执行;官方管线两条路径都支持。插件节点会以
383
+ 带 `data-vmd-part="plugin"`、`data-plugin-type`、`data-plugin-key` 的 `span` 保留在
384
+ 输出中;如果某个插件节点只能由宿主组件渲染,导出会写入带 `data-plugin-unrendered`
385
+ 的空占位符,而不是直接丢弃。
386
+
387
+ ## 完整示例
388
+
389
+ 中文文档包含一个可运行的完整文档门户示例,组合了:
390
+
391
+ - frontmatter、GFM、搜索和目录
392
+ - 预设、插件,以及自定义引用块与链接节点组件
393
+ - KaTeX 数学公式和按需加载的 Mermaid 图表
394
+ - 主题切换和静态 HTML 导出
395
+ - 与其余文档完全相同的公共 API
396
+
397
+ 打开[完整示例](./docs/zh/guide/complete-example.md),或查看
398
+ [`docs/.vitepress/theme/components/CompleteExample.vue`](./docs/.vitepress/theme/components/CompleteExample.vue)。
399
+
400
+ ## API 速查
401
+
402
+ 完整参考(包括所有插槽、区域、适配器契约和组件清单)见中文
403
+ [API 参考](./docs/zh/reference/api.md)。
404
+
405
+ ### `MarkdownRenderer` 属性
406
+
407
+ | 属性 | 类型 | 默认值 | 说明 |
408
+ | --- | --- | --- | --- |
409
+ | `source` | `string` | `''` | 受控 Markdown 输入,优先级高于默认插槽;支持 `v-model:source`。 |
410
+ | `components` | `Record<string, Component \| string>` | `{}` | 以标签名为键的组件覆盖。 |
411
+ | `regions` | `Partial<Record<string, Component \| string>>` | `{}` | 结构性区域覆盖。 |
412
+ | `nodeComponents` | `Record<string, Component \| string \| NodeRenderer>` | `{}` | 语义节点覆盖和函数渲染器。 |
413
+ | `labels` | `Partial<MarkdownLabels>` | `{}` | 内置文案,支持字符串或函数。 |
414
+ | `preset` | `MarkdownPreset \| MarkdownPreset[]` | — | 应用一个或多个预设。 |
415
+ | `plugins` | `PluginInput[]` | `defaultPlugins` | 传入后替换默认插件集合;加入 `htmlPlugin()` 可启用净化后的原始 HTML。 |
416
+ | `disablePlugins` | `string[]` | `[]` | 按名称移除解析后的非内核插件;未知名称会报告 `plugin-unknown` 警告。 |
417
+ | `remarkPlugins` | `PluggableList` | `[]` | 在库内置 remark 插件之后运行。 |
418
+ | `rehypePlugins` | `PluggableList` | `[]` | 在库内置 rehype 插件和内置净化器之后运行。 |
419
+ | `remarkRehypeOptions` | `Record<string, unknown>` | `{}` | 合并到 mdast → hast 转换步骤。 |
420
+ | `pipeline` | `MarkdownPipeline` | 官方管线 | 高级逃生口,必须返回 hast。 |
421
+ | `slugger` | `MarkdownSlugger` | `github-slugger` | 标题 ID 生成器。 |
422
+ | `highlighter` | `MarkdownHighlighter` | — | 语法高亮适配器。 |
423
+ | `mathEngine` | `MathEngine` | — | 数学渲染适配器。 |
424
+ | `mermaidRenderer` | `MermaidRenderer` | — | Mermaid 渲染适配器。 |
425
+ | `diagnosticsFormatter` | `DiagnosticFormatter` | — | 格式化渲染错误。 |
426
+ | `allowedElements` | `string[]` | — | 允许列表,与 `disallowedElements` 互斥,冲突时优先。 |
427
+ | `disallowedElements` | `string[]` | — | 拒绝列表。 |
428
+ | `unwrapDisallowed` | `boolean` | `false` | 保留被移除元素的子节点。 |
429
+ | `allowElement` | `(node, index, parent) => boolean \| null \| undefined` | — | 在允许/拒绝列表之后逐个判断,返回假值即拒绝。 |
430
+ | `urlTransform` | `(url, key, node) => string \| null \| undefined` | `defaultUrlTransform` | 作用于所有携带 URL 的属性;返回 `null` 删除该属性,结果会再次校验。 |
431
+ | `linkTarget` | `string` | `'_self'` | 链接目标。 |
432
+ | `externalLinkTarget` | `'_self' \| '_blank'` | `'_self'` | `_blank` 会附加 `rel="noopener noreferrer"`。 |
433
+ | `baseUrl` | `string` | — | 在 `urlTransform` 之前解析相对 URL。 |
434
+ | `idPrefix` | `string` | `''` | 为生成的标题 ID 加前缀;同一页面有多个渲染器时请使用不同前缀。 |
435
+ | `syncHash` | `boolean` | `false` | 标题激活时同步更新 URL hash。 |
436
+ | `toc` | `boolean` | `false` | 渲染目录区域。 |
437
+ | `tocDepth` | `number` | `0` | 目录包含的最大标题层级;`0` 表示全部层级。 |
438
+ | `tocPlacement` | `'top' \| 'left' \| 'right' \| 'hidden'` | `'top'` | 目录置顶、放在内容左侧/右侧,或隐藏。 |
439
+ | `search` | `string` | `''` | 高亮匹配项并触发 `search-change`。 |
440
+ | `searchCaseSensitive` | `boolean` | `false` | 让 `search` 区分大小写。 |
441
+ | `searchDebounce` | `number` | `0` | 新查询解析前的等待毫秒数。 |
442
+ | `showError` | `boolean` | `true` | 失败时渲染错误区域。 |
443
+ | `tokens` | `Record<string, string>` | `{}` | 写在根元素上的内联 `--vmd-*` 自定义属性。 |
444
+ | `theme` | `'light' \| 'dark' \| 'auto' \| 'custom'` | `'light'` | 设置根元素的 `data-vmd-theme`。 |
445
+ | `as` | `string \| Component` | `'div'` | 根元素或根组件。 |
446
+
447
+ ### 事件
448
+
449
+ | 事件 | 负载 |
450
+ | --- | --- |
451
+ | `update:source` | `source: string` |
452
+ | `toc-change` | `toc: TocItem[]` |
453
+ | `link-click` | `{ url, target, node, event }` |
454
+ | `custom-tag-click` | `{ tag, props, node, event }` |
455
+ | `task-change` | `{ checked, node }` |
456
+ | `search-change` | `{ query, caseSensitive, matches }` |
457
+ | `math-error` | `MarkdownDiagnostic` |
458
+ | `render-error` | `MarkdownDiagnostic` |
459
+ | `ready` | `MarkdownDocument` |
460
+
461
+ `toc-change` 带有签名判断:只有序列化后的目录真正变化时才会触发。`search-change`
462
+ 跟随 `search` 属性并报告当前匹配数,只有对应查询的文档真正渲染完成后才会触发。`ready`
463
+ 在第一次成功生成文档时触发一次。
464
+
465
+ ### 插槽
466
+
467
+ `default` 插槽接收原始 Markdown 文本。具名区域插槽会完全替换默认区域,并接收作用域
468
+ 上下文:`root`、`toc`、`toc-item`、`content`、`error`、`empty` 和 `loading`。插槽
469
+ 不存在或内容为空时,保留默认渲染。代码、数学、Mermaid 和编辑器组件还各自提供专属
470
+ 插槽,见[渲染器参考](./docs/zh/reference/renderer.md#插槽)。
471
+
472
+ ### 入口
473
+
474
+ | 入口 | 内容 |
475
+ | --- | --- |
476
+ | `@coderminer/vue-markdown` | 渲染器、预设组件、组合式函数、内核辅助函数 |
477
+ | `@coderminer/vue-markdown/headless` | 类型、模型辅助函数、组合式函数;不含预设组件和 CSS |
478
+ | `@coderminer/vue-markdown/pipeline` | 官方管线、自定义管线校验、身份工具 |
479
+ | `@coderminer/vue-markdown/plugins` | `defineMarkdownPlugin`、注册表、内置插件 |
480
+ | `@coderminer/vue-markdown/presets` | `defineMarkdownPreset`、`composePresets`、配置类型 |
481
+ | `@coderminer/vue-markdown/highlight` | highlight.js 适配器和归一化辅助函数 |
482
+ | `@coderminer/vue-markdown/highlight/shiki` | 可选的 Shiki 适配器 |
483
+ | `@coderminer/vue-markdown/math` | `mathPlugin`、`katexEngine`、数学类型 |
484
+ | `@coderminer/vue-markdown/mermaid` | 按需加载的 Mermaid 运行时和 SVG 净化器 |
485
+ | `@coderminer/vue-markdown/editor` | 按需加载的 CodeMirror 集成 |
486
+ | `@coderminer/vue-markdown/html` | `htmlPlugin()` 和净化后的原始 HTML |
487
+ | `@coderminer/vue-markdown/node-components` | 仅节点组件目录 |
488
+ | `@coderminer/vue-markdown/components/*` | 每个公共组件一个入口 |
489
+ | `@coderminer/vue-markdown/style.css` | 完整样式表 |
490
+ | `@coderminer/vue-markdown/styles/tokens.css` | 仅设计令牌 |
491
+ | `@coderminer/vue-markdown/styles/components.css` | 基于部件的组件样式 |
492
+ | `@coderminer/vue-markdown/styles/math.css` | 数学容器样式;需另行引入 KaTeX CSS |
493
+ | `@coderminer/vue-markdown/styles/math-full.css` | KaTeX CSS 加数学容器样式 |
494
+
495
+ ## 安全默认值
496
+
497
+ - 原始 HTML 默认被丢弃。从 `@coderminer/vue-markdown/html` 加入 `htmlPlugin()` 才会启用,
498
+ 净化器会在原始 HTML 解析后立即运行。
499
+ - URL 协议仅允许 `http`、`https`、`irc`、`ircs`、`mailto`、`xmpp` 以及相对 URL。
500
+ - 图片 `data:` URL 只允许光栅格式;`data:image/svg+xml` 会被拒绝。
501
+ - 原始 HTML 和自定义标签上的事件处理器属性与 `style` 会被移除。
502
+ - 渲染路径不使用 `v-html`、`eval` 或内联脚本。
503
+ - Mermaid 以严格安全模式渲染,SVG 在变成节点之前会被净化。
504
+
505
+ 完整策略见[安全](./docs/zh/guide/security.md)。
506
+
507
+ ## 文档
508
+
509
+ | 指南 | 内容 |
510
+ | --- | --- |
511
+ | [快速开始](./docs/zh/guide/getting-started.md) | 安装、首个文档、整体结构 |
512
+ | [基础用法](./docs/zh/guide/basic-usage.md) | 输入、样式、事件、插槽、实例方法 |
513
+ | [进阶用法](./docs/zh/guide/advanced-usage.md) | 插件、预设、引擎、无头、导出 |
514
+ | [定制](./docs/zh/guide/customization.md) | 优先级、区域、节点组件、插槽、清单 |
515
+ | [富组件](./docs/zh/guide/rich-components.md) | `CodeBlock`、`VueSyntaxHighlighter`、`MermaidBlock`、`MermaidLiveEditor` |
516
+ | [样式与主题](./docs/zh/guide/styling.md) | 令牌、主题、部件、无样式模式 |
517
+ | [插件](./docs/zh/guide/plugins.md) | 插件契约、排序、生命周期、remark/rehype |
518
+ | [无头渲染](./docs/zh/guide/headless.md) | `useMarkdownDocument`、模型和辅助 API |
519
+ | [官方管线](./docs/zh/guide/pipeline.md) | 官方 unified 管线和阶段顺序 |
520
+ | [自定义管线](./docs/zh/guide/custom-pipeline.md) | 编写和校验替代管线 |
521
+ | [CommonMark 与 GFM](./docs/zh/guide/commonmark-gfm.md) | 语法覆盖与一致性测试 |
522
+ | [安全](./docs/zh/guide/security.md) | 净化、URL 策略、CSP、自定义标签 |
523
+ | [语法高亮](./docs/zh/guide/highlighting.md) | 适配器、Shiki、缓存、服务端渲染 |
524
+ | [数学公式](./docs/zh/guide/math.md) | `mathPlugin`、分隔符、引擎、回退 |
525
+ | [Mermaid](./docs/zh/guide/mermaid.md) | 按需运行时、净化器、块状态、编辑器 |
526
+ | [SSR 与静态导出](./docs/zh/guide/ssr.md) | 服务端渲染和静态 HTML 辅助函数 |
527
+ | [可访问性审计](./docs/zh/guide/audits.md) | 可访问性、减少动画、RTL、资源清理 |
528
+ | [定制手册](./docs/zh/guide/cookbook.md) | 常见任务的复制粘贴配方 |
529
+
530
+ ## 开发
531
+
532
+ ```bash
533
+ npm install
534
+ npm run docs:dev # 文档站(VitePress)
535
+ npm run docs:build # 构建静态文档站
536
+ npm run dev # 交互式示例
537
+ npm run build:lib # 库、类型声明、样式
538
+ npm test # node + happy-dom 两个测试项目
539
+ npm run typecheck
540
+ npm run lint
541
+ npm run size # 入口体积守卫
542
+ npm run bench # 解析/渲染预算检查
543
+ ```
544
+
545
+ 文档站由 `.github/workflows/pages.yml` 部署到 GitHub Pages。仓库中的 `AGENTS.md`
546
+ 记录了分层架构,以及保持内核无 DOM、依赖单向流动的规则。
547
+
548
+ ## 许可证
549
+
550
+ [MIT](LICENSE) © CoderMiner
@@ -0,0 +1,16 @@
1
+ import { createElementBlock as e, defineComponent as t, openBlock as n, renderSlot as r } from "vue";
2
+ // src/components/MarkdownBlockquote.vue?vue&type=script&setup=true&lang.ts
3
+ var i = {
4
+ "data-vmd-part": "blockquote",
5
+ class: "vmd-blockquote"
6
+ }, a = /* @__PURE__ */ t({
7
+ __name: "MarkdownBlockquote",
8
+ props: {
9
+ node: {},
10
+ children: {}
11
+ },
12
+ setup(t) {
13
+ return (t, a) => (n(), e("blockquote", i, [r(t.$slots, "default")]));
14
+ }
15
+ });
16
+ export { a as t };
@@ -0,0 +1,16 @@
1
+ import { createElementBlock as e, defineComponent as t, openBlock as n } from "vue";
2
+ // src/components/MarkdownBreak.vue?vue&type=script&setup=true&lang.ts
3
+ var r = {
4
+ "data-vmd-part": "break",
5
+ class: "vmd-break"
6
+ }, i = /* @__PURE__ */ t({
7
+ __name: "MarkdownBreak",
8
+ props: {
9
+ node: {},
10
+ children: {}
11
+ },
12
+ setup(t) {
13
+ return (t, i) => (n(), e("br", r));
14
+ }
15
+ });
16
+ export { i as t };
@@ -0,0 +1,63 @@
1
+ import { r as e } from "./config-aRYo2R8_.js";
2
+ import { r as t } from "./context-8NfW6fxI.js";
3
+ import { computed as n, createBlock as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, inject as c, normalizeClass as l, openBlock as u, provide as d, renderSlot as f, resolveDynamicComponent as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
4
+ // src/components/codeRegion.ts
5
+ var _ = Symbol("@coderminer/vue-markdown:code-region-depth");
6
+ function v(r = {}) {
7
+ let i = t(), a = e(), o = c(_, 0);
8
+ return d(_, o + 1), n(() => {
9
+ var e, t, n, s, c;
10
+ if (!(o > 0) && !((e = r.standalone) != null && e.call(r) || (t = r.ignoreRegion) != null && t.call(r))) return (n = (s = i.regions) == null ? void 0 : s.codeBlock) == null ? (c = a.value.regions) == null ? void 0 : c.codeBlock : n;
11
+ });
12
+ }
13
+ // src/components/MarkdownCode.vue?vue&type=script&setup=true&lang.ts
14
+ var y = {
15
+ key: 1,
16
+ "data-vmd-part": "code",
17
+ class: "vmd-code"
18
+ }, b = /* @__PURE__ */ s({
19
+ __name: "MarkdownCode",
20
+ props: {
21
+ node: { default: void 0 },
22
+ code: { default: void 0 },
23
+ language: { default: void 0 },
24
+ standalone: {
25
+ type: Boolean,
26
+ default: !1
27
+ },
28
+ ignoreRegion: {
29
+ type: Boolean,
30
+ default: !1
31
+ }
32
+ },
33
+ setup(e) {
34
+ let t = e, s = v({
35
+ standalone: () => t.standalone,
36
+ ignoreRegion: () => t.ignoreRegion
37
+ }), c = n(() => {
38
+ var e, n;
39
+ return t.code === void 0 ? (e = (n = t.node) == null ? void 0 : n.code) == null ? "" : e : t.code;
40
+ }), d = n(() => {
41
+ var e, n;
42
+ return t.language === void 0 ? (e = (n = t.node) == null ? void 0 : n.language) == null ? "" : e : t.language;
43
+ });
44
+ return (t, n) => h(s) ? (u(), r(p(h(s)), {
45
+ key: 0,
46
+ node: e.node,
47
+ code: c.value,
48
+ language: d.value
49
+ }, {
50
+ default: g(() => [f(t.$slots, "default")]),
51
+ _: 3
52
+ }, 8, [
53
+ "node",
54
+ "code",
55
+ "language"
56
+ ])) : (u(), i("pre", y, [f(t.$slots, "default", {}, () => [
57
+ n[0] || (n[0] = o("\n ", -1)),
58
+ a("code", { class: l(["vmd-code-element", d.value ? `language-${d.value}` : void 0]) }, m(c.value), 3),
59
+ n[1] || (n[1] = o("\n ", -1))
60
+ ])]));
61
+ }
62
+ });
63
+ export { v as n, b as t };