1
0
Fork 0
mirror of https://github.com/Luzifer/wiki.git synced 2025-01-02 00:41:21 +00:00
wiki/src/markdown.vue
Knut Ahlers a70eb9306a
Port frontend to Vue 3 / Bootstrap 5.3
and update dependencies

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-01-30 15:46:01 +01:00

45 lines
689 B
Vue

<template>
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="render" />
</template>
<script>
import showdown from 'showdown'
export default {
data() {
return {
render: '',
}
},
emits: ['rendered'],
name: 'WikiMarkdown',
props: {
content: {
default: '',
type: String,
},
prerender: {
default: null,
type: Function,
},
},
watch: {
content(to) {
let content = to
if (this.prerender) {
content = this.prerender(content)
}
const converter = new showdown.Converter()
this.render = converter.makeHtml(content)
this.$emit('rendered')
},
},
}
</script>