Standardizing “pipe” tables (also known as PHP Markdown Extra tables) might be a step into right direction, since many implementations already support them in some way.
However, I wanted to share with you my comments I made for myself when adding a table support into Minima converter to show you how many corner-cases and ambiguities are out there:
Example 1
- Pandoc: 4 cols in header, 4 cols in 1st and 2nd row, 2 cols in 3rd row.
- PHP Markdown Extra: 4 cols everywhere.
h1|h2|h3|h4
-:|-|-|-
1|2|3|.|
a|b|c|d
I|.
Example 2
4th column ignored in Pandoc, present in PHP Markdown Extra.
A|B|C|D
-|-|-
1|2|3|4
Example 3
A complete table in PHP Markdown Extra, no table detected in Pandoc.
A|B|C|D
-|
1|2|3|4
Example 4
OK table in Pandoc. It doesn’t work in PHP Markdown Extra because of missing header line.
--:|--|---|--
1 |2 |3 |4
a |b |c |d
I |II|III|IV
Example 5
Not detected as a table in Pandoc, due to single :
, but works in PHP Markdown Extra.
|a|b|c|
|-|-|:|
||2|3|
Example 6
An empty table in PHP Markdown Extra, not detected as a table in Pandoc.
||||
|-|-|:|
||||
Example 7
2 cols in header and 4 cols tbody in Pandoc, erratic behaviour in PHP Markdown Extra.
x|y
-|-|-|-
||||||||||
Example 8
Pipe chars entered as \|
or `|`
should not trigger a cell separation. Works that way in Pandoc and kramdown.
| 1 | 2 | 3
| -- | --- | --
| \| | `|` | \|
Example 9
While Pandoc does recognize only 5 cols in <thead>
in below case, PHP Markdown Extra sees 7 cols and that feels like the right thing.
| `|` | <!--|--> | \| | *|* | __|__ |
| --- | -------- | -- | --- | ----- | -- | -- |
| a | b | c | d | e | f | g |
Example 10
Pandoc does not recognize one-column tables. PHP Markdown extra also does not recognize them and it needs the data line written as |a|
, which is in collision with its own documentation.
| 1 | 2 | 3
|---|:--|--:
a|
Example 11
A table inside a second list item. Pandoc handles it somehow but cudos to kramdown!
- item1
- | -
a | b | c | d
Example-12
There should be some empty headers and 13 <code>|<code>
cells. OK in PHP Markdown Extra and kramdown. Only 7 <code>|<code>
cells in Pandoc.
||||||||||||||||||||||
-|-|-|-|-|-|-
`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`|`
Example 13
A table without header. Works in kramdown only.
:--- | ---- | ---:
A | B | C
1 | 2
I |
Ideally, all above inconsistencies should go away by a proper table syntax specification. And it feels like it’s going to be a bit of work.