Skip to content

Commit 1a9f2bc

Browse files
committed
docs: update readme
1 parent a2e3d95 commit 1a9f2bc

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

README.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
1-
# vue-markdown-x
1+
# Vue Markdown
22

33
The vue component for render MarkDown string
4+
5+
## What is this?
6+
7+
This is a Vue.js component focused on MarkDown string rendering, which is based on [mdast-util-to-vnode](https://github.com/litingyes/mdast-util-to-vnode) to parse MarkDown string and render by Vue.js.
8+
9+
## When should I use this?
10+
11+
- Rendering MarkDown strings with Vue.js
12+
- Streaming MarkDown strings (usually in AI Chat)
13+
14+
## Install
15+
16+
```base
17+
npm install vue-markdown-x
18+
```
19+
20+
## Use
21+
22+
```vue
23+
<script setup>
24+
import { ref } from 'vue'
25+
import { VueMarkdown } from 'vue-markdown-x'
26+
27+
const mdStr = ref('')
28+
</script>
29+
30+
<template>
31+
<VueMarkdown :md="mdStr" />
32+
</template>
33+
```
34+
35+
### VueMarkdown Props
36+
37+
#### md
38+
39+
MarkDown string to render.
40+
41+
```ts
42+
// default: ''
43+
type md = string
44+
```
45+
46+
#### shiki
47+
48+
options of shiki for render code block.
49+
50+
```ts
51+
interface shiki {
52+
// default: { light: catppuccinLatte, dark: catppuccinMocha }
53+
themes?: Record<string, ThemeRegistration>
54+
55+
// default: [css,html,javascript,json,markdown,typescript,vue]
56+
langs?: LanguageRegistration[][]
57+
}
58+
```
59+
60+
### VueMarkdown Css Variables
61+
62+
```css
63+
:root {
64+
/* basic font-size, and heading's font-size is scaled based on this value. */
65+
--vue-markdown-font-size: 16px;
66+
67+
/* font-weight for heading */
68+
--vue-markdown-heading-font-weight: 600;
69+
}
70+
```

0 commit comments

Comments
 (0)