Skip to content

Fix ANSI rendering of escaped log text - #1358

Open
Ashuthosh0 wants to merge 3 commits into
jenkinsci:mainfrom
Ashuthosh0:fix/ansi-escaped-arrow
Open

Fix ANSI rendering of escaped log text#1358
Ashuthosh0 wants to merge 3 commits into
jenkinsci:mainfrom
Ashuthosh0:fix/ansi-escaped-arrow

Conversation

@Ashuthosh0

Copy link
Copy Markdown

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 :

image

After :

image

Testing done

Reproduced locally and ran existing tests.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@Ashuthosh0
Ashuthosh0 requested a review from a team as a code owner June 26, 2026 12:51
@steffencircle

Copy link
Copy Markdown

Hi,

since we are trying to move away from Blue Ocean, any chance this could be looked at ?

@Ashuthosh0

Copy link
Copy Markdown
Author

@timja hey tim, know u might be occupied with other things but could you please take a look at this PR

@timja

timja commented Jul 23, 2026

Copy link
Copy Markdown
Member

The build is failing, if I see a failing build I assume a pull request is still a work in progress.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 by linkifyHtml() are decoded.
  • Add a key prop 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}`}
/>,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform plan output is not correctly rendered

4 participants