Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider adding multi-row header support for tables in github #335

Open
wnm3 opened this issue Jun 12, 2023 · 0 comments
Open

Please consider adding multi-row header support for tables in github #335

wnm3 opened this issue Jun 12, 2023 · 0 comments

Comments

@wnm3
Copy link

wnm3 commented Jun 12, 2023

Initial checklist
I read the support docs
I read the contributing guide
I agree to follow the code of conduct
I searched issues and couldn’t find anything (or linked relevant results below)
Problem
I also host the OSS site (MDfromHTML) to convert HTML to Markdown. I’ve recently been working to improve table rendering from a bunch of HTML tables I’d put into a test page here. Some of these provide multiple header rows. I’ve supported this and Fletcher Penney’s MultiMarkdown Viewer supports this format as well. Note: for colspans and rowspans in HTML I elected to replicate the value so the table in HTML with multiple headers originally looked like this:
image

I did this replication as one goal I have is to associate row and column headers with each cell…

Below is a screen shot of the markdown and rendering I’d hoped would occur:
image

Unfortunately, the plugin renders the multi-line headers by ignoring all but the last line (directly above the header separator line with pipes and hyphens):

image

Do you suppose you could add support for multi-row headers? Thank you in advance for your consideration. I will want to request the same for github’s markdown processing so if you know who I should contact please let me know. Thanks.

Solution
When encountering a table, read ahead to reach the header separator row (pipes, hyphens, spaces, colons...) then apply the alignment gleaned there to all rows above the separator to create the table header rows, then process the rows following the separator as table body rows.

Alternatives
It could be possible to consolidate all cells for multi-row headers by column using
or something, but this loses the boundary for explicit headers.

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

No branches or pull requests

1 participant