Tables
htmlbag supports the standard HTML table model: <table>, <thead>,
<tbody>, <tfoot>, <tr>, <td>, <th>, plus <colgroup> /
<col> for column-level styling.
Basic features
- Cell borders, padding, background.
colspanandrowspanattributes.- Cell width via
<col style="width: …">or per-cell CSS. - Headers (
<thead>) repeat at the top of each page when the table spans multiple pages.
Multi-page tables and inserts
Tables that need to break across pages take a special path
(outputTableRows) that places rows directly without going through
the body buffer. As a consequence, multi-page tables are
boundary-isolated:
- The current page’s body buffer is shipped before the table starts.
- After the last table row, the page is shipped before any further body content is buffered.
This means a <table> with <thead> repeating headers does not
share a page with adjacent body content (there’s a hard page break
on either side). Tables with no header repeat behave like normal
block content and share pages freely.
Footnotes inside table cells
Footnotes inside table cells are extracted at table-build time and attached to the table’s VList. They land on the page where the table’s last row sits.
Floats inside table cells
Floats inside table cells (top or bottom) are extracted alongside footnotes and attached to the table VList. They behave like any other float — landing on the page where the table sits, in the appropriate top/bottom stack.