Content not rendered
[issue link]Hello,
I use markdown-it module to parse .md
files, with this component to convert internal links :
<template>
<div v-html="content">
</div>
</template>
<script>
export default {
props: ['content'],
mounted() {
this.addListeners()
},
beforeDestroy() {
this.removeListeners()
},
watch: {
'content': 'contentUpdated'
},
methods: {
navigate(event) {
const href = event.target.getAttribute('href')
if (href && href[0] === '/') {
event.preventDefault()
this.$router.push(href)
}
},
contentUpdated() {
this.removeListeners()
this.$nextTick(() => {
this.addListeners()
})
},
addListeners() {
this._links = this.$el.getElementsByTagName('a')
for (let i = 0; i < this._links.length; i++) {
this._links[i].addEventListener('click', this.navigate, false)
}
},
removeListeners() {
for (let i = 0; i < this._links.length; i++) {
this._links[i].removeEventListener('click', this.navigate, false)
}
this._links = []
}
}
}
</script>
It works fine but the content of the .md
is not html rendered with nuxt generate
, but instead stored in the js…
Any idea?
Thanks!