mio-previewer 0.2.7 → 0.2.72

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 (117) hide show
  1. package/README.md +122 -157
  2. package/README.zh-CN.md +85 -110
  3. package/dist/{_basePickBy-Cvu7Iu4t.js → _basePickBy-Be3yyf2d.js} +2 -2
  4. package/dist/{_basePickBy-knwkNz9F.cjs → _basePickBy-Z0DtrAKQ.cjs} +1 -1
  5. package/dist/{_baseUniq-CoKmXiIw.js → _baseUniq-BXkA0Pgx.js} +1 -1
  6. package/dist/{_baseUniq-BKEAlJrZ.cjs → _baseUniq-Dq2eV1vY.cjs} +1 -1
  7. package/dist/{arc-BfjXrLnR.cjs → arc-B-QGG8RZ.cjs} +1 -1
  8. package/dist/{arc-BsRKvhqb.js → arc-djW14lrn.js} +1 -1
  9. package/dist/{architecture-O4VJ6CD3-DKKcPWid.cjs → architecture-O4VJ6CD3-Cws_zM2K.cjs} +1 -1
  10. package/dist/{architecture-O4VJ6CD3-DlitxIel.js → architecture-O4VJ6CD3-pdMXTCaT.js} +1 -1
  11. package/dist/{architectureDiagram-VXUJARFQ-8GIkEy9U.js → architectureDiagram-VXUJARFQ-BwchhvqL.js} +3 -3
  12. package/dist/{architectureDiagram-VXUJARFQ-DwTvTWFB.cjs → architectureDiagram-VXUJARFQ-DxDLWGpO.cjs} +1 -1
  13. package/dist/{blockDiagram-VD42YOAC-tZpHwF_P.cjs → blockDiagram-VD42YOAC-B4Xc8gfX.cjs} +1 -1
  14. package/dist/{blockDiagram-VD42YOAC-DtIfTXmw.js → blockDiagram-VD42YOAC-DpPneP6J.js} +5 -5
  15. package/dist/{c4Diagram-YG6GDRKO-Cz3j8MTC.cjs → c4Diagram-YG6GDRKO-695lQbrZ.cjs} +1 -1
  16. package/dist/{c4Diagram-YG6GDRKO-DZf99xT5.js → c4Diagram-YG6GDRKO-Cnlax2Xq.js} +2 -2
  17. package/dist/channel-D_ITz6Jy.cjs +1 -0
  18. package/dist/{channel-DZBn438o.js → channel-sXy9EduO.js} +1 -1
  19. package/dist/{chunk-4BX2VUAB-_eF8ggdb.cjs → chunk-4BX2VUAB-Bdx3_f83.cjs} +1 -1
  20. package/dist/{chunk-4BX2VUAB-Dvc-GoPz.js → chunk-4BX2VUAB-DRkGmgAZ.js} +1 -1
  21. package/dist/{chunk-55IACEB6-DmO5L9Gv.cjs → chunk-55IACEB6-BB03hpRC.cjs} +1 -1
  22. package/dist/{chunk-55IACEB6-6yjykpr1.js → chunk-55IACEB6-Ord5OQlh.js} +1 -1
  23. package/dist/{chunk-B4BG7PRW-BYhHW-T1.cjs → chunk-B4BG7PRW-Ca0fOgzA.cjs} +1 -1
  24. package/dist/{chunk-B4BG7PRW-Ct08Bj-m.js → chunk-B4BG7PRW-D-cs8bDX.js} +4 -4
  25. package/dist/{chunk-DI55MBZ5-CGUTXZFz.cjs → chunk-DI55MBZ5-BsRe2B2M.cjs} +1 -1
  26. package/dist/{chunk-DI55MBZ5-C3g3BX3L.js → chunk-DI55MBZ5-DSmlLD1s.js} +3 -3
  27. package/dist/{chunk-FMBD7UC4-u8JkSV8g.cjs → chunk-FMBD7UC4-DxkUZTpt.cjs} +1 -1
  28. package/dist/{chunk-FMBD7UC4-B9snbeN7.js → chunk-FMBD7UC4-IYQmAMTo.js} +1 -1
  29. package/dist/{chunk-QN33PNHL-U6fNQFd3.cjs → chunk-QN33PNHL-B7G6Qlf3.cjs} +1 -1
  30. package/dist/{chunk-QN33PNHL-CFMCEb4D.js → chunk-QN33PNHL-EYMc4JVr.js} +1 -1
  31. package/dist/{chunk-QZHKN3VN-CL8OjJgP.cjs → chunk-QZHKN3VN-B8NJ6Ahx.cjs} +1 -1
  32. package/dist/{chunk-QZHKN3VN-DAAMblgK.js → chunk-QZHKN3VN-C4WIG5z8.js} +1 -1
  33. package/dist/{chunk-TZMSLE5B-DEcy899f.js → chunk-TZMSLE5B-BoM53RHv.js} +1 -1
  34. package/dist/{chunk-TZMSLE5B-DjIJI2Y-.cjs → chunk-TZMSLE5B-CgLDb48A.cjs} +1 -1
  35. package/dist/{classDiagram-v2-WZHVMYZB-CpNYkLpu.js → classDiagram-2ON5EDUG-CxmdZvqc.js} +2 -2
  36. package/dist/{classDiagram-2ON5EDUG-BOhHIGzd.cjs → classDiagram-2ON5EDUG-DIRim8qa.cjs} +1 -1
  37. package/dist/{classDiagram-2ON5EDUG-CpNYkLpu.js → classDiagram-v2-WZHVMYZB-CxmdZvqc.js} +2 -2
  38. package/dist/{classDiagram-v2-WZHVMYZB-BOhHIGzd.cjs → classDiagram-v2-WZHVMYZB-DIRim8qa.cjs} +1 -1
  39. package/dist/{clone-0YTYNqyj.js → clone-DOYxaT_d.js} +1 -1
  40. package/dist/clone-DSlm33NG.cjs +1 -0
  41. package/dist/{cose-bilkent-S5V4N54A-CXsWxbYE.cjs → cose-bilkent-S5V4N54A-BD3p1OC_.cjs} +1 -1
  42. package/dist/{cose-bilkent-S5V4N54A-CBkmKAir.js → cose-bilkent-S5V4N54A-yLoaqH3G.js} +1 -1
  43. package/dist/{dagre-6UL2VRFP-BMc1dXqz.cjs → dagre-6UL2VRFP-DG1oQ4B2.cjs} +1 -1
  44. package/dist/{dagre-6UL2VRFP-Drl27WRd.js → dagre-6UL2VRFP-VjboDBbp.js} +6 -6
  45. package/dist/{diagram-PSM6KHXK-hk7S3HaO.js → diagram-PSM6KHXK-C1p0l5TY.js} +4 -4
  46. package/dist/{diagram-PSM6KHXK-Czzv2tRq.cjs → diagram-PSM6KHXK-a4rni6rJ.cjs} +1 -1
  47. package/dist/{diagram-QEK2KX5R-X7uU2_mf.cjs → diagram-QEK2KX5R-CErKOsX1.cjs} +1 -1
  48. package/dist/{diagram-QEK2KX5R-CFisa_mz.js → diagram-QEK2KX5R-CKmmuumX.js} +3 -3
  49. package/dist/{diagram-S2PKOQOG-CahM5LoL.cjs → diagram-S2PKOQOG-B1M7qCNl.cjs} +1 -1
  50. package/dist/{diagram-S2PKOQOG-Dj25VCdV.js → diagram-S2PKOQOG-BMLCJExF.js} +3 -3
  51. package/dist/{erDiagram-Q2GNP2WA-BcN7es5w.cjs → erDiagram-Q2GNP2WA-BfuCa_Za.cjs} +1 -1
  52. package/dist/{erDiagram-Q2GNP2WA-BAJYThgQ.js → erDiagram-Q2GNP2WA-fOTsQA-d.js} +4 -4
  53. package/dist/{flowDiagram-NV44I4VS-DSH4zSz8.cjs → flowDiagram-NV44I4VS-BEqeUuqz.cjs} +1 -1
  54. package/dist/{flowDiagram-NV44I4VS-sDLidiZI.js → flowDiagram-NV44I4VS-DDwRAjVG.js} +5 -5
  55. package/dist/{ganttDiagram-LVOFAZNH-BOqH3ODt.js → ganttDiagram-LVOFAZNH-BbuRS8g3.js} +2 -2
  56. package/dist/{ganttDiagram-LVOFAZNH-DB-rPLnm.cjs → ganttDiagram-LVOFAZNH-BlVeWKRf.cjs} +1 -1
  57. package/dist/{gitGraph-ZV4HHKMB-gB1ESpsj.cjs → gitGraph-ZV4HHKMB-Bmu8r_Iq.cjs} +1 -1
  58. package/dist/{gitGraph-ZV4HHKMB-CztmV0rG.js → gitGraph-ZV4HHKMB-DcQ2E4dF.js} +1 -1
  59. package/dist/{gitGraphDiagram-NY62KEGX-BBZujICZ.cjs → gitGraphDiagram-NY62KEGX-DcMEeNh7.cjs} +1 -1
  60. package/dist/{gitGraphDiagram-NY62KEGX-BAQ8jnrA.js → gitGraphDiagram-NY62KEGX-_sWVSKbL.js} +4 -4
  61. package/dist/{graph-OxVrrvxE.js → graph-DEnt0OtZ.js} +2 -2
  62. package/dist/{graph-CQASZLoy.cjs → graph-Dgcjs2XL.cjs} +1 -1
  63. package/dist/info-63CPKGFF-DVDDcoHy.js +5 -0
  64. package/dist/{info-63CPKGFF-BKVcTirE.cjs → info-63CPKGFF-Dc3cWL0G.cjs} +1 -1
  65. package/dist/{infoDiagram-F6ZHWCRC-BoNJWkl-.js → infoDiagram-F6ZHWCRC-DoUSS0kC.js} +2 -2
  66. package/dist/{infoDiagram-F6ZHWCRC-CCl9mvNx.cjs → infoDiagram-F6ZHWCRC-ZeTrjgaE.cjs} +1 -1
  67. package/dist/{journeyDiagram-XKPGCS4Q-Jte0d65j.js → journeyDiagram-XKPGCS4Q-DGe13iBu.js} +4 -4
  68. package/dist/{journeyDiagram-XKPGCS4Q-Kbhog3Rq.cjs → journeyDiagram-XKPGCS4Q-Ihl9g4mY.cjs} +1 -1
  69. package/dist/{kanban-definition-3W4ZIXB7-j6dPKa6V.cjs → kanban-definition-3W4ZIXB7-2qkrkVLK.cjs} +1 -1
  70. package/dist/{kanban-definition-3W4ZIXB7-WRSFo9Dq.js → kanban-definition-3W4ZIXB7-BhWe5nMU.js} +2 -2
  71. package/dist/{layout-CUCO1yPf.cjs → layout-BDNzBIaA.cjs} +1 -1
  72. package/dist/{layout-DvLWn8fk.js → layout-DTBfbHzy.js} +4 -4
  73. package/dist/{linear-BUfiCrOq.cjs → linear-BRl2UYUr.cjs} +1 -1
  74. package/dist/{linear-BxS2YLGD.js → linear-CwbXkgvF.js} +1 -1
  75. package/dist/{mermaid-parser.core-1I1w3Zgm.js → mermaid-parser.core-CJ1yJm0s.js} +11 -11
  76. package/dist/{mermaid-parser.core-4NX9G4IH.cjs → mermaid-parser.core-CxTcWSA2.cjs} +2 -2
  77. package/dist/{mindmap-definition-VGOIOE7T-C8xxgKhK.cjs → mindmap-definition-VGOIOE7T-BPUEmP7g.cjs} +1 -1
  78. package/dist/{mindmap-definition-VGOIOE7T-DgzaZCK3.js → mindmap-definition-VGOIOE7T-DSqZBgzR.js} +3 -3
  79. package/dist/mio-previewer.cjs.js +1 -1
  80. package/dist/mio-previewer.css +1 -1
  81. package/dist/mio-previewer.es.js +1 -1
  82. package/dist/{packet-HUATNLJX-CfnSJe9e.cjs → packet-HUATNLJX-B-qfkr5X.cjs} +1 -1
  83. package/dist/{packet-HUATNLJX-oxj0w6Sn.js → packet-HUATNLJX-Dxob_meO.js} +1 -1
  84. package/dist/pie-WTHONI2E-BRtdTGWt.js +5 -0
  85. package/dist/{pie-WTHONI2E-Ke2d-cd5.cjs → pie-WTHONI2E-DK7f6qJw.cjs} +1 -1
  86. package/dist/{pieDiagram-ADFJNKIX-CjKZybqs.js → pieDiagram-ADFJNKIX-Dhq_bEzm.js} +4 -4
  87. package/dist/{pieDiagram-ADFJNKIX-BXLT29rs.cjs → pieDiagram-ADFJNKIX-V04ms3gr.cjs} +1 -1
  88. package/dist/plugins/custom.cjs.js +1 -1
  89. package/dist/plugins/custom.es.js +35 -34
  90. package/dist/{quadrantDiagram-AYHSOK5B-gQcJ1QWD.js → quadrantDiagram-AYHSOK5B-C97bOmUE.js} +2 -2
  91. package/dist/{quadrantDiagram-AYHSOK5B-Bofh6KQl.cjs → quadrantDiagram-AYHSOK5B-DlqFPVhi.cjs} +1 -1
  92. package/dist/{radar-NJJJXTRR-EmqSi7YJ.cjs → radar-NJJJXTRR-B9jT3LP3.cjs} +1 -1
  93. package/dist/radar-NJJJXTRR-D8plmle3.js +5 -0
  94. package/dist/{requirementDiagram-UZGBJVZJ-CpDnEwpX.js → requirementDiagram-UZGBJVZJ-BxVMLKfQ.js} +3 -3
  95. package/dist/{requirementDiagram-UZGBJVZJ-CiEGzFpl.cjs → requirementDiagram-UZGBJVZJ-DENJ74Ew.cjs} +1 -1
  96. package/dist/{sankeyDiagram-TZEHDZUN-BS9xQbTO.js → sankeyDiagram-TZEHDZUN-DwgW7Suq.js} +1 -1
  97. package/dist/{sankeyDiagram-TZEHDZUN-C78i3iVS.cjs → sankeyDiagram-TZEHDZUN-lTBLhaSq.cjs} +1 -1
  98. package/dist/{sequenceDiagram-WL72ISMW-C7lWiaCu.js → sequenceDiagram-WL72ISMW-BAOeX1dA.js} +3 -3
  99. package/dist/{sequenceDiagram-WL72ISMW-gVgKh8qv.cjs → sequenceDiagram-WL72ISMW-BRVvH1X4.cjs} +1 -1
  100. package/dist/{stateDiagram-FKZM4ZOC-U0f1-N-V.js → stateDiagram-FKZM4ZOC-BrFQE7Gl.js} +4 -4
  101. package/dist/{stateDiagram-FKZM4ZOC-DffdRxr_.cjs → stateDiagram-FKZM4ZOC-D8GjooGL.cjs} +1 -1
  102. package/dist/{stateDiagram-v2-4FDKWEC3-1xCdWqps.cjs → stateDiagram-v2-4FDKWEC3-4VRIY-eH.cjs} +1 -1
  103. package/dist/{stateDiagram-v2-4FDKWEC3-CZdj0Qdf.js → stateDiagram-v2-4FDKWEC3-DnrWD6a3.js} +2 -2
  104. package/dist/{timeline-definition-IT6M3QCI-BvOTgc1D.js → timeline-definition-IT6M3QCI-BJMIlueb.js} +2 -2
  105. package/dist/{timeline-definition-IT6M3QCI-jtIb5KKf.cjs → timeline-definition-IT6M3QCI-BQFGUuGP.cjs} +1 -1
  106. package/dist/{treemap-75Q7IDZK-Ct1uQXSD.cjs → treemap-75Q7IDZK-BX1vBFWf.cjs} +1 -1
  107. package/dist/{treemap-75Q7IDZK-CnpUZ5Rr.js → treemap-75Q7IDZK-CMTkunTV.js} +1 -1
  108. package/dist/{viewer-dmRgjht5.js → viewer-CZUSHxhf.js} +32 -31
  109. package/dist/{viewer-D_fHatZf.cjs → viewer-Canph5Zx.cjs} +4 -4
  110. package/dist/{xychartDiagram-PRI3JC2R-CNg-5JJ5.cjs → xychartDiagram-PRI3JC2R-Sl8WX8wc.cjs} +1 -1
  111. package/dist/{xychartDiagram-PRI3JC2R-D43m_ZWr.js → xychartDiagram-PRI3JC2R-WnFI7Ezu.js} +2 -2
  112. package/package.json +1 -1
  113. package/dist/channel-Bbqi9ugt.cjs +0 -1
  114. package/dist/clone-BWf1bMJ2.cjs +0 -1
  115. package/dist/info-63CPKGFF-DlFBOu7s.js +0 -5
  116. package/dist/pie-WTHONI2E-ChPJLMIJ.js +0 -5
  117. package/dist/radar-NJJJXTRR-W7CAyBug.js +0 -5
