Repository navigation
fix(ui): render formatting inside markdown link labels - #54451
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
The fix works and looks sound. I ran the new test cases against the base: all four formatting cases fail there and pass with this change. The packages/ui marked tests (109) and its typecheck pass. I also checked a few edge cases (an image inside a link, inline HTML around and inside link labels) and they render correctly. Labels now go through the inline parser, so HTML inside a code span in a label is escaped instead of passed through raw.
Public API: unchanged.
No concerns.
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.
Why
Link labels containing bold or inline code display literal Markdown markers in session responses. For example, a linked PR number written as
[**`#123`**](https://github.com/example/project/pull/123)shows the asterisks and backticks instead of formatting the label.What Changes
Render each link's inline tokens through the existing Markdown parser. Bold, code, emphasis, strikethrough, and escaped punctuation now render inside link labels while preserving the link's destination and application attributes.
Demo
Before (left) and after (right), captured from the production session Markdown component in its Storybook harness using the same fictional PR links. The baseline is
e31136bdbd; screenshots are cropped at native CSS-pixel size, with comparison labels added above them. This demonstrates the shared renderer, not a native Desktop launch.Scope
The shared Markdown link renderer used by both small-message and worker parsing. No session-data migration is needed.
Verification
109 tests pass. Four new formatting cases fail against the baseline; all pass after the fix. Changed-file lint reports no problems, and all 36 repository typecheck tasks pass. The browser comparison confirms nested bold/code and emphasis reach the rendered DOM. The tunneled Storybook preview lacks HMR; each capture used a full reload.