Skip to content

feat(message-parser): add GFM table support#41109

Draft
ggazzo wants to merge 4 commits into
developfrom
feat/message-parser-markdown-gaps
Draft

feat(message-parser): add GFM table support#41109
ggazzo wants to merge 4 commits into
developfrom
feat/message-parser-markdown-gaps

Conversation

@ggazzo

@ggazzo ggazzo commented Jun 29, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Adds GFM-style table support across the message parser and the renderer.

Parser (@rocket.chat/message-parser)

The parser now recognizes tables and emits new TABLE, TABLE_ROW, and TABLE_CELL AST nodes:

| Header 1 | Header 2 |
| -------- | :------: |
| Cell 1   | Cell 2   |

Behavior:

  • Column alignment is read from the delimiter row: :--- (left), :--: (center), ---: (right), --- (none).
  • Inline markup (bold, italic, links, emoji, …) is supported inside cells.
  • A leading and trailing pipe is required on every row; rows without surrounding pipes fall back to a paragraph.
  • A literal pipe inside a cell must be escaped as \|.

AST shape:

{ type: 'TABLE', value: { header: TableCell[], rows: TableRow[] } }
{ type: 'TABLE_ROW', value: TableCell[] }
{ type: 'TABLE_CELL', align: 'left' | 'center' | 'right' | undefined, value: Inlines[] }

Renderer (@rocket.chat/gazzodown)

  • Renders the new table nodes using Fuselage's Table / TableHead / TableBody / TableRow / TableCell components.
  • Cell alignment is translated to Fuselage's start / center / end.
  • Tables are rendered striped.
  • Message previews show a compact single-row rendering of the table header.
  • Added a Table story (and a table block in the Example story) to Markup.stories.tsx.
image

Steps to test or reproduce

Parser:

  1. cd packages/message-parser
  2. yarn jest tests/table.test.ts

Renderer (visual):

  1. yarn turbo run build --filter=@rocket.chat/gazzodown
  2. yarn workspace @rocket.chat/gazzodown storybook
  3. Open the Markup stories → Table / Example.

Or paste in a message:

| Name | Status | Score |
| :--- | :----: | ----: |
| Alice | **done** | 9.5 |
| Bob | :smile: | 7 |

Further comments

Tables require surrounding pipes in this first iteration to keep the grammar unambiguous against the existing inline | (spoiler) syntax.

Review in cubic

Parse GFM-style tables into new TABLE/TABLE_ROW/TABLE_CELL AST nodes.
Column alignment is read from the delimiter row (:---, :--:, ---:), and
inline markup is supported inside cells. A leading and trailing pipe is
required on every row; a literal pipe inside a cell must be escaped as \|.
@dionisio-bot

dionisio-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 910e733

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@rocket.chat/gazzodown Major
@rocket.chat/message-parser Minor
@rocket.chat/meteor Patch
@rocket.chat/core-services Patch
@rocket.chat/core-typings Patch
@rocket.chat/livechat Patch
@rocket.chat/rest-typings Patch
rocketchat-services Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ggazzo added 3 commits June 29, 2026 20:51
Map TABLE/TABLE_ROW/TABLE_CELL AST nodes to Fuselage's Table, TableHead,
TableBody, TableRow and TableCell components, translating cell alignment
(left/center/right) to Fuselage's start/center/end. Message previews show
a compact single-row rendering of the table header.
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.66667% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.21%. Comparing base (32880c4) to head (910e733).
⚠️ Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41109      +/-   ##
===========================================
+ Coverage    70.15%   70.21%   +0.06%     
===========================================
  Files         3368     3369       +1     
  Lines       130022   130366     +344     
  Branches     22543    22690     +147     
===========================================
+ Hits         91216    91542     +326     
- Misses       35492    35506      +14     
- Partials      3314     3318       +4     
Flag Coverage Δ
unit 70.21% <58.66%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ggazzo

ggazzo commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

Follow-up: #41110 adds a graceful block-level fallback (degrade unsupported blocks to their raw source text instead of null), so renderers that don't implement tables yet — e.g. mobile — don't silently drop the content.

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.

1 participant