package/README.md CHANGED
@@ -1,17 +1,13 @@
1
1
  # mio-previewer
2
2
 
3
- [中文文档](./README.zh-CN.md) | English
3
+ A Vue 3 markdown rendering engine engineered for **AI streaming responses**. It transforms standard Markdown output into reactive Vue VNodes, enabling smooth, incremental DOM updates without the performance penalties of `v-html`.
4
4
 
5
- A Vue 3 markdown renderer optimized for streaming updates with powerful plugin system. Features real-time rendering, syntax highlighting, math formulas, diagrams, and more.
5
+ **Core Value Proposition:**
6
6
 
7
- **Key Features:**
8
- - 🚀 Streaming-friendly real-time rendering
9
- - 🎨 Built-in syntax highlighting (Prism.js, 20+ languages)
10
- - 📐 Math formulas support (KaTeX)
11
- - 📊 Diagram rendering (Mermaid)
12
- - 🔌 Extensible plugin system
13
- - 📦 Tree-shakeable & lightweight
14
- - 🎯 TypeScript support
7
+ - ⚡️ **VNode-Based Incremental Rendering**: Bypasses the "destroy & recreate" cycle of `v-html`. By converting AST to VNodes, we leverage Vue's diffing algorithm to update only the changed text nodes during streaming.
8
+ - 🧩 **Component-Level Interception**: Intercepts Markdown tokens (like code blocks or math) and renders them as fully interactive Vue components, not just static HTML.
9
+ - 🌊 **Stream-Optimized**: Features like smart cursor tracking and anti-jitter logic ensure a buttery-smooth reading experience while the AI is "typing".
10
+ - 🛡 **Security First**: AST-based transformation naturally prevents XSS attacks compared to raw HTML injection.
15
11
 
