[pmwiki-users] Wiki tables - semantic <thead> and <tfoot> tags

Petko Yotov 5ko at 5ko.fr
Fri Feb 20 12:52:55 PST 2026


I plan to add automatic <thead> and <tfoot> elements to wiki tables for 
the next version.

These are only applied if all cells in the top or bottom row(s) are <th> 
cells, either in simple tables with "||!" or with (:head:) table 
directives.

Until now, PmWiki made tables without semantic <thead>, <tbody>, and 
<tfoot> elements, and browsers transformed this into one <tbody> element 
with all rows in it.

This made tables more complex to style, sort, and filter, and recipes 
needed to add their own code to create the headers and footers.

The new feature considers the top rows that "contain only <th> cells" a 
header, and moves them into a semantic <thead> element. There may be 
zero or more such rows. Same for the bottom rows of the table that 
contain only <th> cells, these rows go into a semantic <tfoot> element 
which will not be hidden when sorting or filtering.

If a row has both <th> and <td> cells, or only <td> cells, it will not 
be moved to a header or footer.

This will done by the PmWiki core JavaScript utilities on page load. It 
is an adaptation of the Sortable tables code (which already did this for 
sortable tables), will now be available to all tables that match the 
conditions.

Any custom JavaScript event listeners from interactive recipes should be 
preserved.

If you're using specific local CSS targeting the first row, you may want 
to check this, potentially replacing the selector, if appropriate:
   tr:first-child()
with:
   thead tr:first-child()

Feel free to download and test the new feature and please let me know if 
there are any problems that I may have not anticipated.

Petko



More information about the pmwiki-users mailing list