From 06b242c8f1e4369ceeb3307df98b54cb90b4807a Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 24 Mar 2026 23:42:12 +0530 Subject: [PATCH] refactor: integrate custom table components into markdown rendering in chat --- .../components/assistant-ui/markdown-text.tsx | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/surfsense_web/components/assistant-ui/markdown-text.tsx b/surfsense_web/components/assistant-ui/markdown-text.tsx index 8c4cff96f..651aa0cd5 100644 --- a/surfsense_web/components/assistant-ui/markdown-text.tsx +++ b/surfsense_web/components/assistant-ui/markdown-text.tsx @@ -20,6 +20,7 @@ import remarkMath from "remark-math"; import "katex/dist/katex.min.css"; import { InlineCitation, UrlCitation } from "@/components/assistant-ui/inline-citation"; import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button"; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { cn } from "@/lib/utils"; function stripThemeBackgrounds( @@ -370,43 +371,40 @@ const defaultComponents = memoizeMarkdownComponents({
), table: ({ className, ...props }) => ( -
- +
+
), + thead: ({ className, ...props }) => ( + + ), + tbody: ({ className, ...props }) => ( + + ), th: ({ className, children, ...props }) => ( - + ), td: ({ className, children, ...props }) => ( - + ), tr: ({ className, ...props }) => ( - td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg", - className - )} - {...props} - /> + ), sup: ({ className, ...props }) => ( a]:text-xs [&>a]:no-underline", className)} {...props} />
{processChildrenWithCitations(children)} - {processChildrenWithCitations(children)} -