From c50de49a59ca015022fd4264eb50e4f3bf6ea2ab Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Thu, 18 Jun 2026 21:27:22 +0100 Subject: [PATCH] style(ui): align markdown code block chrome Update fenced markdown code blocks to use square corners and compact headers matching the tool-call code output treatment. The shared markdown styles now remove code block radii, shrink the header to the same 1.6rem control height, and restyle the copy action as a compact icon-only header button while keeping the accessible copy label available to screen readers. Validated with npm run build:ui; Vite completed successfully with existing warnings about JSX import source, mixed static/dynamic imports, and large chunks. --- packages/ui/src/styles/markdown.css | 61 ++++++++++++++++++----------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/packages/ui/src/styles/markdown.css b/packages/ui/src/styles/markdown.css index 6c4341e0..5e95c471 100644 --- a/packages/ui/src/styles/markdown.css +++ b/packages/ui/src/styles/markdown.css @@ -227,7 +227,7 @@ .markdown-code-block { position: relative; margin: 10px 0; - border-radius: 6px; + border-radius: 0; background-color: var(--surface-muted); border: 1px solid var(--border-base); } @@ -236,52 +236,63 @@ display: flex; align-items: center; justify-content: space-between; - padding: 4px 8px; + min-height: 1.6rem; + padding: 0 0 0 var(--space-sm); background-color: var(--surface-secondary); border-bottom: 1px solid var(--border-base); - /* border-top-left-radius: 6px; - border-top-right-radius: 6px; */ } .code-block-language { - font-family: var(--font-family-mono); - color: var(--text-secondary); + font-family: var(--message-part-header-font-family); + color: var(--text-primary); text-transform: uppercase; - letter-spacing: 0.04em; - font-size: var(--font-size-sm); + letter-spacing: normal; + font-size: var(--message-part-header-type-font-size); + font-weight: var(--message-part-header-type-font-weight); + line-height: var(--message-part-header-title-line-height); } .code-block-copy { - display: flex; + display: inline-flex; align-items: center; - gap: 4px; - padding: 4px 8px; + justify-content: center; + gap: 0; + width: 1.6rem; + height: 1.6rem; + padding: 0; background-color: transparent; - border: 1px solid var(--border-base); - border-radius: 4px; + border: none; + border-radius: 0.25rem; cursor: pointer; color: var(--text-secondary); + flex: 0 0 auto; transition: background-color 150ms ease, - color 150ms ease, - border-color 150ms ease; + color 150ms ease; margin-inline-start: auto; - font-size: var(--font-size-sm); + margin-inline-end: var(--space-sm); } .code-block-copy:hover { - background-color: var(--surface-hover); - border-color: var(--accent-primary); - color: var(--accent-primary); + background-color: transparent; + color: var(--text-primary); } .code-block-copy .copy-icon { - width: 14px; - height: 14px; + width: 0.875rem; + height: 0.875rem; } .code-block-copy .copy-text { - font-family: var(--font-family-mono); + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; } .markdown-code-block pre { @@ -289,7 +300,11 @@ padding: 12px !important; overflow-x: auto; background-color: transparent !important; - border-radius: 0; + border-radius: 0 !important; + } + + .markdown-code-block .shiki { + border-radius: 0 !important; } .markdown-code-block code {