16
12
  ## Installation
17
13
 
@@ -33,11 +29,11 @@ yarn add mio-previewer
33
29
  </template>
34
30
 
35
31
  <script setup>
36
- import { ref } from 'vue'
37
- import { MdRenderer } from 'mio-previewer'
38
- import 'mio-previewer/dist/mio-previewer.css'
32
+ import { ref } from "vue";
33
+ import { MdRenderer } from "mio-previewer";
34
+ import "mio-previewer/dist/mio-previewer.css";
39
35
 
40
- const markdown = ref('# Hello World\n\nThis is **markdown**!')
36
+ const markdown = ref("# Hello World\n\nThis is **markdown**!");
41
37
  </script>
42
38
  ```
43
39
 
@@ -47,32 +43,29 @@ Perfect for AI chatbots or real-time content:
47
43
 
48
44
  ```vue
49
45
  <template>
50
- <MdRenderer
51
- :md="streamContent"
52
- :isStreaming="isStreaming"
53
- />
46
+ <MdRenderer :md="streamContent" :isStreaming="isStreaming" />
54
47
  </template>
55
48
 
56
49
  <script setup>
57
- import { ref } from 'vue'
58
- import { MdRenderer } from 'mio-previewer'
59
- import 'mio-previewer/dist/mio-previewer.css'
50
+ import { ref } from "vue";
51
+ import { MdRenderer } from "mio-previewer";
52
+ import "mio-previewer/dist/mio-previewer.css";
60
53
 
