Fix ANSI rendering of escaped log text - #1358
Open
Ashuthosh0 wants to merge 3 commits into
Open
Conversation
|
Hi, since we are trying to move away from Blue Ocean, any chance this could be looked at ? |
Author
|
@timja hey tim, know u might be occupied with other things but could you please take a look at this PR |
Member
|
The build is failing, if I see a failing build I assume a pull request is still a work in progress. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the frontend ANSI-rendering path so ANSI-colored console log text is rendered consistently with unstyled log text after linkifyHtml() escaping (e.g., ensuring > displays as >), addressing the rendering issue described in #1355.
Changes:
- Render ANSI-styled token text using
dangerouslySetInnerHTML(instead of plain React text) so HTML entities produced bylinkifyHtml()are decoded. - Add a
keyprop to the ANSI-styled<span>elements in the token rendering loop.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+283
to
+287
| <span | ||
| className={classNames.join(" ")} | ||
| dangerouslySetInnerHTML={{ __html: codeOrString }} | ||
| key={`${key}-${i}`} | ||
| />, |
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.
Fixes #1355
What caused the issue :
ANSI-colored log text was rendered differently from unstyled log text after linkifyHtml() escaped
>as>.Unstyled logs were rendered as HTML.
ANSI-styled logs were rendered as plain React text.
This caused colored terminal output to show
->instead of->.Where the problem is :
In
ConsoleLine.tsx, log content is passed through linkifyHtml() before ANSI tokenization, then Ansi.tsx rendered ANSI-styled text as plain React text.What fix worked :
Updated the ANSI-styled rendering path in Ansi.tsx to render consistently with unstyled log text, so escaped entities are decoded correctly.
Before :
After :
Testing done
Reproduced locally and ran existing tests.
Submitter checklist