Feature: 新增界面-公司简介

This commit is contained in:
2025-08-18 17:16:35 +08:00
parent bf19fc9d35
commit 6d405b5367
6 changed files with 118 additions and 98 deletions

View File

@ -1,5 +1,4 @@
import MarkdownIt from 'markdown-it';
import DOMPurify from 'dompurify';
const md = new MarkdownIt({
html: true,
@ -10,6 +9,13 @@ const md = new MarkdownIt({
export function renderMarkdown(content: string): string {
const dirtyHtml = md.render(content);
return DOMPurify.sanitize(dirtyHtml)
if (typeof window !== 'undefined') {
import('dompurify').then((DOMPurify => {
return DOMPurify.default.sanitize(dirtyHtml)
}))
}
return dirtyHtml
}