61
- const streamContent = ref('')
62
- const isStreaming = ref(true)
54
+ const streamContent = ref("");
55
+ const isStreaming = ref(true);
63
56
 
64
57
  // Simulate streaming
65
- const text = '# Streaming Demo\n\nContent appears **gradually**...'
66
- let index = 0
58
+ const text = "# Streaming Demo\n\nContent appears **gradually**...";
59
+ let index = 0;
67
60
 
68
61
  const interval = setInterval(() => {
69
62
  if (index < text.length) {
70
- streamContent.value += text[index++]
63
+ streamContent.value += text[index++];
71
64
  } else {
72
- isStreaming.value = false
73
- clearInterval(interval)
65
+ isStreaming.value = false;
66
+ clearInterval(interval);
74
67
  }
75
- }, 50)
68
+ }, 50);
76
69
  </script>
77
70
  ```
78
71
 
@@ -84,9 +77,9 @@ const interval = setInterval(() => {
84
77
 
85
78
  ```vue
86
79
  <script setup>
87
- import { MdRenderer } from 'mio-previewer'
88
- import { katexPlugin } from 'mio-previewer/plugins/markdown-it'
89
- import 'mio-previewer/dist/mio-previewer.css'
80
+ import { MdRenderer } from "mio-previewer";
81
+ import { katexPlugin } from "mio-previewer/plugins/markdown-it";
82
+ import "mio-previewer/dist/mio-previewer.css";
90
83
 
