This appears to be due to html's linebelowheader configuration to be false, so the code falls through to produce "</tbody></table>".
The merge request replaces the linebelowheader for html and unsafehtml with a function that generates a colspan'ed row with a HR tag, and ensures that the HR row isn't added below the header. So the above example results in:
This is valid HTML, so at least the advertised functionality for SEPARATING_LINE does not break.
Some options / considerations:
Another option, rather than another row, is to impose a border-top style on the row following the SEPARATING_LINE. That would be a more extensive change in the code, but would probably be prettier and would allow the table to have continuous rows or values (maybe better for cut/pasting into Excel?). On the other hand, having a specific separating row is reasonable and fits in better with the current code.
This PR is un-styled, which is probably more flexible / unopinionated, but the resulting HR doesn't look pretty out of the box. (In particular, it would be nice if the separating row took less vertical space.) While people can add a css rule for it (e.g. something targeting tr td hr), it might be better to add a class (e.g. tabulate-separating-row), to make it more specific to target. I think that html styling (adding classes to the tabulate-generated elements, and/or allowing users to specify local styles somehow, for jupyter or email environments) is out of scope of the PR but it would be a good discussion.
I think that there are other bugs for SEPARATING_LINE, e.g. SEPARATING_LINE doesn't work with tablefmt='orgtbl'. #250. The approach of this PR could be used for those other TableFormats, as needed. Alternatively, maybe there could be a more generic solution, e.g. a specific tablefmt configuration item for separating lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, using SEPARATING_LINE will produce broken HTML tables. E.g.
produces
This appears to be due to html's linebelowheader configuration to be false, so the code falls through to produce "</tbody></table>".
The merge request replaces the linebelowheader for html and unsafehtml with a function that generates a colspan'ed row with a HR tag, and ensures that the HR row isn't added below the header. So the above example results in:
This is valid HTML, so at least the advertised functionality for SEPARATING_LINE does not break.
Some options / considerations: