Fix SEPARATING_LINE producing invalid html#438
Open
jborlik wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
linebelowheaderconfiguration to be false, so the code falls through to produce"</tbody></table>".The merge request replaces the linebelowheader for
htmlandunsafehtmlwith 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:
border-topstyle 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.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.