91
84
  const markdown = `
92
85
  # Math Example
@@ -97,18 +90,13 @@ Block:
97
90
  $$
98
91
  \\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
99
92
  $$
100
- `
93
+ `;
101
94
 
102
- const markdownItPlugins = [
103
- { plugin: katexPlugin }
104
- ]
95
+ const markdownItPlugins = [{ plugin: katexPlugin }];
105
96
  </script>
106
97
 
107
98
  <template>
108
- <MdRenderer
109
- :md="markdown"
110
- :markdownItPlugins="markdownItPlugins"
111
- />
99
+ <MdRenderer :md="markdown" :markdownItPlugins="markdownItPlugins" />
112
100
  </template>
113
101
  ```
114
102
 
@@ -116,9 +104,9 @@ const markdownItPlugins = [
116
104
 
117
105
  ```vue
118
106
  <script setup>
119
- import { MdRenderer } from 'mio-previewer'
120
- import { AlertPlugin } from 'mio-previewer/plugins/markdown-it'
121
- import 'mio-previewer/dist/mio-previewer.css'
107
+ import { MdRenderer } from "mio-previewer";
108
+ import { AlertPlugin } from "mio-previewer/plugins/markdown-it";
109
+ import "mio-previewer/dist/mio-previewer.css";
122
110
 
123
111
  const markdown = `
124
112
  ::: info
@@ -136,18 +124,13 @@ This is an **info** alert with markdown support!
136
124
  ::: success
137
125
  ✅ Success message
138
126
  :::
139
- `
127
+ `;
140
128
 
141
- const markdownItPlugins = [
142
- { plugin: AlertPlugin }
143
- ]
129
+ const markdownItPlugins = [{ plugin: AlertPlugin }];
144
130
  </script>
145
131
 
146
132
  <template>
147
- <MdRenderer
148
- :md="markdown"
149
- :markdownItPlugins="markdownItPlugins"
150
- />
133
+ <MdRenderer :md="markdown" :markdownItPlugins="markdownItPlugins" />
151
134
  </template>
152
135
  ```
153
136
 
@@ -155,9 +138,9 @@ const markdownItPlugins = [
155
138
 
156
139
  ```vue
157
140
  <script setup>
158
- import { MdRenderer } from 'mio-previewer'
159
- import { CodeBlockPlugin } from 'mio-previewer/plugins/custom'
160
- import 'mio-previewer/dist/mio-previewer.css'
141
+ import { MdRenderer } from "mio-previewer";
142
+ import { CodeBlockPlugin } from "mio-previewer/plugins/custom";
143
+ import "mio-previewer/dist/mio-previewer.css";
161
144
 
162
145
  const markdown = `
163
146
  \`\`\`javascript
@@ -170,16 +153,13 @@ function hello() {
170
153
  def greet():
171
154
  print("Hello from Python!")
172
155
  \`\`\`
173
- `
156
+ `;
174
157
 
175
- const customPlugins = [CodeBlockPlugin]
158
+ const customPlugins = [CodeBlockPlugin];
176
159
  </script>
177
160
 
178
161
  <template>
179
- <MdRenderer
180
- :md="markdown"
181
- :customPlugins="customPlugins"
182
- />
162
+ <MdRenderer :md="markdown" :customPlugins="customPlugins" />
183
163
  </template>
184
164
  ```
185
165
 
@@ -187,9 +167,9 @@ const customPlugins = [CodeBlockPlugin]
187
167
 
188
168
  ```vue
189
169
  <script setup>
190
- import { MdRenderer } from 'mio-previewer'
191
- import { mermaidPlugin } from 'mio-previewer/plugins/custom'
192
- import 'mio-previewer/dist/mio-previewer.css'
170
+ import { MdRenderer } from "mio-previewer";
171
+ import { mermaidPlugin } from "mio-previewer/plugins/custom";
172
+ import "mio-previewer/dist/mio-previewer.css";
193
173
 
194
174
  const markdown = `
195
175
  \`\`\`mermaid
@@ -198,16 +178,13 @@ graph TD
198
178
  B -->|Yes| C[Continue]
199
179
  B -->|No| D[Stop]
200
180
  \`\`\`
201
- `
181
+ `;
202
182
 
203
- const customPlugins = [mermaidPlugin]
183
+ const customPlugins = [mermaidPlugin];
204
184
  </script>
205
185
 
206
186
  <template>
207
- <MdRenderer
208
- :md="markdown"
209
- :customPlugins="customPlugins"
210
- />
187
+ <MdRenderer :md="markdown" :customPlugins="customPlugins" />
211
188
  </template>
212
189
  ```
213
190
 
@@ -224,32 +201,28 @@ For other plugin styles (KaTeX, Mermaid, Prism), we intentionally do NOT auto-lo
224
201
 
225
202
  ```js
226
203
  // example (app's main.js)
227
- import 'katex/dist/katex.min.css' // if you use the KaTeX plugin
228
- import 'mermaid/dist/mermaid.min.css' // if you use the Mermaid plugin
229
- import 'prismjs/themes/prism.css' // if you use the CodeBlock/Prism plugin
204
+ import "katex/dist/katex.min.css"; // if you use the KaTeX plugin
205
+ import "mermaid/dist/mermaid.min.css"; // if you use the Mermaid plugin
206
+ import "prismjs/themes/prism.css"; // if you use the CodeBlock/Prism plugin
230
207
  ```
231
208
 
232
209
  This keeps the library flexible and avoids network/CDN reliance in restricted environments.
233
210
 
234
-
235
211
  #### Emoji Support
236
212
 
237
213
  ```vue
238
214
  <script setup>
239
- import { MdRenderer } from 'mio-previewer'
240
- import { EmojiPlugin } from 'mio-previewer/plugins/custom'
241
- import 'mio-previewer/dist/mio-previewer.css'
215
+ import { MdRenderer } from "mio-previewer";
216
+ import { EmojiPlugin } from "mio-previewer/plugins/custom";
217
+ import "mio-previewer/dist/mio-previewer.css";
242
218
 
243
- const markdown = 'Hello :smile: Welcome! :tada: :rocket:'
219
+ const markdown = "Hello :smile: Welcome! :tada: :rocket:";
244
220
 
245
- const customPlugins = [EmojiPlugin]
221
+ const customPlugins = [EmojiPlugin];
246
222
  </script>
247
223
 
248
224
  <template>
249
- <MdRenderer
250
- :md="markdown"
251
- :customPlugins="customPlugins"
252
- />
225
+ <MdRenderer :md="markdown" :customPlugins="customPlugins" />
253
226
  </template>
254
227
  ```
255
228
 
@@ -257,11 +230,15 @@ const customPlugins = [EmojiPlugin]
257
230
 
258
231
  ```vue
259
232
  <script setup>
260
- import { ref } from 'vue'
261
- import { MdRenderer } from 'mio-previewer'
262
- import { AlertPlugin, katexPlugin } from 'mio-previewer/plugins/markdown-it'
263
- import { mermaidPlugin, CodeBlockPlugin, EmojiPlugin } from 'mio-previewer/plugins/custom'
264
- import 'mio-previewer/dist/mio-previewer.css'
233
+ import { ref } from "vue";
234
+ import { MdRenderer } from "mio-previewer";
235
+ import { AlertPlugin, katexPlugin } from "mio-previewer/plugins/markdown-it";
236
+ import {
237
+ mermaidPlugin,
238
+ CodeBlockPlugin,
239
+ EmojiPlugin,
240
+ } from "mio-previewer/plugins/custom";
241
+ import "mio-previewer/dist/mio-previewer.css";
265
242
 
266
243
  const markdown = ref(`# Complete Demo :rocket:
267
244
 
@@ -287,23 +264,16 @@ graph LR
287
264
  \`\`\`
288
265
 
289
266
  Great work! :thumbsup: :100:
290
- `)
267
+ `);
291
268
 
292
- const customPlugins = [
293
- mermaidPlugin,
294
- CodeBlockPlugin,
295
- EmojiPlugin
296
- ]
269
+ const customPlugins = [mermaidPlugin, CodeBlockPlugin, EmojiPlugin];
297
270
 
298
- const markdownItPlugins = [
299
- { plugin: AlertPlugin },
300
- { plugin: katexPlugin }
301
- ]
271
+ const markdownItPlugins = [{ plugin: AlertPlugin }, { plugin: katexPlugin }];
302
272
  </script>
303
273
 
304
274
  <template>
305
- <MdRenderer
306
- :md="markdown"
275
+ <MdRenderer
276
+ :md="markdown"
307
277
  :customPlugins="customPlugins"
308
278
  :markdownItPlugins="markdownItPlugins"
309
279
  />
@@ -316,59 +286,60 @@ const markdownItPlugins = [
316
286
 
317
287
  ```javascript
