fix: support rendering and display of <details/> and <summary/> tags (#9699)

* 修复issue https://github.com/CherryHQ/cherry-studio/issues/9635,支持<details/>和<summary/>标签渲染展示,后期可以考虑做成配置化,允许用户自定义标签展示逻辑,或者扩展rehypeRaw插件标签识别逻辑,支持任意标签的渲染展示

* 修复issue https://github.com/CherryHQ/cherry-studio/issues/9635,支持<details/>和<summary/>标签渲染展示,后期可以考虑做成配置化,允许用户自定义标签展示逻辑,或者扩展rehypeRaw插件标签识别逻辑,支持任意标签的渲染展示
This commit is contained in:
vectorstone 2025-08-31 12:28:50 +08:00 committed by GitHub
parent 9e567ace4e
commit 54a92bf2c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -34,7 +34,7 @@ import remarkDisableConstructs from './plugins/remarkDisableConstructs'
import Table from './Table'
const ALLOWED_ELEMENTS =
/<(style|p|div|span|b|i|strong|em|ul|ol|li|table|tr|td|th|thead|tbody|h[1-6]|blockquote|pre|code|br|hr|svg|path|circle|rect|line|polyline|polygon|text|g|defs|title|desc|tspan|sub|sup)/i
/<(style|p|div|span|b|i|strong|em|ul|ol|li|table|tr|td|th|thead|tbody|h[1-6]|blockquote|pre|code|br|hr|svg|path|circle|rect|line|polyline|polygon|text|g|defs|title|desc|tspan|sub|sup|details|summary)/i
const DISALLOWED_ELEMENTS = ['iframe', 'script']
interface Props {

View File

@ -625,7 +625,9 @@ export const sanitizeHtml = (html: string): string => {
'td',
'th',
'input',
'label'
'label',
'details',
'summary'
],
ALLOWED_ATTR: [
'href',