Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

script-block.tsx 623B

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