Feature: 页面内Markdown渲染 & 规格参数表格

This commit is contained in:
2025-08-16 13:57:17 +08:00
parent c77b2282da
commit daa91ac56f
10 changed files with 221 additions and 36 deletions

15
app/utils/markdown.ts Normal file
View File

@ -0,0 +1,15 @@
import MarkdownIt from 'markdown-it';
import DOMPurify from 'dompurify';
const md = new MarkdownIt({
html: true,
linkify: true,
typographer: true,
breaks: true,
})
export function renderMarkdown(content: string): string {
const dirtyHtml = md.render(content);
return DOMPurify.sanitize(dirtyHtml)
}