Repository navigation
fix(id-web): promote first row when a PM table has no header row (#1044) - #1193
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Stale-PR warden: no activity for 2 days. Resolution task: #2356 — this PR should be merged, fixed, or closed. |
Fixes #1044 — queue task 1233.
A ProseMirror table whose rows are all
table_cell(schema-legal per editor.ts) saved as a plain paragraph: comrak emits the GFM delimiter row only for a header row, andjson_to_astderivedTableRow(is_header)solely from the first cell's type, so a headerless table got no delimiter and reparsed as a paragraph — silent structural data loss on save.Change (
pkgs/id/src/web/markdown.rs, save direction only): after a table's children are assembled injson_to_ast, if no row isTableRow(true), the first row is promoted toTableRow(true). Per the triage decision on #1044 this is promotion, not an error: a faithful rendering exists preserving every cell, GFM has no headerless-table representation, and the table's existingattrs.alignments(#881) live on the table node and apply to the promoted row unchanged. It is a one-time normalization — reparse yieldstable_headercells in row 0, so the second save is byte-identical.Tests (verbatim-codec probe, comrak 0.56, 79/79 pass; rustfmt clean):
test_pm_to_md_table_without_header_row_is_promoted: headerless 2x2 table saves as| a | b |\n| --- | --- |\n| c | d |\n, reparses as a table with a header first row, second save byte-identical.test_pm_to_md_single_row_table_without_header_is_promoted: single-row headerless table promotes its only row and reaches a fixpoint.Need help on this PR? Tag
@codesmith-botwith what you need.