Bun

interface

markdown.ReactOptions

interface ReactOptions

Options for react() — parser options and element symbol configuration.

  • collapseWhitespace?: boolean

    Collapse whitespace in text content. Default: false.

  • hardSoftBreaks?: boolean

    Treat soft line breaks as hard line breaks. Default: false.

  • headings?: boolean | { autolink: boolean; ids: boolean }

    Configure heading IDs and autolink headings. Pass true to enable both heading IDs and autolink headings, or an object to configure individually.

    // Enable both heading IDs and autolink headings
    { headings: true }
    // Enable only heading IDs
    { headings: { ids: true } }
    
  • latexMath?: boolean

    Enable LaTeX math ($inline$ and $$display$$). Default: false.

  • noHtmlBlocks?: boolean

    Disable HTML blocks. Default: false.

  • noHtmlSpans?: boolean

    Disable inline HTML spans. Default: false.

  • noIndentedCodeBlocks?: boolean

    Disable indented code blocks. Default: false.

  • permissiveAtxHeaders?: boolean

    Allow ATX headers without a space after #. Default: false.

  • reactVersion?: 18 | 19

    Which $$typeof symbol to use on the generated elements.

    • 19 (default): Symbol.for('react.transitional.element')
    • 18: Symbol.for('react.element') — use this for React 18 and older
  • strikethrough?: boolean

    Enable GFM strikethrough (~~text~~). Default: true.

  • tables?: boolean

    Enable GFM tables. Default: true.

  • tagFilter?: boolean

    Enable the GFM tag filter, which replaces < with &lt; for disallowed HTML tags (e.g. <script>, <style>, <iframe>). Default: false.

  • tasklists?: boolean

    Enable GFM task lists (- [x] item). Default: true.

  • underline?: boolean

    Enable underline syntax (__text__ renders as <u> instead of <strong>). Default: false.