318
288
  const HighlightPlugin = {
319
- name: 'highlight',
289
+ name: "highlight",
320
290
  priority: 50,
321
291
  test: (node) => {
322
- return node.type === 'tag' &&
323
- node.name === 'mark'
292
+ return node.type === "tag" && node.name === "mark";
324
293
  },
325
294
  render: (node, renderChildren, h) => {
326
- return h('mark', {
327
- style: {
328
- backgroundColor: '#ffeb3b',
329
- padding: '2px 4px',
330
- borderRadius: '2px'
331
- }
332
- }, renderChildren())
333
- }
334
- }
295
+ return h(
296
+ "mark",
297
+ {
298
+ style: {
299
+ backgroundColor: "#ffeb3b",
300
+ padding: "2px 4px",
301
+ borderRadius: "2px",
302
+ },
303
+ },
304
+ renderChildren(),
305
+ );
306
+ },
307
+ };
335
308
 
336
309
  // Use it
337
- const customPlugins = [HighlightPlugin]
310
+ const customPlugins = [HighlightPlugin];
338
311
  ```
339
312
 
340
313
  #### Custom Markdown-it Plugin
341
314
 
342
315
  ```javascript
343
316
  function customContainerPlugin(md) {
344
- md.use(require('markdown-it-container'), 'note', {
317
+ md.use(require("markdown-it-container"), "note", {
345
318
  render: (tokens, idx) => {
346
319
  if (tokens[idx].nesting === 1) {
347
- return '<div class="note">\n'
320
+ return '<div class="note">\n';
348
321
  } else {
349
- return '</div>\n'
322
+ return "</div>\n";
350
323
  }
351
- }
352
- })
324
+ },
325
+ });
353
326
  }
