Skip to content

fix(ui): render formatting inside markdown link labels - #54451

Merged
Hona merged 1 commit into
devfrom
link-label-format
Oct 11, 2026
Merged

Hona merged 1 commit into
devfrom
link-label-format

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

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.

Link labels before and after

Scope

The shared Markdown link renderer used by both small-message and worker parsing. No session-data migration is needed.

Verification

# packages/ui
bun test src/context/marked-base.test.ts src/context/marked-parser.test.ts src/context/marked-regression.test.ts

# Repository root
bun run lint:changed
bun run check

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.

@opencode-agent opencode-agent Bot 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.

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.

@Hona
Hona merged commit d21b079 into dev Oct 11, 2026
11 of 12 checks passed
@Hona
Hona deleted the link-label-format branch October 11, 2026 09:27
wr-web pushed a commit to wr-web/opencode that referenced this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants