<!-- eslint-disable vue/no-v-html -->
<template>
  <!-- 用 v-html 渲染解析后的 HTML -->
  <div class="markdown-body" v-html="safeHtml" />
</template>

<script setup lang="ts">
interface Props {
  content: string
}

const props = defineProps<Props>()

const contentWithAbsoluteUrls = convertMedia(props.content)

// 将 Markdown 转换成 HTML
const safeHtml = computed(() => renderMarkdown(contentWithAbsoluteUrls))
// const safeHtml = computed(() => renderMarkdown(props.content))

</script>

<style>
.markdown-body {
  padding: 10px;
  line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2 {
  color: var(--el-color-primary);
  font-size: 1.5em;
  margin-bottom: 0.5em;
}

.markdown-body ol {
  list-style-type: decimal;
  padding-left: 2em;
}
</style>