feat(message-parser): add GFM table support#41109
Conversation
|
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 |
WalkthroughThis PR adds GFM-style table parsing to ChangesGFM Table Support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MarkdownInput
participant grammar.pegjs
participant utils.ts
participant Markup.tsx
participant TableBlock.tsx
MarkdownInput->>grammar.pegjs: parse table rows
grammar.pegjs->>grammar.pegjs: derive alignment and cells
grammar.pegjs->>utils.ts: table(header, aligns, rows, fallback)
utils.ts->>utils.ts: trim cell whitespace
utils.ts-->>Markup.tsx: TABLE AST node
Markup.tsx->>TableBlock.tsx: render header and rows
TableBlock.tsx->>TableBlock.tsx: map alignments and inline cells
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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: 5516f46 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #41109 +/- ##
===========================================
+ Coverage 69.12% 69.17% +0.04%
===========================================
Files 3433 3434 +1
Lines 132444 132799 +355
Branches 23097 23222 +125
===========================================
+ Hits 91552 91862 +310
- Misses 37531 37566 +35
- Partials 3361 3371 +10
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 |
|
/jira ARCH-2167 |
ebb5c54 to
ac9dd0f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/gazzodown/src/blocks/TableBlock.tsx (1)
19-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider adding unit/snapshot tests for
TableBlock.No test file accompanies this new component; coverage currently relies only on the Storybook story. A basic render test (alignment mapping, empty rows/header) would guard against regressions.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/gazzodown/src/blocks/TableBlock.tsx` around lines 19 - 42, Add unit/snapshot coverage for TableBlock, since the new TableBlock component currently has no test file and only relies on the Storybook story. Create tests that render TableBlock with representative header/rows data and verify the table renders correctly, including alignment mapping through toAlign and behavior when header or rows are empty. Use the TableBlock component and its props shape as the main entry points for locating the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/message-parser/README.md`:
- Around line 55-59: The fenced markdown example in the README is missing a
language tag, which triggers markdownlint MD040. Update the opening fence in the
example to use a markdown language identifier such as md or markdown so the
snippet stays lint-clean; this change is in the fenced example block in the
README.
In `@packages/message-parser/src/grammar.pegjs`:
- Around line 103-115: The table grammar currently lets Table parse a header row
and a delimiter row with different column counts, which can still produce a
TABLE with mismatched header/alignment mappings. Update the Table rule in
grammar.pegjs to validate that TableRowLine and TableDelimiterRow produce the
same number of cells before calling table(...), and reject the parse when they
differ; keep the check close to the Table/TableRowLine/TableDelimiterRow symbols
so the GFM table shape is enforced consistently.
---
Nitpick comments:
In `@packages/gazzodown/src/blocks/TableBlock.tsx`:
- Around line 19-42: Add unit/snapshot coverage for TableBlock, since the new
TableBlock component currently has no test file and only relies on the Storybook
story. Create tests that render TableBlock with representative header/rows data
and verify the table renders correctly, including alignment mapping through
toAlign and behavior when header or rows are empty. Use the TableBlock component
and its props shape as the main entry points for locating the code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 84e8f087-9654-40fc-ad0b-4b0c0dcf8d1f
📒 Files selected for processing (12)
.changeset/gazzodown-render-tables.md.changeset/tame-tables-render.mdpackages/gazzodown/src/Markup.stories.tsxpackages/gazzodown/src/Markup.tsxpackages/gazzodown/src/PreviewMarkup.tsxpackages/gazzodown/src/blocks/TableBlock.tsxpackages/message-parser/README.mdpackages/message-parser/src/definitions.tspackages/message-parser/src/grammar.pegjspackages/message-parser/src/utils.tspackages/message-parser/tests/helpers.tspackages/message-parser/tests/table.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (6)
- GitHub Check: 🚢 Build Docker (arm64, account-service, presence-service, omnichannel-transcript-service, cove...
- GitHub Check: 🚢 Build Docker (arm64, rocketchat, coverage)
- GitHub Check: 🚢 Build Docker (arm64, authorization-service, queue-worker-service, ddp-streamer-service, cove...
- GitHub Check: 🚢 Build Docker (amd64, authorization-service, queue-worker-service, ddp-streamer-service, cove...
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/gazzodown/src/blocks/TableBlock.tsxpackages/gazzodown/src/PreviewMarkup.tsxpackages/message-parser/tests/table.test.tspackages/gazzodown/src/Markup.tsxpackages/gazzodown/src/Markup.stories.tsxpackages/message-parser/tests/helpers.tspackages/message-parser/src/utils.tspackages/message-parser/src/definitions.ts
🧠 Learnings (5)
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/tame-tables-render.md.changeset/gazzodown-render-tables.md
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
packages/gazzodown/src/blocks/TableBlock.tsxpackages/gazzodown/src/PreviewMarkup.tsxpackages/gazzodown/src/Markup.tsxpackages/gazzodown/src/Markup.stories.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
packages/gazzodown/src/blocks/TableBlock.tsxpackages/gazzodown/src/PreviewMarkup.tsxpackages/message-parser/tests/table.test.tspackages/gazzodown/src/Markup.tsxpackages/gazzodown/src/Markup.stories.tsxpackages/message-parser/tests/helpers.tspackages/message-parser/src/utils.tspackages/message-parser/src/definitions.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/message-parser/tests/table.test.tspackages/message-parser/tests/helpers.tspackages/message-parser/src/utils.tspackages/message-parser/src/definitions.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/message-parser/tests/table.test.tspackages/message-parser/tests/helpers.tspackages/message-parser/src/utils.tspackages/message-parser/src/definitions.ts
🪛 markdownlint-cli2 (0.22.1)
packages/message-parser/README.md
[warning] 55-55: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (5)
packages/gazzodown/src/blocks/TableBlock.tsx (1)
1-45: LGTM!packages/gazzodown/src/Markup.tsx (1)
9-9: LGTM!Also applies to: 66-68
packages/gazzodown/src/PreviewMarkup.tsx (1)
89-100: LGTM!packages/gazzodown/src/Markup.stories.tsx (1)
261-272: LGTM!Also applies to: 306-310
.changeset/gazzodown-render-tables.md (1)
1-5: LGTM!
| Table = header:TableRowLine aligns:TableDelimiterRow body:TableRowLine* { return table(header, aligns, body, [range().start, range().end]); } | ||
|
|
||
| TableRowLine = "|" cells:(@TableCell "|")+ EndOfLine? { return cells; } | ||
|
|
||
| TableCell = items:TableCellItem* { return reducePlainTexts(items); } | ||
|
|
||
| TableCellItem | ||
| = "\\|" { return plain('|'); } | ||
| / !"|" !EndOfLine @(InlineItemPattern / Any) | ||
|
|
||
| TableDelimiterRow = "|" aligns:(@TableDelimiterCell "|")+ EndOfLine? { return aligns; } | ||
|
|
||
| TableDelimiterCell = [ \t]* left:":"? "-"+ right:":"? [ \t]* { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Reject header/delimiter width mismatches.
TableRowLine and TableDelimiterRow are parsed independently here, so input like | a | b |\n| - | still becomes a TABLE. That contradicts the GFM table contract and leaves downstream code with a malformed column/alignment mapping.
Suggested fix
-Table = header:TableRowLine aligns:TableDelimiterRow body:TableRowLine* { return table(header, aligns, body, [range().start, range().end]); }
+Table
+ = header:TableRowLine aligns:TableDelimiterRow &{ return header.length === aligns.length; } body:TableRowLine* {
+ return table(header, aligns, body, [range().start, range().end]);
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Table = header:TableRowLine aligns:TableDelimiterRow body:TableRowLine* { return table(header, aligns, body, [range().start, range().end]); } | |
| TableRowLine = "|" cells:(@TableCell "|")+ EndOfLine? { return cells; } | |
| TableCell = items:TableCellItem* { return reducePlainTexts(items); } | |
| TableCellItem | |
| = "\\|" { return plain('|'); } | |
| / !"|" !EndOfLine @(InlineItemPattern / Any) | |
| TableDelimiterRow = "|" aligns:(@TableDelimiterCell "|")+ EndOfLine? { return aligns; } | |
| TableDelimiterCell = [ \t]* left:":"? "-"+ right:":"? [ \t]* { | |
| Table | |
| = header:TableRowLine aligns:TableDelimiterRow &{ return header.length === aligns.length; } body:TableRowLine* { | |
| return table(header, aligns, body, [range().start, range().end]); | |
| } | |
| TableRowLine = "|" cells:(`@TableCell` "|")+ EndOfLine? { return cells; } | |
| TableCell = items:TableCellItem* { return reducePlainTexts(items); } | |
| TableCellItem | |
| = "\\|" { return plain('|'); } | |
| / !"|" !EndOfLine @(InlineItemPattern / Any) | |
| TableDelimiterRow = "|" aligns:(`@TableDelimiterCell` "|")+ EndOfLine? { return aligns; } | |
| TableDelimiterCell = [ \t]* left:":"? "-"+ right:":"? [ \t]* { |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/message-parser/src/grammar.pegjs` around lines 103 - 115, The table
grammar currently lets Table parse a header row and a delimiter row with
different column counts, which can still produce a TABLE with mismatched
header/alignment mappings. Update the Table rule in grammar.pegjs to validate
that TableRowLine and TableDelimiterRow produce the same number of cells before
calling table(...), and reject the parse when they differ; keep the check close
to the Table/TableRowLine/TableDelimiterRow symbols so the GFM table shape is
enforced consistently.
There was a problem hiding this comment.
3 issues found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/message-parser/src/grammar.pegjs">
<violation number="1" location="packages/message-parser/src/grammar.pegjs:103">
P2: Implement GFM column-count semantics in the table rule. Malformed header/delimiter counts should fall back to paragraphs, and ragged body rows should be padded/truncated before rendering.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| * the delimiter row: `:---` left, `:--:` center, `---:` right, `---` none. | ||
| * A literal pipe inside a cell must be escaped as `\|`. | ||
| */ | ||
| Table = header:TableRowLine aligns:TableDelimiterRow body:TableRowLine* { return table(header, aligns, body, [range().start, range().end]); } |
There was a problem hiding this comment.
P2: Implement GFM column-count semantics in the table rule. Malformed header/delimiter counts should fall back to paragraphs, and ragged body rows should be padded/truncated before rendering.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/message-parser/src/grammar.pegjs, line 103:
<comment>Implement GFM column-count semantics in the table rule. Malformed header/delimiter counts should fall back to paragraphs, and ragged body rows should be padded/truncated before rendering.</comment>
<file context>
@@ -86,6 +88,37 @@ BlockquoteLine
+ * the delimiter row: `:---` left, `:--:` center, `---:` right, `---` none.
+ * A literal pipe inside a cell must be escaped as `\|`.
+ */
+Table = header:TableRowLine aligns:TableDelimiterRow body:TableRowLine* { return table(header, aligns, body, [range().start, range().end]); }
+
+TableRowLine = "|" cells:(@TableCell "|")+ EndOfLine? { return cells; }
</file context>
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 \|.
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.
The TABLE node now carries an optional `fallback` plain-text node holding its matched source (via the grammar's text()), so consumers without a table renderer can degrade to the original markup instead of dropping the node.
Replace the duplicated plain-text `fallback` on the TABLE node with a [start, end] offset span (new SourceRange type) into the original source. Avoids bloating the persisted/transmitted AST; consumers slice the source (available as message.msg) to render the raw markup.
3f39b26 to
509f163
Compare
- Normalize ragged table body rows to the header column count (pad missing cells, drop extras) so GFM rows stay aligned with the header/delimiter. - Map table cell alignment with an explicit switch instead of an object lookup, so a crafted AST align (e.g. __proto__/toString) can't resolve to an inherited value in the renderer. - Add a language to the README table fence (markdownlint MD040).
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/message-parser/tests/table.test.ts (1)
89-105: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a case for a missing leading pipe.
Only a missing trailing pipe is tested; the PR description also states leading pipes are required. Consider adding a symmetrical case for a missing leading pipe to fully cover the "surrounding pipes required" rule.
♻️ Suggested addition
// missing trailing pipe -> not a table (v1 requires surrounding pipes) [ ` | a | b | - | - `.trim(), [ { type: 'PARAGRAPH', value: [plain('| a | b')] }, { type: 'PARAGRAPH', value: [plain('| - | -')] }, ], ], + // missing leading pipe -> not a table (v1 requires surrounding pipes) + [ + ` +a | b | +- | - | +`.trim(), + [ + { type: 'PARAGRAPH', value: [plain('a | b |')] }, + { type: 'PARAGRAPH', value: [plain('- | - |')] }, + ], + ],🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/message-parser/tests/table.test.ts` around lines 89 - 105, Add a new negative test in table.test.ts for the “surrounding pipes required” rule by covering a missing leading pipe case alongside the existing missing trailing pipe coverage. Update the test.each block around parse() so it includes an input like a table row without the leading pipe and asserts it is parsed as plain PARAGRAPH nodes, matching the existing plain text expectations and keeping the behavior symmetrical.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/message-parser/tests/table.test.ts`:
- Around line 89-105: Add a new negative test in table.test.ts for the
“surrounding pipes required” rule by covering a missing leading pipe case
alongside the existing missing trailing pipe coverage. Update the test.each
block around parse() so it includes an input like a table row without the
leading pipe and asserts it is parsed as plain PARAGRAPH nodes, matching the
existing plain text expectations and keeping the behavior symmetrical.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ddf4adec-78cf-4c6e-afa0-9de49c49b2ed
📒 Files selected for processing (4)
packages/gazzodown/src/blocks/TableBlock.tsxpackages/message-parser/README.mdpackages/message-parser/src/utils.tspackages/message-parser/tests/table.test.ts
✅ Files skipped from review due to trivial changes (1)
- packages/message-parser/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/message-parser/src/utils.ts
- packages/gazzodown/src/blocks/TableBlock.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
- GitHub Check: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: CodeQL-Build
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/message-parser/tests/table.test.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
packages/message-parser/tests/table.test.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
packages/message-parser/tests/table.test.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
packages/message-parser/tests/table.test.ts
🔇 Additional comments (2)
packages/message-parser/tests/table.test.ts (2)
1-69: LGTM!
71-87: LGTM!
|
Thanks for the reviews — addressed in the latest commit:
Not addressed on purpose: header/delimiter column-count mismatch ( |
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.Task: ARCH-2196
Summary by CodeRabbit