fix: 修复嵌套 markdown fence 导致的渲染截断 (#222)
* fix: keep nested markdown fences rendered * fix: prevent thinking placeholder leaks * fix: normalize nested markdown example fences
This commit is contained in:
@@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import { handleCodeBlockCopyClick, renderHighlightedCodeBlock } from './highlight'
|
||||
import { repairNestedMarkdownFences } from './markdownFenceRepair'
|
||||
import { downloadFile } from '@/api/hermes/download'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
@@ -26,7 +27,7 @@ const md: MarkdownIt = new MarkdownIt({
|
||||
})
|
||||
|
||||
const renderedHtml = computed(() => {
|
||||
let html = md.render(props.content)
|
||||
let html = md.render(repairNestedMarkdownFences(props.content))
|
||||
if (props.mentionNames && props.mentionNames.length > 0) {
|
||||
const escaped = props.mentionNames.map(n => n.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
||||
const re = new RegExp(`(?<=[\\s>]|^)@(${escaped.join('|')})(?=\\s|$)`, 'gi')
|
||||
|
||||
Reference in New Issue
Block a user