Initial project

This commit is contained in:
Timi
2025-07-08 16:33:11 +08:00
parent 1a5a16be74
commit f862530142
80 changed files with 8301 additions and 129 deletions

View File

@@ -0,0 +1,42 @@
<template>
<div
class="tui-markdown-view selectable break-all line-numbers"
v-html="markdownHTML"
:data-max-height="maxHeight"
></div>
</template>
<script lang="ts" setup>
import Prism from "prismjs";
import Markdown from "~/utils/Markdown";
defineOptions({
name: "MarkdownView"
});
const props = withDefaults(defineProps<{
content?: string;
showCodeBorder?: boolean;
maxHeight?: string;
}>(), {
content: "",
showCodeBorder: true,
maxHeight: "400px"
});
const { content } = toRefs(props);
const markdownHTML = ref("");
const doRender = async () => {
markdownHTML.value = await Markdown.getInstance().toHTML(content.value);
await nextTick();
Prism.highlightAll();
};
watch(() => props.content, doRender);
onMounted(doRender);
</script>
<style lang="less" scoped>
.tui-markdown-view {
width: 100%;
overflow: auto;
}
</style>