feat(front): integrate markdown-it for rendering markdown content in MarkdownRender component

This commit is contained in:
keven1024
2025-05-20 11:38:58 +08:00
parent daf5a036e1
commit c63cec5d2b
7 changed files with 114 additions and 114 deletions

View File

@@ -0,0 +1,15 @@
<script setup lang="ts">
import markdownit from 'markdown-it'
import { cx } from 'class-variance-authority'
const props = defineProps<{
markdown: string
class?: string
}>()
const renderHtml = computed(() => {
const md = markdownit()
return md.render(props?.markdown || '')
})
</script>
<template>
<div :class="cx('prose', props?.class)" v-html="renderHtml" />
</template>