354
327
 
355
- const markdownItPlugins = [
356
- { plugin: customContainerPlugin }
357
- ]
328
+ const markdownItPlugins = [{ plugin: customContainerPlugin }];
358
329
  ```
359
330
 
360
331
  ## API Reference
361
332
 
362
333
  ### MdRenderer Props
363
334
 
364
- | Prop | Type | Default | Description |
365
- |------|------|---------|-------------|
366
- | `md` | `string` | `''` | Markdown content to render |
367
- | `isStreaming` | `boolean` | `false` | Show cursor during streaming |
368
- | `useWorker` | `boolean` | `false` | Use Web Worker for parsing |
369
- | `customPlugins` | `CustomPlugin[]` | `[]` | Custom rendering plugins |
370
- | `markdownItPlugins` | `MarkdownItPluginConfig[]` | `[]` | Markdown-it plugins |
371
- | `markdownItOptions` | `object` | `{}` | Markdown-it options |
335
+ | Prop | Type | Default | Description |
336
+ | ------------------- | -------------------------- | ------- | ---------------------------- |
337
+ | `md` | `string` | `''` | Markdown content to render |
338
+ | `isStreaming` | `boolean` | `false` | Show cursor during streaming |
339
+ | `useWorker` | `boolean` | `false` | Use Web Worker for parsing |
340
+ | `customPlugins` | `CustomPlugin[]` | `[]` | Custom rendering plugins |
341
+ | `markdownItPlugins` | `MarkdownItPluginConfig[]` | `[]` | Markdown-it plugins |
342
+ | `markdownItOptions` | `object` | `{}` | Markdown-it options |
372
343
 
373
344
  ### Plugin Types
374
345
 
@@ -376,14 +347,14 @@ const markdownItPlugins = [
376
347
 
377
348
  ```typescript
378
349
  interface CustomPlugin {
379
- name?: string
380
- priority?: number // Higher = earlier execution
381
- test: (node: ASTNode) => boolean
350
+ name?: string;
351
+ priority?: number; // Higher = earlier execution
352
+ test: (node: ASTNode) => boolean;
382
353
  render: (
383
354
  node: ASTNode,
384
355
  renderChildren: () => VNode[],
385
- h: typeof import('vue').h
386
- ) => VNode | string | null
356
+ h: typeof import("vue").h,
357
+ ) => VNode | string | null;
387
358
  }
