Skip to content

Don't drop empty header rows (#175) - #178

Merged
cscheid merged 2 commits into
mainfrom
bugfix/175
May 11, 2026
Merged

Don't drop empty header rows (#175)#178
cscheid merged 2 commits into
mainfrom
bugfix/175

Conversation

@cscheid

@cscheid cscheid commented May 11, 2026

Copy link
Copy Markdown
Member

This closes #175.

cscheid and others added 2 commits May 11, 2026 15:27
…mpv)

- repro.qmd shows the round-trip failure end-to-end (parser is correct,
  writer corrupts the table).
- exp-empty-body-row.qmd confirms the asymmetry is scoped to the header
  path; body rows of all-empty cells round-trip faithfully.
- triage.md localizes the bug to write_table in crates/pampa/src/writers/qmd.rs
  and documents Pandoc's gfm writer as the reference output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
)

When a Pandoc TableHead has zero rows (the parser output for tables whose
header line was all-empty cells), write_table was emitting the first body
row as the header line. The re-parser then read that body row as the
header, so head$rows flipped from 0 to 1 and the body silently lost a row
on every qmd→json→qmd round-trip.

Insert a synthetic empty header row when table.head.rows is empty, so the
existing header-line code emits "|     |     |" and every body row stays
a body row. Matches pandoc's gfm writer behavior on the same input.

Adds tests/roundtrip_tests/qmd-json-qmd/pipe_table_empty_header.qmd; the
existing test_qmd_roundtrip_consistency picks it up automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cscheid cscheid changed the title Bugfix/175 Don't drop empty header rows (#175) May 11, 2026
@cscheid
cscheid merged commit eca286b into main May 11, 2026
4 checks passed
@cscheid
cscheid deleted the bugfix/175 branch May 11, 2026 21:12
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.

qmd writer drops empty header row from pipe tables and promotes the first body row to a header

1 participant