Co-authored-by: andig <cpuidle@gmail.com> Co-authored-by: andig <andi@evcc.io> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: Michael Geers <michael@geers.tv>
32 lines
603 B
Vue
32 lines
603 B
Vue
<template>
|
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
<div class="root" v-html="compiledMarkdown"></div>
|
|
</template>
|
|
|
|
<script>
|
|
import snarkdown from "snarkdown";
|
|
|
|
export default {
|
|
name: "MarkdownRenderer",
|
|
props: {
|
|
markdown: String,
|
|
},
|
|
computed: {
|
|
compiledMarkdown() {
|
|
const html = snarkdown(this.markdown);
|
|
// open all links in new window
|
|
return html.replace(/<a href=/g, '<a target="_blank" rel="noopener noreferrer" href=');
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.root {
|
|
max-width: 100%;
|
|
}
|
|
.root :deep(pre.code) {
|
|
overflow-x: auto;
|
|
margin: 1em 0;
|
|
hyphens: none;
|
|
}
|
|
</style>
|