Skip to content

Markdown viewer: platform key glyphs in <kbd> keycaps (Cmd → ⌘) #13913

Closed

Description

@fbartho

Summary

Once <kbd> renders as a keycap badge (#13733), a natural refinement is rendering recognized key names as their platform symbols — <kbd>Cmd</kbd> → ⌘, plus ⌥ ⌃ ⇧ and the enter/backspace/arrow/escape glyphs Warp's own shortcut display already maps (Key::text() in ui_components/keyboard_shortcut.rs, platform-gated). Browsers and GitHub don't substitute — this is a deliberate Warp-native touch matching how Warp renders its own shortcuts.

Why this is its own issue

Substitution changes rendered character count ("Cmd" is 3 chars, "⌘" is 1), and the render surfaces assume rendered↔source characters map 1:1 for cursor placement, selection highlighting, and copy. Doing this correctly requires range-remapping infrastructure along the lines of what secret-masking ("password" → "•••") uses — a focused, reviewable change to offset-mapping code, not a rider on the base keycap PR. Scoping substitution to read-only surfaces only was considered and rejected (the same source would render differently across surfaces).

Expected behavior

  • Recognized key names render as their platform glyph inside keycaps at render time only; unrecognized names render literally.
  • Copy/export always yields the authored text (<kbd>Cmd</kbd> stays "Cmd") — Markdown viewer: support <kbd> keyboard-shortcut styling #13733 already lands a round-trip test pinning this invariant.
  • Cursor/selection/copy offsets remain exact across substituted runs.

Related: #13733 (base keycap support), #13912 (depth-aware nested kbd), #13652 (original raw-HTML umbrella).

Activity

  1. warp-for-oss commented on Jul 17, 2026

    @warp-for-oss
    Contributor

    @fbartho

    Here's what I found while triaging this issue:

    This appears to be a distinct markdown-viewer enhancement layered on top of #13733, not a duplicate of the related nested-keycap work in #13912. The expected behavior is specific enough that no reporter follow-up is needed for initial triage.

    Maintainer details

    I concluded that request to render recognized key names inside markdown <kbd> keycaps as platform glyphs while preserving source-text copy/selection offsets..

    Triage

    This is a well-scoped markdown viewer enhancement request: after base <kbd> keycap rendering, recognized key names such as Cmd, Option, Ctrl, Shift, arrows, enter, backspace, and escape should render as platform glyphs inside keycaps while copy/export preserves the authored text.

    The nearest existing issues are related but not duplicates: #13733 covers base <kbd> keycap styling, #13912 covers depth-aware nested <kbd> for compound shortcuts, and #13652 was the broader raw-HTML umbrella. This issue is specifically about platform-key glyph substitution and offset-preserving selection/copy behavior.

    Likely implementation areas are the markdown parser/formatted-text conversion, text-style/rendering model, selection/copy offset mapping, and the existing keyboard shortcut glyph mapping code. The main technical risk is maintaining exact rendered-to-source mappings when a multi-character authored key name renders as a single glyph.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  2. added
    area:editor-notebooks
    enhancement
    repro:high
    triaged
    on Jul 17, 2026
  3. kevinyang372 commented on Jul 20, 2026

    @kevinyang372
    Member

    @fbartho This should be part of the implementation for #13733

  4. fbartho commented on Jul 20, 2026

    @fbartho
    ContributorAuthor

    Hey @kevinyang372 thanks! I was unsure if this feature was out-of-scope for the project, so I didn’t want #13733 to be blocked on that conversation.

    With your permission granted here, I’ll just fold that work into #13733’s PR.

  5. fbartho commented on Jul 20, 2026

    @fbartho
    ContributorAuthor

    I've decided to pause on the glyph work after diving into what would be necessary to support it. Substituting ⌘ for "Cmd" would be the markdown viewer's first case where rendered glyphs diverge from the underlying buffer text, so selection/copy/click offset handling throughout the render path would need new remapping machinery. As a result that felt like too much impact for a delightful flourish at this time.

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

Metadata

Metadata

Assignees

Labels

area:editor-notebooksenhancementrepro:hightriagedwarp:auto-triage-review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions