fix(CodeBlock): handle ReactNode children with angle-bracket placeholders#950
Open
mneedham wants to merge 5 commits intoClickHouse:mainfrom
Open
fix(CodeBlock): handle ReactNode children with angle-bracket placeholders#950mneedham wants to merge 5 commits intoClickHouse:mainfrom
mneedham wants to merge 5 commits intoClickHouse:mainfrom
Conversation
…ders JSX parses <placeholder> style content as React elements, causing SyntaxHighlighter to receive objects instead of strings and render [object Object]. Accept ReactNode children and stringify them, reconstructing <tag> syntax for element nodes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
punkbit
requested changes
Mar 25, 2026
Collaborator
punkbit
left a comment
There was a problem hiding this comment.
@mneedham thanks for your contribution, mind add the missing changeset? Check https://github.com/clickHouse/click-ui?tab=readme-ov-file#add-a-new-changeset
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.
Summary
childrenprop type fromstringtoReactNodeinCodeBlock.types.tsnodeToString()helper that recursively convertsReactNodeto a plain string, reconstructing<tag>syntax for React element nodeschildrenas a string now go throughnodeToString(children)Problem
When code content contains
<placeholder>style text (e.g. shell scripts with<project_id>,<email>), JSX parses those as React elements rather than raw text.SyntaxHighlighterthen receives objects instead of a string and renders[object Object]throughout the block.Test plan
<placeholder>style content and verify it renders literally$VARIABLEstyle content still renders as-is🤖 Generated with Claude Code