From 8fee6a86c23b0014cd10eea4cb6c74e0d4bf2af2 Mon Sep 17 00:00:00 2001 From: claude_code Date: Thu, 25 Jun 2026 10:53:58 +0300 Subject: [PATCH] fix(ai-chat): style GFM tables in assistant chat markdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assistant answers containing GFM tables rendered badly in the narrow AI side panel: `.markdown` only styled p/pre/code/ul/ol and had no table rules, so tables used the browser default `table-layout: auto`. Combined with the inherited `word-break: break-word`, columns collapsed to a single glyph and headers wrapped mid-word ("Секция" -> "Секци / я"). Add table styling scoped to `.markdown`, in line with the editor's table.css house style: - make the table a horizontally scrollable block (display:block + overflow-x:auto) so wide tables scroll instead of squishing; - give cells a 6em min-width and restore word-boundary wrapping (word-break:normal + overflow-wrap:break-word); - add 1px borders, padding and a th background (light-dark for dark mode); zero out the default

margin inside cells. CSS-only; no markdown-pipeline change (marked already emits GFM tables, DOMPurify already allows table tags). Applies to the public share too. Co-Authored-By: Claude Opus 4.8 --- .../ai-chat/components/ai-chat.module.css | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/apps/client/src/features/ai-chat/components/ai-chat.module.css b/apps/client/src/features/ai-chat/components/ai-chat.module.css index 6b7aac64..71cc0e9d 100644 --- a/apps/client/src/features/ai-chat/components/ai-chat.module.css +++ b/apps/client/src/features/ai-chat/components/ai-chat.module.css @@ -55,6 +55,45 @@ padding-inline-start: 1.4em; } +/* GFM tables in assistant markdown. The chat lives in a NARROW side panel, so a + wide LLM table must scroll horizontally instead of collapsing its columns: + `.markdown` sets `word-break: break-word`, which (with the default table + layout) shrinks columns to a single glyph and wraps headers mid-word + ("Секция" -> "Секци / я"). Make the table a horizontally scrollable block, + give cells a readable minimum width, and restore word-boundary wrapping. */ +.markdown table { + display: block; + /* lets the table scroll horizontally on its own */ + max-width: 100%; + overflow-x: auto; + border-collapse: collapse; + margin-block-end: 0.5em; +} + +.markdown th, +.markdown td { + border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4)); + padding: 3px 8px; + /* readable floor; the block scrolls when the row exceeds the panel */ + min-width: 6em; + text-align: left; + vertical-align: top; + /* cancel the inherited break-word so words don't split mid-glyph */ + word-break: normal; + /* still wrap genuinely long words / URLs at the cell edge */ + overflow-wrap: break-word; +} + +.markdown th { + background: light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-5)); + font-weight: 600; +} + +/* GFM wraps cell text in

; drop its default block margin inside cells. */ +.markdown table p { + margin: 0; +} + /* Animated three-dot "typing" indicator shown while the agent is thinking but has not yet produced any visible text/tool parts. */ .typingDots {