great-tables
great-tables copied to clipboard
Wrap header rows in `<thead>`
Prework
- [X] Read and agree to the code of conduct and contributing guidelines.
- [X] If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
Header rows should always be wrapped in <thead>. In particular, this will mean tables output to Typst that break over pages get the header rows repeated on each page.
Reproducible example
Consider the following example:
from great_tables import GT, md, html
from great_tables.data import islands
gt_tbl = GT(islands)
# Show the output table
gt_tbl
This results in the following (partial) HTML:
<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="name">name</th>
<th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="size">size</th>
</tr>
<tbody class="gt_table_body">
...
If this table is used in Quarto with format: typst and is allowed to break over pages, the header rows are not repeated on the second page:
QMD
---
title: "Untitled"
format: typst
keep-md: true
---
```{=typst}
#show figure: set block(breakable: true)
```
```{python}
from great_tables import GT, md, html
from great_tables.data import islands
gt_tbl = GT(islands)
# Show the output table
gt_tbl
```
Expected result
E.g. in gt the header rows are nested inside <thead>,
<table class="gt_table" data-quarto-disable-processing="false" data-quarto-bootstrap="false">
<thead>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="name">name</th>
<th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="size">size</th>
</tr>
</thead>
<tbody class="gt_table_body">
Then the header rows are repeated on the second page:
Development environment
- Operating System: macOS Sonoma 14.4
- great_tables Version: 0.10.0
- Quarto: dev version