feat(message-parser): add GFM table support#41109
Conversation
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 \|.
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
Caution Review failedAn 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. Comment |
🦋 Changeset detectedLatest commit: 910e733 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
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 Report❌ Patch coverage is Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Follow-up: #41110 adds a graceful block-level fallback (degrade unsupported blocks to their raw source text instead of |
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, andTABLE_CELLAST nodes:Behavior:
:---(left),:--:(center),---:(right),---(none).\|.AST shape:
Renderer (
@rocket.chat/gazzodown)Table/TableHead/TableBody/TableRow/TableCellcomponents.start/center/end.Tablestory (and a table block in theExamplestory) toMarkup.stories.tsx.Steps to test or reproduce
Parser:
cd packages/message-parseryarn jest tests/table.test.tsRenderer (visual):
yarn turbo run build --filter=@rocket.chat/gazzodownyarn workspace @rocket.chat/gazzodown storybookMarkupstories →Table/Example.Or paste in a message:
Further comments
Tables require surrounding pipes in this first iteration to keep the grammar unambiguous against the existing inline
|(spoiler) syntax.