Follow-up to #64/#67. Header repetition works — but not on the first continuation page(s) of a table, and those pages are also left mostly empty.
Reproduction
A 45-row table placed after four short tables so that it starts partway down page 1:
swifttext render proof.md -o proof.pdf --paper a4
Per-page contents (rows identified by their segment-N cell, header detected as a line matching ID.*Path.*N):
| Page |
Header repeated |
Rows on page |
| 2 |
no |
1–2 — two rows on an otherwise empty page |
| 3 |
no |
3–16 |
| 4 |
yes |
17–31 |
| 5 |
yes |
32–45 |
Pages 4 and 5 are correct: header present, 15 rows each. Pages 2 and 3 are not.
The visual result on page 2 is a two-row fragment with unlabelled columns at the top and roughly 80 % of the page blank — which is what the original report in #64 described.
Not caused by a custom stylesheet
Adding th, td { min-width: 4em } (the workaround from #70) changes the distribution but not the defect:
| Page |
Header |
Rows |
| 1 |
yes |
1–5 |
| 2 |
no |
6–9 |
| 3 |
yes |
10–24 |
| 4 |
yes |
25–39 |
| 5 |
yes |
40–45 |
One missing header instead of two, but the same pattern: the first continuation page has no header and is under-filled, then from the next page on it behaves correctly.
What the pattern suggests
thead { display: table-header-group } is clearly being honoured — otherwise pages 4 and 5 would have no header either. It appears not to take effect until the table has already crossed more than one page boundary, which would also explain the short page: the fragment is laid out before the header-group treatment applies, and the space reserved for the (absent) repeated header is never reclaimed.
A useful diagnostic would be whether the behaviour changes when the table starts at the top of a page rather than partway down it — in the runs above the defect only appeared when the table began mid-page.
Impact
On a table-heavy document this is not cosmetic. The same 45-row table costs 4 pages when it should cost 3, and two of those pages have unlabelled columns.
Environment
Built from 245da8c, macOS 27.0 (build 26A428), webkit engine, --paper a4. Reproduction file attached to this text; pdftotext -f N -l N -layout per page reproduces the table above.
Follow-up to #64/#67. Header repetition works — but not on the first continuation page(s) of a table, and those pages are also left mostly empty.
Reproduction
A 45-row table placed after four short tables so that it starts partway down page 1:
Per-page contents (rows identified by their
segment-Ncell, header detected as a line matchingID.*Path.*N):Pages 4 and 5 are correct: header present, 15 rows each. Pages 2 and 3 are not.
The visual result on page 2 is a two-row fragment with unlabelled columns at the top and roughly 80 % of the page blank — which is what the original report in #64 described.
Not caused by a custom stylesheet
Adding
th, td { min-width: 4em }(the workaround from #70) changes the distribution but not the defect:One missing header instead of two, but the same pattern: the first continuation page has no header and is under-filled, then from the next page on it behaves correctly.
What the pattern suggests
thead { display: table-header-group }is clearly being honoured — otherwise pages 4 and 5 would have no header either. It appears not to take effect until the table has already crossed more than one page boundary, which would also explain the short page: the fragment is laid out before the header-group treatment applies, and the space reserved for the (absent) repeated header is never reclaimed.A useful diagnostic would be whether the behaviour changes when the table starts at the top of a page rather than partway down it — in the runs above the defect only appeared when the table began mid-page.
Impact
On a table-heavy document this is not cosmetic. The same 45-row table costs 4 pages when it should cost 3, and two of those pages have unlabelled columns.
Environment
Built from 245da8c, macOS 27.0 (build 26A428),
webkitengine,--paper a4. Reproduction file attached to this text;pdftotext -f N -l N -layoutper page reproduces the table above.