Refactor/markdown component split (#20177)

This commit is contained in:
sayThQ199 2025-05-30 11:31:50 +08:00 • committed by GitHub
commit f65c2fcb1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 319 additions and 210 deletions

View file

@ -0,0 +1,15 @@
/**
* @fileoverview ScriptBlock component for handling <script> tags in Markdown.
* Extracted from the main markdown renderer for modularity.
* Note: Current implementation returns the script tag as a string, which might not execute as expected in React.
* This behavior is preserved from the original implementation and may need review for security and functionality.
*/
import { memo } from 'react'
const ScriptBlock = memo(({ node }: any) => {
const scriptContent = node.children[0]?.value || ''
return `<script>${scriptContent}</script>`
})
ScriptBlock.displayName = 'ScriptBlock'
export default ScriptBlock