chore(deps): update dependency markdown-to-jsx to v9 #6977
+5
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^7.7.6->^9.5.0Release Notes
quantizor/markdown-to-jsx (markdown-to-jsx)
v9.5.0Compare Source
Minor Changes
7605d88: Add React Server Components (RSC) support with automatic environment detection.The
Markdowncomponent now seamlessly works in both RSC and client-side React environments without requiring 'use client' directives. The component automatically detects hook availability and adapts its behavior accordingly:MarkdownProviderandMarkdownContextgracefully become no-ops in RSC environmentsThis enables better bundle splitting and SSR performance by allowing markdown rendering to happen on the server when possible.
Patch Changes
d2075d2: Fix hard line breaks (two trailing spaces) inside list items not being converted to<br/>.In v9, hard line breaks inside list items were being lost because the first line content and continuation lines were being parsed separately, causing the trailing spaces before the newline to be stripped before the hard break could be detected.
The fix ensures that for tight list items (without blank lines), simple text continuation lines are collected and concatenated with the first line content before parsing. This preserves the trailing spaces + newline sequence that triggers hard break detection.
This fix also handles hard line breaks inside blockquotes that are nested within list items, ensuring the blockquote continuation lines are properly collected together.
Fixes #766.
v9.4.2Compare Source
Patch Changes
775b4bf: ExposeparserandRuleTypefrom the markdown entry point as documented.v9.4.1Compare Source
Patch Changes
7ee8a22: EnsurerenderRulealways executes before any other rendering code across all renderers. TherenderRulefunction now has full control over node rendering, including normally-skipped nodes likeref,footnote, andfrontmatter. Additionally,renderChildrenin the markdown renderer now invokesrenderRulefor recursively rendered child nodes, ensuring consistent behavior when customizing rendering logic.7ee8a22: HTML blocks are now always fully parsed into the ASTchildrenproperty, even when marked asverbatim. Theverbatimflag now acts as a rendering hint rather than a parsing control. Default renderers still userawTextfor verbatim blocks (maintaining CommonMark compliance), butrenderRuleimplementations can now access the fully parsed AST inchildrenfor all HTML blocks. ThenoInnerParseproperty has been replaced withverbatimfor clarity.7ee8a22: AddHTMLNode.rawTextfield for consistency withrawAttrs. TherawTextfield contains the raw text content for verbatim HTML blocks, whilechildrencontains the parsed AST. Thetextproperty is now deprecated and will be removed in a future major version. Both fields are set to the same value for backward compatibility.v9.4.0Compare Source
Minor Changes
c1be885: Added context providers and memoization to all major renderers for better developer experience and performance.React:
MarkdownContext- React context for default optionsMarkdownProvider- Provider component to avoid prop-drillinguseMemo- 3-stage memoization (options, content, JSX)React Native:
MarkdownContext- React context for default optionsMarkdownProvider- Provider component to avoid prop-drillinguseMemo- 3-stage memoization (options, content, JSX)Vue:
MarkdownOptionsKey- InjectionKey for provide/inject patternMarkdownProvider- Provider component using Vue's providecomputed- Reactive memoization for options, content, and JSXBenefits:
Example:
ef8a002: Added opt-inoptions.evalUnserializableExpressionsto eval function expressions and other unserializable JSX props from trusted markdown sources.This option uses
eval()and should ONLY be used with completely trusted markdown sources (e.g., your own documentation). Never enable this for user-submitted content.Usage:
Safer alternative: Use
renderRuleto handle stringified expressions on a case-by-case basis with your own validation and allowlists.See the README for detailed security considerations and safe alternatives.
ef8a002: JSX prop values are now intelligently parsed instead of always being strings:JSON.parse():data={[1, 2, 3]}→attrs.data = [1, 2, 3]enabled={true}→attrs.enabled = trueonClick={() => ...}→attrs.onClick = "() => ..."value={someVar}→attrs.value = "someVar"The original raw attribute string is preserved in the
rawAttrsfield.Benefits:
Example:
Security: Functions remain as strings by default. Use
renderRulefor case-by-case handling, or see the newoptions.evalUnserializableExpressionsfeature for opt-in eval (not recommended for user inputs).Patch Changes
ef8a002: JSX components with double-newlines (blank lines) between opening and closing tags now properly nest children instead of creating sibling nodes. This fixes incorrect AST structure for JSX/MDX content.Before:
Parsed as 3 siblings:
<Figure>,<div>,</Figure>After:
Parsed as parent-child:
<Figure>contains<div>as a childThis was a bug where the parser incorrectly treated JSX components as siblings when double-newlines were present between the tags. The fix ensures proper parent-child relationships match expected JSX/MDX semantics.
v9.3.5Compare Source
Patch Changes
08dfe8a: Fix regression: Tables within list items are now properly parsed.v9.3.4Compare Source
Patch Changes
c5b6259: Fixed URIError when parsing HTML attributes containing the % character (e.g.,width="100%"). The parser now gracefully handles invalid URI encodings in attribute values instead of throwing an error.v9.3.3Compare Source
Patch Changes
7ac3408: Restore angle-bracket autolinks when raw HTML parsing is disabled so<https://...>still renders as links7ac3408: Improve autolink parsing: stricter angle controls, domain underscore validation, and added coverage for mailto labels and raw-HTML-disabled cases.v9.3.2Compare Source
Patch Changes
a84c300: Ensure Solid renderer uses Solid's hyperscript runtime so JSX returns real elements instead of[object Object]placeholdersv9.3.1Compare Source
Patch Changes
c1b0ea2: Fix unintended node-specific code from entering browser bundles by changing build target from 'node' to 'browser'v9.3.0Compare Source
Minor Changes
a482de6: Add SolidJS integration with full JSX output support. Includes compiler, parser, astToJSX, and Markdown component with reactive support via signals/accessors.f9a8fca: Add Vue.js 3+ integration. Includescompiler,parser,astToJSX, andMarkdowncomponent. Vue uses standard HTML attributes (class, not className) with minimal attribute mapping (only 'for' -> 'htmlFor').Patch Changes
2bb3f2b: Fix AST and options mutation bugs that could cause unexpected side effects when using memoization or reusing objects across multiple compiler calls.v9.2.0Compare Source
Minor Changes
88d4b1f: Add comprehensive React Native support with new/nativeexport. Includes:img→Image, block elements (div,section,article,blockquote,ul,ol,li,table, etc.) →View, and inline elements →TextonLinkPressandonLinkLongPresscallbacks, defaulting toLinking.openURLNativeStyleKeytype system with styles for all markdown elements and HTML semantic tagsaccessibilityLabelfor images and proper link handlingNativeOptionsandNativeStyleKeytypesReact Native is an optional peer dependency, making this a zero-dependency addition for existing users.
v9.1.2Compare Source
Patch Changes
f93214a: Fix infinite recursion when usingforceBlock: truewith empty unclosed HTML tagsWhen
React.createElement(Markdown, {options: {forceBlock: true}}, '<var>')was called with an empty unclosed tag, it would cause infinite recursion. The parser would set thetextfield to the opening tag itself (e.g.,<var>), which would then be parsed again in the rendering phase, causing recursion.This fix adds detection in
createVerbatimHTMLBlockto detect whenforceBlockis used and the text contains just the opening tag (empty unclosed tag), rendering it as an empty element to prevent recursion.v9.1.1Compare Source
Patch Changes
733f10e: Fix lazy continuation lines for list items when continuation text appears at base indentation without a blank line. Previously, continuation text was incorrectly appended inline to the list item. Now both the existing inline content and the continuation text are properly wrapped in separate paragraphs.v9.1.0Compare Source
Minor Changes
0ba757d: AddpreserveFrontmatteroption to control whether YAML frontmatter is rendered in the output. When set totrue, frontmatter is rendered as a<pre>element in HTML/JSX output. For markdown-to-markdown compilation, frontmatter is preserved by default but can be excluded withpreserveFrontmatter: false.preserveFrontmatter: truepreserveFrontmatter: false<pre>elementPatch Changes
f945132: Fix lazy continuation lines for list items when continuation text appears at base indentation without a blank line before it. Previously, such lines were incorrectly parsed as separate paragraphs instead of being appended to the list item content.36ef089: yWork around a bundling bug with exporting TypeScript namespaces directly. Bonus: MarkdownToJSX is now declared ambiently so you may not need to import it.v9.0.0Compare Source
Major Changes
1ce83eb: Complete GFM+CommonMark specification compliance<script>,<iframe>, etc.) in both HTML string output and React JSX outputjavascript:,vbscript:, and maliciousdata:URLsDefault filtering of dangerous HTML tags:
<script>,<iframe>,<object>,<embed><title>,<textarea>,<style>,<xmp><plaintext>,<noembed>,<noframes>v8.0.0Compare Source
Major Changes
450d2bb: Addedastoption to compiler to expose the parsed AST directly. Whenast: true, the compiler returns the AST structure (ASTNode[]) instead of rendered JSX.Breaking Changes:
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:
Usage:
The AST format is
MarkdownToJSX.ASTNode[]. When footnotes are present, the returned value will be an object withastandfootnotesproperties instead of just the AST array.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.textBoldedRuleType.textEmphasizedRuleType.textMarkedRuleType.textStrikethroughedIf 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 backtrackingReplaced 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:
Patch Changes
e6b1e14: Fix renderer crash on extremely deeply nested markdown contentPreviously, 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:
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.17Compare Source
Patch Changes
acc11ad: Fix null children crashing app in productionWhen
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 Example
Before this fix, the following code would crash in production:
After this fix, this case is handled gracefully and renders nothing.
v7.7.16Compare Source
Patch Changes
7e487bd: Fix the issue where YAML frontmatter in code blocks doesn't render properly.This is done by lowering the parsing priority of Setext headings to match ATX headings; both are now prioritized lower than code blocks.
v7.7.15Compare Source
Patch Changes
8e4c270: Mark react as an optional peer dependency as when passing createElement, you don't need Reactv7.7.14Compare Source
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.13Compare Source
Patch Changes
da003e4: Fix exponential backtracking issue for unpaired inline delimiter sequences.v7.7.12Compare Source
Patch Changes
4351ef5: Adjust text parsing to not split on double spaces unless followed by a newline.4351ef5: Special case detection of :shortcode: so the text processor doesn't break it into chunks, enables shortcode replacement via renderRule.v7.7.11Compare Source
Patch Changes
4a692dc: Fixes the issue where link text containing multiple nested brackets is not parsed correctly.Before:
[title[bracket1][bracket2]](url)fails to parse as a linkAfter:
[title[bracket1][bracket2]](url)correctly parses as a linkv7.7.10Compare Source
Patch Changes
bf9dd3d: Unescape content intended for JSX attributes.v7.7.9Compare Source
Patch Changes
95dda3e: Avoid creating unnecessary paragraphs inside of HTML.95dda3e: Fix HTML parser to avoid processing the inside of<pre>blocks.v7.7.8Compare Source
Patch Changes
db378c7: Implement early short-circuit for rules to avoid expensive throwaway work.db378c7: Simpler fix that preserves existing performance.db378c7: Various low-hanging minor performance enhancements by doing less work.db378c7: Improve compression by inlining static RuleType entries when used in the codebase.v7.7.7Compare Source
Patch Changes
89c87e5: Handle spaces in text as a stop token to improve processing, also adapt paragraph detection to exclude non-atx compliant headings if that option is enabled.Fixes #680
Configuration
📅 Schedule: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.