Releases: quantizor/markdown-to-jsx
v8.0.0
+--------------------------+------------------------+-----------------------+
|                          │ simple markdown string │ large markdown string |
+--------------------------+------------------------+-----------------------+
| markdown-to-jsx (next)   │ 116,892 ops/sec        │ 757 ops/sec           |
+--------------------------+------------------------+-----------------------+
| markdown-to-jsx (7.7.16) │ 110,756 ops/sec        │ 739 ops/sec           |
+--------------------------+------------------------+-----------------------+
Major Changes
- 
450d2bb: Added astoption to compiler to expose the parsed AST directly. Whenast: true, the compiler returns the AST structure (ASTNode[]) instead of rendered JSX.Breaking Changes: - The internal type ParserResulthas been renamed toASTNodefor clarity. If you were accessing this type directly (e.g., via module augmentation or type manipulation), you'll need to update references fromMarkdownToJSX.ParserResulttoMarkdownToJSX.ASTNode.
 First time the AST is accessible to users! This enables: - AST manipulation and transformation before rendering
- Custom rendering logic without parsing
- Caching parsed AST for performance
- Linting or validation of markdown structure
 Usage: import { compiler } from 'markdown-to-jsx' import type { MarkdownToJSX } from 'markdown-to-jsx' // Get the AST structure const ast: MarkdownToJSX.ASTNode[] = compiler('# Hello world', { ast: true, }) // Inspect/modify AST console.log(ast) // Array of parsed nodes // Render AST to JSX using createRenderer (not implemented yet) The AST format is MarkdownToJSX.ASTNode[].
- The internal type 
- 
3fa0c22: Refactored inline formatting parsing to eliminate ReDoS vulnerabilities and improve performance. The previous regex-based approach was susceptible to exponential backtracking on certain inputs and had several edge case bugs with nested formatting, escaped characters, and formatting inside links. The new implementation uses a custom iterative scanner that runs in O(n) time and is immune to ReDoS attacks. This also consolidates multiple formatting rule types into a single unified rule with boolean flags, reducing code duplication and bundle size. Performance has improved measurably on simple markdown strings: Breaking Changes: The following RuleTypeenum values have been removed and consolidated into a singleRuleType.textFormatted:- RuleType.textBolded
- RuleType.textEmphasized
- RuleType.textMarked
- RuleType.textStrikethroughed
 If you're using these rule types directly (e.g., for custom AST processing or overrides), you'll need to update your code to check for RuleType.textFormattedinstead and inspect the node's boolean flags (bold,italic,marked,strikethrough) to determine which formatting is applied.
Minor Changes
- 
a421067: fix: overhaul HTML block parsing to eliminate exponential backtracking Replaced the complex nested regex HTML_BLOCK_ELEMENT_Rwith an efficient iterative depth-counting algorithm that maintains O(n) complexity. The new implementation uses stateful regex matching withlastIndexto avoid exponential backtracking on nested HTML elements while preserving all existing functionality.Performance improvements: - Eliminates O(2^n) worst-case exponential backtracking
- Linear O(n) time complexity regardless of nesting depth
 
Patch Changes
- 
e6b1e14: Fix renderer crash on extremely deeply nested markdown content Previously, rendering markdown with extremely deeply nested content (e.g., thousands of nested bold markers like ****************...text...****************) would cause a stack overflow crash. The renderer now gracefully handles such edge cases by falling back to plain text rendering instead of crashing.Technical details: - Added render depth tracking to prevent stack overflow
- Graceful fallback at 2500 levels of nesting (way beyond normal usage)
- Try/catch safety net as additional protection for unexpected errors
- Zero performance impact during normal operation
- Prevents crashes while maintaining O(n) parsing complexity
 This fix ensures stability even with adversarial or malformed inputs while having no impact on normal markdown documents. 
- 
fe95c02: Remove unnecessary wrapper when footnotes are present. 
v7.7.17
Patch Changes
- 
acc11ad: Fix null children crashing app in production When nullis passed as children to the<Markdown>component, it would previously crash the app in production. This fix handles this case by converting it to empty string.Usage ExampleBefore this fix, the following code would crash in production: <Markdown>{null}</Markdown> After this fix, this case is handled gracefully and renders nothing. 
v7.7.16
v7.7.15
v7.7.14
+--------------------------+------------------------+-----------------------+
|                          │ simple markdown string │ large markdown string |
+--------------------------+------------------------+-----------------------+
| markdown-to-jsx (next)   │ 107,013 ops/sec        │ 709 ops/sec           |
+--------------------------+------------------------+-----------------------+
| markdown-to-jsx (7.7.13) │ 102,934 ops/sec        │ 396 ops/sec           |
+--------------------------+------------------------+-----------------------+
Patch Changes
- 73d4398: Cut down on unnecessary matching operations by improving qualifiers. Also improved the matching speed of paragraphs, which led to a roughly 2x boost in throughput for larger input strings.
v7.7.13
v7.7.12
v7.7.11
v7.7.10
v7.7.9
+--------------------------+------------------------+-----------------------+
|                          │ simple markdown string │ large markdown string |
+--------------------------+------------------------+-----------------------+
| markdown-to-jsx (7.7.9)  │ 103,280 ops/sec        │ 403 ops/sec           |
+--------------------------+------------------------+-----------------------+
| markdown-to-jsx (7.7.8)  │ 101,922 ops/sec        │ 401 ops/sec           |
+--------------------------+------------------------+-----------------------+