vue-markdown-viewer
v2.0.2
Published
 
Downloads
713
Maintainers
Readme
vue-markdown-viewer
Vue component to render markdown with remark.
Install
$ npm install vue-markdown-viewerUse
<script lang="ts" setup>
import { ref } from 'vue'
import { VueMarkdownRender } from 'core'
const md = ref('## hi')
</script>
<template>
<VueMarkdownRender>{{ md }}</VueMarkdownRender>
</template>Use a plugin to support gfm:
<script lang="ts" setup>
import { ref } from 'vue'
import { VueMarkdownRender } from 'core'
import remarkGfm from 'remark-gfm'
const md = ref('## hi')
</script>
<template>
<VueMarkdownRender :remark-plugins="[remarkGfm]">
{{ md }}
</VueMarkdownRender>
</template>Use a plugin to support syntax highlight:
<script lang="ts" setup>
import { ref } from 'vue'
import { VueMarkdownRender } from 'core'
import rehypeHighlight from 'rehype-highlight'
const md = ref(`
## Highlight
```js
console.log("hi")
```
`)
</script>
<template>
<VueMarkdownRender :rehype-plugins="[rehypeHighlight]">
{{ md }}
</VueMarkdownRender>
</template>Options
content:string
markdown stringcomponents:Record<string, Component>
object mapping tag names to Vue componentsremarkRehypeOptions:Record<string, any>
Options of remark-rehyperemarkPlugins:Array
list of remark plugins to userehypePlugins:Array
list of rehype plugins to useclassName:string
wrap the markdown in adivwith this class nameskipHtml:boolean, default:false
ignore HTML in markdown completelylinkTarget:string
target to use on links
