Skip to content

fix(id-web): promote first row when a PM table has no header row (#1044) - #1193

Merged
dezren39 merged 2 commits into
mainfrom
queue/1233-1044-headerless-table
Oct 30, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/1233-1044-headerless-table

Conversation

@dezren39

@dezren39 dezren39 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

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, and json_to_ast derived TableRow(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 in json_to_ast, if no row is TableRow(true), the first row is promoted to TableRow(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 existing attrs.alignments (#881) live on the table node and apply to the promoted row unchanged. It is a one-time normalization — reparse yields table_header cells 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.
  • All existing web::markdown tests pass unchanged (header-row tables render byte-identically).

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 27, 2026 03:53
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d7ba7a6b-39b4-4744-b9b2-4706591417e0
Commits

Reviewing files that changed from the base of the PR and between ce1acfb and a33f888.

Files selected for processing: 1
  • pkgs/id/src/web/markdown.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T03:54:13.321929Z a33f888 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

Copy link
Copy Markdown
Member Author

Stale-PR warden: no activity for 2 days. Resolution task: #2356 — this PR should be merged, fixed, or closed.

@dezren39 dezren39 closed this Oct 30, 2026
@dezren39 dezren39 reopened this Oct 30, 2026
@dezren39
dezren39 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 41f6bc9 Oct 30, 2026
50 of 59 checks passed
@dezren39
dezren39 deleted the queue/1233-1044-headerless-table branch October 30, 2026 03:28
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.

id(web): a ProseMirror table with no header row saves as a plain paragraph — delimiter row never emitted

1 participant