Feature: 新增界面-公司简介
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user