388
359
  ```
389
360
 
@@ -391,8 +362,8 @@ interface CustomPlugin {
391
362
 
392
363
  ```typescript
393
364
  interface MarkdownItPluginConfig {
394
- plugin: (md: MarkdownIt, options?: any) => void
395
- options?: any
365
+ plugin: (md: MarkdownIt, options?: any) => void;
366
+ options?: any;
396
367
  }
397
368
  ```
398
369
 
@@ -400,18 +371,18 @@ interface MarkdownItPluginConfig {
400
371
 
401
372
  ### Markdown-it Plugins (Syntax)
402
373
 
403
- | Plugin | Import Path | Description |
404
- |--------|-------------|-------------|
374
+ | Plugin | Import Path | Description |
375
+ | ------------- | ----------------------------------- | ------------------------------------------- |
405
376
  | `AlertPlugin` | `mio-previewer/plugins/markdown-it` | Alert boxes (info, warning, error, success) |
406
- | `katexPlugin` | `mio-previewer/plugins/markdown-it` | Math formulas with KaTeX |
377
+ | `katexPlugin` | `mio-previewer/plugins/markdown-it` | Math formulas with KaTeX |
407
378
 
408
379
  ### Custom Plugins (Rendering)
409
380
 
410
- | Plugin | Import Path | Description |
411
- |--------|-------------|-------------|
412
- | `mermaidPlugin` | `mio-previewer/plugins/custom` | Diagram rendering with Mermaid |
413
- | `CodeBlockPlugin` | `mio-previewer/plugins/custom` | Syntax highlighting with Prism |
414
- | `EmojiPlugin` | `mio-previewer/plugins/custom` | Emoji code replacement |
381
+ | Plugin | Import Path | Description |
382
+ | ------------------- | ------------------------------ | -------------------------------------------------------------------------- |
383
+ | `mermaidPlugin` | `mio-previewer/plugins/custom` | Diagram rendering with Mermaid |
384
+ | `CodeBlockPlugin` | `mio-previewer/plugins/custom` | Syntax highlighting with Prism |
385
+ | `EmojiPlugin` | `mio-previewer/plugins/custom` | Emoji code replacement |
415
386
  | `imageViewerPlugin` | `mio-previewer/plugins/custom` | Image preview with zoom & gestures ([docs](./docs/IMAGE_VIEWER_PLUGIN.md)) |
416
387
 
417
388
  ## Advanced Usage
@@ -421,18 +392,15 @@ interface MarkdownItPluginConfig {
421
392
  ```vue
422
393
  <script setup>
423
394
  const markdownItOptions = {
424
- html: true, // Enable HTML tags
425
- linkify: true, // Auto-convert URLs
395
+ html: true, // Enable HTML tags
396
+ linkify: true, // Auto-convert URLs
426
397
  typographer: true, // Smart quotes, dashes
427
- breaks: false // Convert \n to <br>
428
- }
398
+ breaks: false, // Convert \n to <br>
399
+ };
429
400
  </script>
430
401
 
431
402
  <template>
432
- <MdRenderer
433
- :md="markdown"
434
- :markdownItOptions="markdownItOptions"
435
- />
403
+ <MdRenderer :md="markdown" :markdownItOptions="markdownItOptions" />
436
404
  </template>
437
405
  ```
438
406
 
@@ -442,10 +410,7 @@ For better performance with large documents:
442
410
 
443
411
  ```vue
444
412
  <template>
445
- <MdRenderer
446
- :md="largeMarkdown"
447
- :useWorker="true"
448
- />
413
+ <MdRenderer :md="largeMarkdown" :useWorker="true" />
449
414
  </template>
450
415
  ```
451
416
 
@@ -492,7 +457,7 @@ mio-previewer/
492
457
  ## Browser Support
493
458
 
494
459
  - Chrome/Edge: Latest 2 versions
495
- - Firefox: Latest 2 versions
460
+ - Firefox: Latest 2 versions
496
461
  - Safari: Latest 2 versions
497
462
 
498
463
  ## Documentation
@@ -500,6 +465,7 @@ mio-previewer/
500
465
  📚 **[Complete Documentation →](./docs/README.md)**
501
466
 
502
467
  ### Quick Links
468
+
503
469
  - [Plugin System Guide](./docs/PLUGINS.md) - Complete plugin system documentation
504
470
  - [Customize Code Block Styles](./docs/CUSTOMIZE_CODEBLOCK_STYLE.md) - Code block theming
505
471
  - [KaTeX Configuration](./docs/KATEX_DELIMITERS.md) - Math formula setup
@@ -514,4 +480,3 @@ MIT
514
480
  - [GitHub Repository](https://github.com/Pretend-to/mio-previewer)
515
481
  - [npm Package](https://www.npmjs.com/package/mio-previewer)
516
482
  - [Documentation Center](./docs/README.md)
517
-