Skip to content

feat(markdown): support kbd tag rendering - #4237

Open
heartacker wants to merge 2 commits into
iOfficeAI:mainfrom
heartacker:feat/markdown-kbd-render
Open

feat(markdown): support kbd tag rendering#4237
heartacker wants to merge 2 commits into
iOfficeAI:mainfrom
heartacker:feat/markdown-kbd-render

Conversation

@heartacker

Copy link
Copy Markdown
Contributor

Pull Request

Description

Add support for rendering <kbd> tags in both chat messages and document preview markdown views.

  • Update default rehype plugins pipeline to include rehype-raw with rehype-sanitize allowing <kbd> while keeping malicious scripts/attributes stripped.
  • Add keyboard key styling for .markdown-shadow-body kbd and .aionui-markdown :where(kbd) with subtle borders, background, monospace typography, and light/dark theme adaptability.
  • Add test coverage verifying <kbd> tags are properly preserved in preview and default markdown pipelines.

Related Issues

  • None

Type of Change

  • feat — New feature (non-breaking change which adds functionality)

Atomic PR Checklist (Rule 1)

  • This PR contains exactly one feature or bug fix that cannot be further decomposed
  • The PR title follows Conventional Commit format: <type>(<scope>): <subject> (English)

Local Checks (Rule 3)

  • bun run format — formatting passes
  • bun run lint — no lint errors (skip if no .ts/.tsx changed)
  • bunx tsc --noEmit — no type errors (skip if no .ts/.tsx changed)
  • bunx vitest run — tests pass
  • i18n validated (bun run i18n:types + node scripts/check-i18n.js) — N/A (no user-facing text strings added)
  • New/changed user-facing text uses i18n keys (no hardcoded strings)

Runtime Verification

  • Verified on Linux
  • I have performed a self-review of my own code

@heartacker
heartacker requested a review from IceyLiu as a code owner September 9, 2026 15:47
@heartacker

Copy link
Copy Markdown
Contributor Author

@tcp404 PTAL, thanks!

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...enderer/components/Markdown/markdownComponents.tsx 50.00% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

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.

1 participant