mirror of
https://github.com/keven1024/015.git
synced 2026-06-07 21:04:33 +00:00
feat(front): integrate markdown-it for rendering markdown content in MarkdownRender component
This commit is contained in:
15
front/components/MarkdownRender.vue
Normal file
15
front/components/MarkdownRender.vue
Normal 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>
|
||||
Reference in New Issue
Block a user