markdown-to-jsx
Advanced tools
Changelog
7.7.3
Changelog
7.7.2
ReactNode
instead of ReactChild
for React 19 compatibilityChangelog
7.7.1
Changelog
7.7.0
20777bf: Add support for GFM alert-style blockquotes.
> [!Note]
> This is a note-flavored alert blockquote. The "Note" text is injected as a `<header>` by
> default and the blockquote can be styled via the injected class `markdown-alert-note`
> for example.
<Markdown>
component to allow for easier composition.React.JSX.*
namespace instead of JSX.*
for React 19 compatibility.ref
attributes when processing inline HTML, React doesn't handle it well.Changelog
7.6.2
class
attribute from arbitrary HTML properly to avoid React warnings.Changelog
7.6.1
class
attribute from arbitrary HTML properly to avoid React warnings.Changelog
7.6.0
2281a4d: Add options.disableAutoLink
to customize bare URL handling behavior.
By default, bare URLs in the markdown document will be converted into an anchor tag. This behavior can be disabled if desired.
<Markdown options={{ disableAutoLink: true }}>
The URL https://quantizor.dev will not be rendered as an anchor tag.
</Markdown>
// or
compiler(
'The URL https://quantizor.dev will not be rendered as an anchor tag.',
{ disableAutoLink: true }
)
// renders:
<span>
The URL https://quantizor.dev will not be rendered as an anchor tag.
</span>
Changelog
7.5.1
Changelog
7.5.0
62a16f3: Allow modifying HTML attribute sanitization when options.sanitizer
is passed by the composer.
By default a lightweight URL sanitizer function is provided to avoid common attack vectors that might be placed into the href
of an anchor tag, for example. The sanitizer receives the input, the HTML tag being targeted, and the attribute name. The original function is available as a library export called sanitizer
.
This can be overridden and replaced with a custom sanitizer if desired via options.sanitizer
:
// sanitizer in this situation would receive:
// ('javascript:alert("foo")', 'a', 'href')
;<Markdown options={{ sanitizer: (value, tag, attribute) => value }}>
{`[foo](javascript:alert("foo"))`}
</Markdown>
// or
compiler('[foo](javascript:alert("foo"))', {
sanitizer: (value, tag, attribute) => value,
})
Changelog
7.4.7