From 5566065033859321b2a7c25f4dfd59fe83655702 Mon Sep 17 00:00:00 2001 From: ajayjha1 Date: Sun, 17 May 2026 14:53:27 +0530 Subject: [PATCH] fix: render markdown tables correctly in chat responses --- .../StyledMarkdownPreview/index.tsx | 24 +++++++++++++++++++ .../utils/remarkTables.tsx | 3 +-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gui/src/components/StyledMarkdownPreview/index.tsx b/gui/src/components/StyledMarkdownPreview/index.tsx index 2ff217a6147..4e0838f6bc6 100644 --- a/gui/src/components/StyledMarkdownPreview/index.tsx +++ b/gui/src/components/StyledMarkdownPreview/index.tsx @@ -141,6 +141,30 @@ const StyledMarkdown = styled.div<{ > *:last-child { margin-bottom: 0; } + + table { + border-collapse: collapse; + display: block; + width: max-content; + max-width: 100%; + overflow: auto; + margin-bottom: 16px; + } + + table th, + table td { + padding: 6px 13px; + border: 1px solid var(--vscode-editorWidget-border, #454545); + } + + table th { + font-weight: 600; + background-color: var(--vscode-editor-background); + } + + table tr:nth-child(2n) { + background-color: var(--vscode-list-hoverBackground, rgba(255,255,255,0.04)); + } `; interface StyledMarkdownPreviewProps { diff --git a/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx b/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx index a8ecc29b682..3d2cb11661e 100644 --- a/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx +++ b/gui/src/components/StyledMarkdownPreview/utils/remarkTables.tsx @@ -105,8 +105,7 @@ export function remarkTables() { { type: "tableRow", children: headerCells.map((cell, i) => ({ - type: "element", - tagName: "th", + type: "tableCell", align: alignments[i], children: [{ type: "text", value: cell }], })),