mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-28 13:31:32 +08:00
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:
parent
9e567ace4e
commit
54a92bf2c6
@ -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 {
|
||||
|
||||
@ -625,7 +625,9 @@ export const sanitizeHtml = (html: string): string => {
|
||||
'td',
|
||||
'th',
|
||||
'input',
|
||||
'label'
|
||||
'label',
|
||||
'details',
|
||||
'summary'
|
||||
],
|
||||
ALLOWED_ATTR: [
|
||||
'href',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user