Skip to content

Conversation

TuongNM
Copy link
Contributor

@TuongNM TuongNM commented Aug 16, 2025

This adds support for multiple header rows into tables.

In order to accomplish this, the shared GridTable module was to extended to also be able to handle tables with multiple header rows.
Also adjusted the simpleTableRow function to prevent headless tables from being interpreted as multiple header rows and fixed hlint warnings about redundant $.

Fixes #10338

@jgm
Copy link
Owner

jgm commented Aug 19, 2025

Thank you! I'm okay with merging this as is, but I'd also be in favor of just changing tableWith so it takes a parser that yields a list of header rows ([[Blocks]] rather than [Blocks]). After all, the Table type accepts this, and most of the formats that use tableWith can have multiple header rows. The formats that can accept these should be updated to allow it. @tarleb any thoughts on that?

@TuongNM
Copy link
Contributor Author

TuongNM commented Aug 20, 2025

After looking at it, the Markdown reader is currently the only other reader to use these table functions. So if you would like to change tableWith, it should be fairly easy to adjust the uses inside the Markdown reader, provided I can just leave its current header row behavior as is.

@tarleb
Copy link
Collaborator

tarleb commented Aug 25, 2025

I concur, changing tableWith seems like the best option.

Extended the shared GridTable to support this.
Also adjusted simpleTableRow to prevent headless tables from being
interpreted as multiple header rows.
@TuongNM TuongNM force-pushed the rst-reader-multiple-header-rows branch from 0fef560 to 356a4f8 Compare August 25, 2025 16:07
@TuongNM
Copy link
Contributor Author

TuongNM commented Aug 25, 2025

Alright, I changed tableWith and made the existing Markdown reader work with it.

Not sure what happened with the CI tests here. Looks like it tried to download a ghc version which somehow failed?

@jgm
Copy link
Owner

jgm commented Aug 25, 2025

I'll try re-running the actions.

@jgm jgm merged commit 7820b68 into jgm:main Sep 2, 2025
12 of 24 checks passed
jgm pushed a commit that referenced this pull request Sep 2, 2025
[API change] Text.Pandoc.Parsing: `tableWith` and `tableWith'` now
return a list of lists of Blocks, rather than a list of Blocks, for the
header rows, allowing for multiple header rows.

Closes #10338.
@TuongNM TuongNM deleted the rst-reader-multiple-header-rows branch September 2, 2025 15:51
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.

RST: Simple Tables: multiple header rows not supported
3 participants