浏览代码

fix(html-parser): sanitize unclosed tags in markdown rendering (#14309)

tags/1.0.0
Chuckie Li 8 个月前
父节点
当前提交
d5711589cd
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5
    0
      web/app/components/base/markdown.tsx

+ 5
- 0
web/app/components/base/markdown.tsx 查看文件

@@ -258,6 +258,11 @@ export function Markdown(props: { content: string; className?: string }) {
if (node.type === 'element' && node.properties?.ref)
delete node.properties.ref

if (node.type === 'element' && !/^[a-z][a-z0-9]*$/i.test(node.tagName)) {
node.type = 'text'
node.value = `<${node.tagName}`
}

if (node.children)
node.children.forEach(iterate)
}

正在加载...
取消
保存