Skip to content

fix(ui): render markdown tables - #2840

Merged
esokullu merged 2 commits into
webbrain-one:mainfrom
alectimison-maker:fix/render-markdown-tables
Aug 18, 2026
Merged

fix(ui): render markdown tables#2840
esokullu merged 2 commits into
webbrain-one:mainfrom
alectimison-maker:fix/render-markdown-tables

Conversation

@alectimison-maker

Copy link
Copy Markdown
Contributor

Summary

  • Render GitHub-style Markdown pipe tables as semantic HTML tables in the chat sidepanel.
  • Mirror the renderer and styles across Chrome and Firefox.
  • Add regression and parity coverage for issue can't render tables #2838.

Motivation

Responses containing a header row, separator row, and pipe-delimited data rows were displayed as literal Markdown instead of a table. This is the user-visible failure reported in #2838.

Design

  • Add a dependency-free table parser to the existing Markdown renderer.
  • Run it after HTML escaping and after fenced/inline code extraction, so untrusted cell text remains escaped and pipes inside code do not alter table structure.
  • Accept valid separator rows, escaped pipes, and ragged body rows while keeping ordinary pipe text unchanged.
  • Add responsive overflow handling and readable header/cell borders without changing provider, storage, or browser APIs.

Testing

  • node test/run.js — 1850 passed; 1 pre-existing failure for the missing tracked artifact dist/webbrain-chrome-32.1.0.zip in the Opera-safe license filename check.
  • node --check src/chrome/src/ui/markdown-render.js && node --check src/chrome/src/ui/sidepanel.js && node --check src/firefox/src/ui/markdown-render.js && node --check src/firefox/src/ui/sidepanel.js — passed.
  • npm run test:toolbar-guard — passed (33 tests).
  • npm run test:security — passed (60/60 checks).
  • Chrome unpacked extension check on sidepanel.html — passed; injected issue table rendered as one table with overflow-x: auto, and no page or console errors.

Firefox live browser verification was not available; Firefox parity is covered by the mirrored source and regression assertions.

Compatibility and risks

  • No public API, provider, storage, or data migration changes.
  • Fenced code blocks and inline code remain protected by the existing placeholder extraction.
  • The parser intentionally targets chat sidepanel rendering; standalone skill-preview table rendering is deferred.

Scope

  • Deferred support for tables in the separate skill-preview/history Markdown renderer.

Closes #2838

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@alectimison-maker is attempting to deploy a commit to the esokullu's projects Team on Vercel.

A member of the Team first needs to authorize it.

Render pipe tables before ATX headings so a table on the next line is not glued onto the heading, and serialize rendered tables back to Markdown in chat history.

Co-authored-by: Cursor <cursoragent@cursor.com>
@esokullu

Copy link
Copy Markdown
Collaborator

Review findings (fixed in 9e7f610)

Pushed follow-up commit 9e7f610f (fix(ui): keep markdown tables after headings and in history) to address the review on this PR.

P1 — Render tables before headings
renderMarkdownHeadings() swallows the trailing newline, so a table on the next line was glued onto the h2 and no longer matched as a table. formatMarkdown now runs renderMarkdownTables() first. A heading immediately followed by a pipe table renders as both an h2 and a <table>.

P2 — Persist tables as Markdown, not flattened cells
Assistant history is rebuilt with historyTextFromElement(), which treated TABLE/TR/TH/TD as blocks and stored one cell per line. Rendered tables (including .markdown-table-wrapper) now round-trip as pipe Markdown, keep inline markers such as **bold**, and escape | inside cells.

node test/run.js: 1851 passed. The remaining failure is the pre-existing Opera archive filename mismatch, unrelated to this change.

@esokullu
esokullu merged commit 250ef21 into webbrain-one:main Aug 18, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can't render tables

2 participants