-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
HTML reader - support new table features #6312
Comments
subscribing |
@danlobo02 - note that you can subscribe to issues using the Subscribe button on the right; you don't need to make a comment. |
* HTML writer: add support for row headers, colspans, rowspans * Add planet table tests See #6312
I'd be happy to get some opinions on a problem I'm facing: Cell alignment cannot (or should not) be specified for all cells in a column, as the Put differently, given this table <table>
<tr><td style="text-align: left">1</td><td style="text-align: right">2</td></tr>
<tr><td style="text-align: left">3</td><td style="text-align: right">4</td></tr>
</table> What should the Markdown output be? --- ---
1 2
3 4
--- --- or --- ---
1 2
3 4
--- --- I lean towards the first version, as that is also what pandoc produces currently. But I believe that, in the presence of colspans and rowspans, the first version will require table normalization similar to what we do in the HTML writer, which might impact performance. Also, where should this computation happen? In the writer, so filters have access to the original information? Or in the reader, because then we can provide more guarantees for the well-formedness of tables? |
Yes, I agree, the first version. |
@despresc may also have feedback on this. |
If I understand this question correctly, I think the reader should try its best to represent the input in the pandoc AST, and in this case means it is representing the align per cell, since the AST is capable to do that. I don’t know much about the normalization already performed in pandoc, in this particular case, is it just checking if the whole column is sharing the same align and if it did then “normalize” it such that there’s no cell alignment but one single column alignment for that column? (And repeat for each column.) I think this kind of normalization probably shouldn’t hurt the performance a lot. By the way I’m working on a library and pandoc filters that essentially can read and write all pandoc table AST feature so my biased preference would be an AST that has as much information from the reader as possible. |
Setting the column alignment like that seems fine to me. If that is done here, it should probably be after the Since I assume that cells that span multiple columns will not influence this process at all, since their alignment tends to be unrelated to the alignment of the columns they span. It will be slightly easier to keep the alignments on cells in the affected columns than to remove them, since the entire column needs to be laid out before we can decide whether or not its cells share the same alignment. The writers for formats that have both column and cell alignments already have to deal with superfluous explicit cell alignments, so keeping the alignments shouldn't introduce problems that aren't already present. |
Thanks for the feedback! I preserved the old behavior for now (i.e., take column-wide alignments from cells in first row), but plan to improve that later. |
Implemented:
Missing:
|
Done. One final question: if there is no |
I think it's good to keep backwards compatibility here -- at least until we have a specific reason to do otherwise. |
Do we have good test coverage for all these features? |
Most features are tested with what's already there in other tests, mostly in |
Add support for new table features introduced in
jgm/pandoc-types#66
including table attributes (including identifier), rowspan, colspan, table head and foot, multiple header lines, row headers, captions that allow block-level content and include an optional short caption.
The text was updated successfully, but these errors were encountered: