BlockRenderer, postContent: parse plain-text markdown tables in messages#5839
Conversation
… strings and render as component tree
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4076a78560
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@claude review once |
inlineDataToMarkdown
This comment has been minimized.
This comment has been minimized.
patosullivan
left a comment
There was a problem hiding this comment.
Overall looks good, but there are a few issues I think should probably be addressed before we merge. Most are pretty minor.
…corp/tlon-apps into jamesacklin/md-table-blocks
Summary
Render GFM-style Markdown tables in messages as real tables instead of pipe-text. Detection runs client-side at receive time — wire format unchanged, old clients still see plaintext.
Why is this PR so big?
About 1,300 lines net but most of it is moved code, not new logic. Here's how to read it:
~870 lines of genuine new code — start here:
extractTables.ts(~415 lines) — the splitterextractTables.test.ts(~290 lines) — 9 unit tests for the splittergroupMentionPlugin.ts(~85 lines) — mirrorsshipMentionPlugin.tspostContentInlines.ts(~80 lines) —convertInlineContentextracted out ofpostContent.tsto break a cycle betweenconvertContentandextractTablesFromContent~160 lines of additions to existing files:
BlockRenderer.tsx— theTableBlockcomponent (column-grouped layout, three-phaseonLayoutmeasurement)postContent.ts—TableBlockDatatype,BlockDataunion extension,plaintextPreviewOfcase, single call toextractTablesFromContentat the end ofconvertContentmdastToStory.ts—isGroupMentiontype guard and handler inphrasingToInlinesThe rest is a directory move (
packages/shared/src/logic/markdown/→packages/api/src/client/markdown/).Changes
TableBlockDatablock type +TableBlockrenderer (column-grouped layout, two-passonLayoutmeasurement, capped at 280px wide, header-row dim styling).packages/api/src/client/markdown/extractTables.tsfinds GFM tables in paragraph content, parses with remark-gfm, emitsTableBlockData. Usesmdast-util-to-markdownfor serialization so bold/links/mentions in cells survive intact.remarkGroupMentionsplugin (parallel toremarkShipMentions) so@all/@adminround-trip through table cells.packages/shared/src/logic/markdown/→packages/api/src/client/markdown/. api now owns content conversion end-to-end;convertContentcallsextractTablesFromContentdirectly.How did I test?
extractTables.test.tscovering simple extraction, soft-wrap continuation merging, no-outer-pipe tables, bold/link/group-mention preservation in cells, and pre/post-paragraph splitting.pnpm lintpasses with zero errors (117 warnings, all pre-existing ondevelop).bold+linkinlines.Risks and impact
No wire-format or backend changes. New code path only fires on paragraphs whose text matches a GFM table signature.
Rollback plan
Revert the branch. To narrowly disable detection without removing the type, remove the
extractTablesFromContentcall at the end of api'sconvertContent.Screenshots / videos
Appearance in chat:

Appearance in notebook:
