Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #947 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 3 3
Lines 1778 1941 +163
Branches 119 127 +8
==========================================
+ Hits 1778 1941 +163 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
remcohaszing
requested changes
Nov 19, 2026
remcohaszing
left a comment
Member
There was a problem hiding this comment.
I have just one comment, but otherwise this looks good. Thanks!
Comment on lines
+232
to
+236
| Pass plugins, `remarkRehypeOptions`, `allowedElements`, `disallowedElements`, | ||
| `allowElement`, and `urlTransform` as stable references, | ||
| for example by defining them outside your component. | ||
| A new value on each render processes the markdown again. | ||
|
|
Member
There was a problem hiding this comment.
This is a fairly basic React knowledge. It also applies only to client components, not to server components. It’s not specific to react-markdown, so I don’t think we need to mention it. It’s also solved by the React compiler, which makes it even more situational.
Suggested change
| Pass plugins, `remarkRehypeOptions`, `allowedElements`, `disallowedElements`, | |
| `allowElement`, and `urlTransform` as stable references, | |
| for example by defining them outside your component. | |
| A new value on each render processes the markdown again. |
remcohaszing
approved these changes
Nov 19, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Initial checklist
Description of changes
This continues OskarEichler's report and implementation in #944, particularly commits
13576306,a6e6651c,fa82e404and36cbbac7. Thelib/index.jschange is essentially his. This adds eight regression tests and a readme note; his PR closed before the later commits received review.MarkdownHookskeeps a processed tree in state, butpostmutates it on every render. A transform such asurl => '/proxy' + urlaccumulates prefixes, and removing a filter cannot restore nodes already removed from the tree. StrictMode also exposes the repeated transform on the initial render.The URL and element visitor moves into an internal rehype plugin after the user's rehype plugins. The processor memo includes all six URL and filter props. The conflicting
allowedElements/disallowedElementscheck stays inpost, after the deprecation checks and before JSX conversion. With invalid props, URL or element callbacks can now run beforepostthrows.Changing those processing props reruns the pipeline, including async plugins. Functions and arrays need stable references to avoid processing on every parent render; the readme note covers these inputs alongside plugins and
remarkRehypeOptions.All eight new regression cases fail against the original source and pass with the fix. The recorded
npm testrun passes with 99 tests and 100% runtime and type coverage.AI assistance: Codex (gpt-6.1-sol) prepared the patch, ran the checks and drafted this description, and Claude Opus 5.5 reviewed the change independently. I've read and verified the diff myself.
Co-authored-by: Oskar Eichler 62393985+OskarEichler@users.noreply.github.com