fix(frontend): 完善Markdown与Chat事件渲染

This commit is contained in:
2026-08-29 23:59:01 +08:00
parent e5f803c364
commit 5aa0026bb9
7 changed files with 106 additions and 19 deletions
+9
View File
@@ -0,0 +1,9 @@
import DOMPurify from 'dompurify'
import { marked } from 'marked'
marked.setOptions({ gfm: true, breaks: true })
export function renderMarkdown(source: string): string {
const html = marked.parse(source, { async: false }) as string
return DOMPurify.sanitize(html, { USE_PROFILES: { html: true } })
}