diff --git a/ui/src/styles/components.css b/ui/src/styles/components.css index d6b87c4d770..c7a6a425dc7 100644 --- a/ui/src/styles/components.css +++ b/ui/src/styles/components.css @@ -1923,7 +1923,10 @@ margin-top: 0.75em; border-collapse: collapse; width: 100%; + max-width: 100%; font-size: 13px; + display: block; + overflow-x: auto; } .chat-text :where(th, td) { diff --git a/ui/src/ui/markdown.test.ts b/ui/src/ui/markdown.test.ts index 9b486f1bec1..c9084a6c305 100644 --- a/ui/src/ui/markdown.test.ts +++ b/ui/src/ui/markdown.test.ts @@ -48,4 +48,38 @@ describe("toSanitizedMarkdownHtml", () => { expect(html).not.toContain("javascript:"); expect(html).not.toContain("src="); }); + + it("renders GFM markdown tables (#20410)", () => { + const md = [ + "| Feature | Status |", + "|---------|--------|", + "| Tables | ✅ |", + "| Borders | ✅ |", + ].join("\n"); + const html = toSanitizedMarkdownHtml(md); + expect(html).toContain(""); + expect(html).toContain("Feature"); + expect(html).toContain("Tables"); + expect(html).not.toContain("|---------|"); + }); + + it("renders GFM tables surrounded by text (#20410)", () => { + const md = [ + "Text before.", + "", + "| Col1 | Col2 |", + "|------|------|", + "| A | B |", + "", + "Text after.", + ].join("\n"); + const html = toSanitizedMarkdownHtml(md); + expect(html).toContain("