The vue lib for markdown-it.
http://www.aqcoder.com/markdown
source-shell
npm install markdown-it-vue
internal plugin list:
use options
property to sepcial the options of markdow-it and markdown-it-plugins.
text-html-basic
<markdown-it-vue class="md-body" :content="content" :options="options" />
source-js
options: {
markdownIt: {
linkify: true
},
linkAttributes: {
attrs: {
target: '_blank',
rel: 'noopener'
}
}
}
more markdown-it options see https://markdown-it.github.io/markdown-it/.
amd default plugins options:
source-js
{
linkAttributes: {
attrs: {
target: '_blank',
rel: 'noopener'
}
},
katex: {
throwOnError: false,
errorColor: '#cc0000'
},
icons: 'font-awesome',
githubToc: {
tocFirstLevel: 2,
tocLastLevel: 3,
tocClassName: 'toc',
anchorLinkSymbol: '',
anchorLinkSpace: false,
anchorClassName: 'anchor',
anchorLinkSymbolClassName: 'octicon octicon-link'
}
}
it can add your plugin to markdown-it-vue by the use
method.
source-js
this.$refs.myMarkdownItVue.use(MyMarkdownItPlugin)
text-html-vue
<template>
<div>
<markdown-it-vue class="md-body" :content="content" />
</div>
</template>
<script>
import MarkdownItVue from 'markdown-it-vue'
import 'markdown-it-vue/dist/markdown-it-vue.css'
export default {
components: {
MarkdownItVue
},
data() {
return {
content: '# your markdown content'
}
}
}
</script>
#vuejs #javascript #markdown #vue-js