markdown-it-vue3 1.0.0 → 1.1.0
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/LICENSE +31 -0
- package/README.md +41 -41
- package/dist/demo.html +1 -1
- package/dist/markdown-it-vue3.common.js +107971 -481
- package/dist/markdown-it-vue3.css +1 -1
- package/dist/markdown-it-vue3.umd.js +107971 -481
- package/dist/markdown-it-vue3.umd.min.js +6 -30
- package/package.json +7 -7
- package/src/index.js +4 -0
- package/src/markdown-it-copy.css +56 -0
- package/src/markdown-it-highlight.js +49 -2
- package/src/markdown-it-image/image-viewer.vue +63 -4
- package/src/markdown-it-plugin-echarts.js +2 -1
- package/src/markdown-it-vue-streaming.vue +521 -0
- package/src/markdown-it-vue.vue +58 -7
- package/src/streaming-renderer.js +207 -0
- package/types/index.d.ts +4 -2
- package/types/markdown-it-vue-streaming.d.ts +56 -0
- package/types/{markdown-it-vue3.d.ts → markdown-it-vue.d.ts} +0 -2
- package/types/streaming-renderer.d.ts +70 -0
- package/dist/markdown-it-vue3-light.common.js +0 -68457
- package/dist/markdown-it-vue3-light.css +0 -5
- package/dist/markdown-it-vue3-light.umd.js +0 -68476
- package/dist/markdown-it-vue3-light.umd.min.js +0 -30
- package/src/index-light.js +0 -13
- package/src/markdown-it-vue-light.vue +0 -271
package/LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nico
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
-------------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
Third-Party Copyright Notice
|
|
26
|
+
|
|
27
|
+
This project includes code based on or referenced from ravenq/markdown-it-vue,
|
|
28
|
+
which is licensed under the MIT License:
|
|
29
|
+
https://github.com/ravenq/markdown-it-vue/blob/master/LICENSE
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2019 ravenq
|
package/README.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# markdown-it-vue3
|
|
2
|
+
[](https://www.npmjs.com/package/markdown-it-vue3)
|
|
3
|
+
[](https://www.npmjs.com/package/markdown-it-vue3)
|
|
4
|
+
[](https://vuejs.org/)
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
|
|
7
|
+
> Vue3 版本的 markdown 流式渲染组件。<br>
|
|
8
|
+
> A Vue 3 markdown rendering component support streaming, built on top of [markdown-it](https://github.com/markdown-it/markdown-it)
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Emoji, Subscript, Superscript, Footnotes
|
|
13
|
+
- Task lists, Definition lists
|
|
14
|
+
- KaTeX/LaTeX math
|
|
15
|
+
- Mermaid, ECharts, Flowchart diagrams
|
|
16
|
+
- Code highlighting with copy button
|
|
17
|
+
- Image viewer
|
|
18
|
+
- Alert containers: `::: success/info/warning/error`
|
|
19
|
+
- **Streaming support** for AI chat scenarios
|
|
20
|
+
|
|
21
|
+
* Demo: https://niyongsheng.github.io/markdown-it-vue3/
|
|
4
22
|
|
|
5
23
|
## Install
|
|
6
24
|
|
|
@@ -10,61 +28,43 @@ npm install markdown-it-vue3
|
|
|
10
28
|
|
|
11
29
|
## Usage
|
|
12
30
|
|
|
31
|
+
### Static Markdown
|
|
32
|
+
|
|
13
33
|
```vue
|
|
14
34
|
<template>
|
|
15
|
-
<
|
|
35
|
+
<MarkdownItVue :content="content" />
|
|
16
36
|
</template>
|
|
17
37
|
|
|
18
|
-
<script>
|
|
38
|
+
<script setup>
|
|
19
39
|
import MarkdownItVue from 'markdown-it-vue3'
|
|
20
40
|
import 'markdown-it-vue3/dist/markdown-it-vue3.css'
|
|
21
41
|
|
|
22
|
-
|
|
23
|
-
components: { MarkdownItVue },
|
|
24
|
-
data() {
|
|
25
|
-
return { content: '# Hello World' }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
42
|
+
const content = '# Hello World'
|
|
28
43
|
</script>
|
|
29
44
|
```
|
|
30
45
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Smaller bundle without Mermaid, ECharts, Flowchart:
|
|
34
|
-
|
|
35
|
-
```javascript
|
|
36
|
-
import MarkdownItVueLight from 'markdown-it-vue3/dist/markdown-it-vue3-light'
|
|
37
|
-
import 'markdown-it-vue3/dist/markdown-it-vue3-light.css'
|
|
38
|
-
```
|
|
46
|
+
### Streaming Markdown (AI Chat)
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
```vue
|
|
49
|
+
<template>
|
|
50
|
+
<MarkdownItVueStreaming
|
|
51
|
+
:content="streamContent"
|
|
52
|
+
:streaming="isStreaming"
|
|
53
|
+
@render-complete="onComplete"
|
|
54
|
+
/>
|
|
55
|
+
</template>
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
<script setup>
|
|
58
|
+
import { ref } from 'vue'
|
|
59
|
+
import { MarkdownItVueStreaming } from 'markdown-it-vue3'
|
|
60
|
+
import 'markdown-it-vue3/dist/markdown-it-vue3.css'
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
katex: { throwOnError: false },
|
|
53
|
-
githubToc: { tocFirstLevel: 2, tocLastLevel: 3 },
|
|
54
|
-
mermaid: { theme: 'default' },
|
|
55
|
-
image: { viewer: true }
|
|
56
|
-
}
|
|
62
|
+
const streamContent = ref('')
|
|
63
|
+
const isStreaming = ref(false)
|
|
64
|
+
</script>
|
|
57
65
|
```
|
|
58
66
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- Emoji, Subscript, Superscript, Footnotes
|
|
62
|
-
- Task lists, Definition lists
|
|
63
|
-
- KaTeX/LaTeX math
|
|
64
|
-
- Mermaid, ECharts, Flowchart diagrams
|
|
65
|
-
- Code highlighting
|
|
66
|
-
- Image viewer
|
|
67
|
-
- Alert containers: `::: success/info/warning/error`
|
|
67
|
+
> 📖 **See [example](./example) for complete implementation**
|
|
68
68
|
|
|
69
69
|
## License
|
|
70
70
|
|
package/dist/demo.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><meta charset="utf-8"><title>markdown-it-vue3
|
|
1
|
+
<!doctype html><meta charset="utf-8"><title>markdown-it-vue3 demo</title><script src="./markdown-it-vue3.umd.js"></script><link rel="stylesheet" href="./markdown-it-vue3.css"><script>console.log(markdown-it-vue3)</script>
|