mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
756 stars 138 forks source link

minimum number of characters in a table column? #169

Closed ec1oud closed 2 years ago

ec1oud commented 2 years ago

I was trying to use my Qt-based markdown editor to write up some bit flags in a markdown table, and the first column only had one character. It got completely scrambled on saving and I had to go back and reformat it by hand. It seems md4c needs it to have at least 3 characters in a column, to be treated as a table. Not sure if this is a bug or if this limitation is required by some specification? Looks like github deals with it:

|b|usage            |
|-|-----------------|
|0|lsb              |
|1|two              |
|2|four             |
|3|eight            |
b usage
0 lsb
1 two
2 four
3 eight
$ md2html --github single-char-table-column.md
<p>Does md4c deal with this?</p>
<p>|b|usage            |
|-|-----------------|
|0|lsb              |
|1|two              |
|2|four             |
|3|eight            |</p>

3 chars in first column:

|bit|usage            |
|---|-----------------|
|0  |lsb              |
|1  |two              |
|2  |four             |
|3  |eight            |

$ md2html --github 3-char-table-column.md
<p>Does md4c deal with this?</p>
<table>
<thead>
<tr>
<th>bit</th>
<th>usage</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>lsb</td>
</tr>
<tr>
<td>1</td>
<td>two</td>
</tr>
<tr>
<td>2</td>
<td>four</td>
</tr>
<tr>
<td>3</td>
<td>eight</td>
</tr>
</tbody>
</table>
mity commented 2 years ago

(Sorry for the late reply. Was of github for months.)

Not sure if this is a bug or if this limitation is required by some specification? Looks like github deals with it.

Interesting. I'm quite positive that early GFM implementations required 3 dashes per column (where the 1st and the last one could be replaced with a colon). I think we can sync with them on this.

ec1oud commented 2 years ago

Thanks for fixing.