Marked: Inline code inside of table not detected

Created on 8 May 2018  路  4Comments  路  Source: markedjs/marked

Marked version: 0.3.19, also test on masker

Markdown flavor: GitHub Flavored Markdown

Expectation

For the markdown:

| Description |
| ------ |
| `a | b` |

Expected a one column table with a cell containing inline code a | b

Result

<table>
<thead>
<tr>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>`a</td>
<td>b`</td>
</tr>
</tbody>
</table>
L1 - broken

Most helpful comment

in order to achieve the expected result you would need to escape the pipe in code:

| Description |
| ------ |
| `a \| b` |

demo

All 4 comments

The second column should be removed. see https://github.github.com/gfm/#example-197

Also, I think this is already fixed in be922cecdd825350421be969777f7052c4cbc9e9

Yes 0.4.0 now drops the second column which matches what github does. Markdown-it still renders this as:

<table>
<thead>
<tr>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>a | b</code></td>
</tr>
</tbody>
</table>

but based on the GFM spec the current marked behavior seems correct

in order to achieve the expected result you would need to escape the pipe in code:

| Description |
| ------ |
| `a \| b` |

demo

Was this page helpful?
0 / 5 - 0 ratings

Related issues

priyesh-diukar picture priyesh-diukar  路  3Comments

camwiegert picture camwiegert  路  4Comments

elennaro picture elennaro  路  4Comments

woodyrew picture woodyrew  路  4Comments

raguay picture raguay  路  4Comments