ant-design-vue/examples/md.vue

26 lines
434 B
Vue

<template>
<div v-html="marked($slots.default[0].text.trim() || '')" />
</template>
<script>
import marked from 'marked'
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: true,
sanitize: true,
smartLists: true,
smartypants: true,
})
export default {
name: 'md',
data () {
console.log(this.$slots.default)
return {
marked,
}
},
}
</script>