mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
[Pipe Tables Extension] Normalization is inserting extra columns #384
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hamvocke on GitHub (Jul 30, 2020).
I'm working with markdig's Pipe Tables Extension and found a case where the specified behavior around normalization is different from what GitHub-flavored Markdown is specifying.
GFM says:
markdig's pipe tables spec says:
This means, a table like this:
is supposed to result in an HTML table that's got 2 columns according to GFM. The first body row gets an extra, empty
<td>while the second body row doesn't include theboocell.Running this example through markdig with pipe tables enabled, however, generates a table that's got 3 columns, with the header and the first body row both gaining empty table cells.
I'm wondering if this deviation from GFM is intentional. Is there a reason why the two specifications treat normalization differently? And would it be desirable to make the normalization behavior configurable, e.g. by passing an option to the pipe tables plugin?
@xoofx commented on GitHub (Jul 30, 2020):
The GFM specs came officially much after Markdig pipe tables were developed. Before that was never really specified, probably more broken in terms of implicit specs than it is today. Never got the time to see how to get back to a closer behavior with GFM. A PR would be definitely welcome to do this work.
@hamvocke commented on GitHub (Jul 30, 2020):
That makes perfect sense, thanks for the explanation! Let me dig in and see what I can come up with to help here 👍
@xoofx commented on GitHub (Jul 30, 2020):
Good! So there is a major difference in the way we are parsing things in Markdig for pipe table (here), so the implementation today is a bit convoluted and not easy to work with. So don't be afraid about your first impression (e.g WTF is this code doing 😅 )
@xoofx commented on GitHub (Jul 30, 2020):
Meaning that, if we wanted to have 100% compatibility with GFM, the implementation would have to be quite different (but probably simpler). It could be done as a new pipe table parser mode, while keeping the existing implementation the default.
@xoofx commented on GitHub (Jul 30, 2020):
(you can see some of the pathological differences in this example)
@hamvocke commented on GitHub (Jul 30, 2020):
I'm trying to fix one problem at a time, and it seems like the normalization behavior is simple enough to understand and tackle 🙂
There are some other GFM incompatibilities that I've encountered but as you outline, other Markdown parsers out there are deviating from the GFM spec as well, often in the same way as Markdig - which happens to be working quite well for us.
@xoofx commented on GitHub (Jul 30, 2020):
Indeed, I'm not sure it's worth the time fixing these specific incompatibilities (or to create an entire new GFM pipetable parser) as these discrepancies are mostly edge cases for which it's barely possible to find a acknowledge/common - end-user- expectation on them.