fix: forward rest props through block code - #585
Merged
Merged
Conversation
Contributor
|
Someone is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
lofcz
referenced
this pull request
in lofcz/streamdown-ng
Aug 19, 2026
dasheidt
force-pushed
the
fix/block-code-rest-props
branch
from
August 20, 2026 12:14
ececc1b to
3bc39c3
Compare
Contributor
Author
|
Rebased onto Full suite green (79 files, 1074 tests). Still independent of #584 and reviewable in either order. |
farnabaz
force-pushed
the
fix/block-code-rest-props
branch
from
August 21, 2026 11:30
3bc39c3 to
b53ab06
Compare
The `code` component spreads `...props` on its inline branch and passes a hand-picked set of props on its block branch, so an attribute a consumer puts on a fenced code element — via a rehype plugin, the supported way to annotate rendered output — reaches inline code and silently disappears on code blocks. The two branches of one component disagree about whether consumer props exist. Forward them on the block branch too, minus `data-block`, which is the marker the custom `pre` component sets to identify a fenced block and is internal. `CodeBlock` already spreads its rest onto the code-block body, whose text is exactly the code — the header label and the copy/download controls are siblings — so the props land on the element they describe. `CodeBlockBody`'s comparator listed five props by hand and ignored the rest, which meant a forwarded attribute kept the value it first rendered with. Its custom comparator is now removed: React's default shallow comparison already compares `result` by reference, so an unchanged code string still does not re-highlight, and it covers the forwarded props as well. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Ian Heidt <71056976+dasheidt@users.noreply.github.com>
farnabaz
force-pushed
the
fix/block-code-rest-props
branch
from
August 21, 2026 11:32
b53ab06 to
b0813c9
Compare
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.
The asymmetry
CodeComponenthas two branches. The inline branch spreads its rest props:The block branch passes a hand-picked six and drops the rest:
So an attribute a consumer puts on a
codeelement — via a rehype plugin, which is the supported way to annotate rendered output — reaches inline code and silently disappears on code blocks. One component, two branches, disagreeing about whether consumer props exist.On
main, this document stamps twocodeelements and exactly one stamp survives: