Skip to content

Render <kbd> tags with inline-code styling in the Markdown parser - #14510

Open
fbartho wants to merge 2 commits into
warpdotdev:masterfrom
fbartho:fb/13733-kbd-parser
Open

fbartho wants to merge 2 commits into
warpdotdev:masterfrom
fbartho:fb/13733-kbd-parser

Conversation

@fbartho

@fbartho fbartho commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #13733

Recognizes <kbd>...</kbd> keyboard-shortcut tags in the Markdown parser and renders them using the existing inline-code visual treatment, rather than adding a new style marker.

This is a narrower re-scope of my earlier attempt (#13916) per @kevinyang372's feedback there — no changes to the editor buffer model, style markers, serialization, or paste path. <kbd> is parsed as a single atomic span the same way backtick code spans already are, and dispatches to the existing FormattedTextFragment::inline_code, so both the GUI Markdown viewer and the TUI renderer pick up the styling for free through the shared style field — no per-surface wiring needed.

One tradeoff from going this route: <kbd> no longer nests with bold/italic (e.g. <kbd>**Cmd**</kbd> renders as literal text rather than bold-in-a-keycap), since avoiding the delimiter-stack machinery was the point. Tags are also matched exact-case, matching this parser's existing <u>/</u> precedent, rather than case-insensitively.

Testing: cargo nextest run -p markdown_parser (156 passed), -p warp_editor (486 passed, including a new table-cell offset-map regression test for <kbd> spans), -p warp_tui (832 passed); cargo clippy --all-targets --all-features --tests -- -D warnings clean; ./script/format --check clean.

CHANGELOG-IMPROVEMENT: Markdown Viewer now renders <kbd> keyboard-shortcut tags using inline-code styling instead of literal text.

Screenshot now attached:
Screenshot of the kbd-html-tag example rendering correctly

fbartho added 2 commits July 29, 2026 16:21
Parse `<kbd>...</kbd>` keyboard-shortcut tags in Markdown as a single
atomic span (the same way backtick code spans are matched) and render
them using the existing inline-code visual treatment, rather than
introducing a new style marker.

This is a narrower re-scope of warpdotdev#13733 per maintainer feedback on the
prior attempt (warpdotdev#13916): no changes to the editor buffer model, style
markers, serialization, or paste path — parser recognition only, using
FormattedTextFragment::inline_code so both the GUI Markdown viewer and
the TUI renderer pick it up for free through the shared style field.
Regression test adapted from warpdotdev#13916's table_offset_map_tests.rs case,
updated for the inline-code-dispatch design: verifies the table cell
offset map skips <kbd>/</kbd> source markers correctly (mapping
rendered "Press Cmd+K" back to source positions), same as it already
does for backtick code spans and other inline markers.
@cla-bot cla-bot Bot added the cla-signed label Jul 29, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jul 29, 2026
@warp-for-oss

warp-for-oss Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

@fbartho

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

warp-for-oss[bot]
warp-for-oss Bot previously requested changes Jul 29, 2026

@warp-for-oss warp-for-oss 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.

Overview

This PR updates the Markdown parser so exact-case <kbd>...</kbd> spans are parsed as atomic inline-code fragments, with tests covering parser behavior and table-cell offset mapping.

Concerns

  • For this user-facing Markdown rendering change, please include screenshots or a short screen recording demonstrating the rendered <kbd> styling end to end. The PR description says screenshots are still pending, and the provided review artifacts do not include visual evidence.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@fbartho

fbartho commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Screenshot now attached to the description /oz-review

@warp-for-oss

warp-for-oss Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

@fbartho

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @bnavetta.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss
warp-for-oss Bot dismissed their stale review August 4, 2026 23:59

Oz no longer requests changes for this pull request after the latest automated review.

@warp-for-oss warp-for-oss 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.

Overview

This PR updates the Markdown parser to recognize exact-case <kbd>...</kbd> spans as atomic inline-code-styled fragments and adds parser plus table offset-map coverage for the issue case.

Concerns

  • No blocking concerns found. The PR includes screenshot evidence for the user-visible rendering change and focused unit coverage for normal, adjacent, empty, unmatched, and non-nesting <kbd> behavior.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss
warp-for-oss Bot requested a review from bnavetta August 4, 2026 23:59
@fbartho

fbartho commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@bnavetta This PR is still waiting for review. (Just trying to avoid the stale-bot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown viewer: support <kbd> keyboard-shortcut styling

1 participant