Releases: quantizor/markdown-to-jsx
v7.4.7
Patch Changes
- 7603248: Fix parsing isolation of individual table cells.
- f9328cc: Improved block html detection regex to handle certain edge cases that cause extreme slowness. Thank you @devbrains-com for the basis for this fix 🤝
v7.4.6
Patch Changes
-
a9e5276: Browsers assign element with
id
to the global scope using the value as the variable name. E.g.:<h1 id="analytics">
can be referenced viawindow.analytics
.
This can be a problem when a name conflict happens. For instance, pages that expectanalytics.push()
to be a function will stop working if the an element with anid
ofanalytics
exists in the page.In this change, we export the
slugify
function so that users can easily augment it.
This can be used to avoid variable name conflicts by giving the element a differentid
.import { slugify } from 'markdown-to-jsx'; options={{ slugify: str => { let result = slugify(str) return result ? '-' + str : result; } }}
v7.4.5
Patch Changes
-
f5a0079: fix: double newline between consecutive blockquote syntax creates separate blockquotes
Previously, for consecutive blockquotes they were rendered as one:
Input
> Block A.1 > Block A.2 > Block B.1
Output
<blockquote> <p>Block A.1</p> <p>Block A.2</p> <p>Block.B.1</p> </blockquote>
This is not compliant with the GFM spec which states that consecutive blocks should be created if there is a blank line between them.
v7.4.4
What's Changed
- Brackets in link text by @zegl in #551
- Multiline footnotes by @zegl in #553
- fix: multi-line emphasis by @austingreco in #550
- fix: gracefully handle missing image references by @quantizor in #554
- chore: add changesets by @quantizor in #555
- fix: handle newlines inside HTML tag brackets by @quantizor in #557
- fix: html block regex prefix conflict by @quantizor in #558
- Version Packages by @github-actions in #556
New Contributors
- @zegl made their first contribution in #551
- @austingreco made their first contribution in #550
- @github-actions made their first contribution in #556
Full Changelog: v7.4.3...v7.4.4
v7.4.3
v7.4.2
v7.4.1
v7.4.0
Happy New Year! 🎆
markdown-to-jsx v7.4 features a new option renderRule
! — From the README:
Supply your own rendering function that can selectively override how rules are rendered (note, this is different than options.overrides
which operates at the HTML tag level and is more general). You can use this functionality to do pretty much anything with an established AST node; here's an example of selectively overriding the "codeBlock" rule to process LaTeX syntax using the @matejmazur/react-katex
library:
import { Markdown, RuleType } from 'markdown-to-jsx'
import TeX from '@matejmazur/react-katex'
const exampleContent =
'Some important formula:\n\n```latex\nmathbb{N} = { a in mathbb{Z} : a > 0 }\n```\n'
function App() {
return (
<Markdown
children={exampleContent}
options={{
renderRule(next, node, renderChildren, state) {
if (node.type === RuleType.codeBlock && node.lang === 'latex') {
return (
<TeX as="div" key={state.key}>{String.raw`${node.text}`}</TeX>
)
}
return next()
},
}}
/>
)
}
The README docs around syntax highlighting have also been updated with sample code.
With the new year comes a push toward v8. Performance will be a top priority, reducing the complexity of the library's regexes to increase throughput for SSR use-cases and ideally eliminate rare but frustrating issues like catastrophic backtracking. In addition, the library will be pivoting into more of a pure compiler model, with a React adapter offered and ones added for other major frameworks as well. The idea is anywhere you can run JS, you can use [secret new library name].
Stay tuned and thanks for being part of the journey ✌🏼
Here's to a great 2024 🍾
markdown-to-jsx is maintained by @quantizor, buy him a coffee
Full Changelog: v7.3.2...v7.4.0
v7.3.2
fix(types): path to esm types in "exports"
Full Changelog: v7.3.1...v7.3.2