<pre> blocks in markdown tables behave differently than rest of document, including html tables
digitalmoksha opened this issue · 2 comments
digitalmoksha commented
When you have a block like this
<pre>`something` and `another`</pre>
it usually gives you the same html back - the code blocks are ignored.
cmark-gfm -e table --unsafe
<pre>`something` and `another`</pre>
gives
<pre>`something` and `another`</pre>
But with a markdown table, it processes the code blocks:
cmark-gfm -e table --unsafe
| Test |
| --- |
| <pre>`something` and `another`</pre> |
gives
<table>
<thead>
<tr>
<th>Test</th>
</tr>
</thead>
<tbody>
<tr>
<td><pre><code>something</code> and <code>another</code></pre></td>
</tr>
</tbody>
</table>
With an HTML table, it works as expected:
cmark-gfm -e table --unsafe
<table>
<tr><td><pre>`something` and `another`</pre></td></tr>
</table>
gives
<table>
<tr><td><pre>`something` and `another`</pre></td></tr>
</table>
UziTech commented
This has to do with the difference between block level HTML and inline HTML. The table cells contents are parsed as inline markdown not block level markdown like inside lists.
Inline html is parsed between the tags where block level html is not.
digitalmoksha commented
@UziTech you're absolutely right. My test of a single line with <pre>`one` and `two`</pre>
pushed it through the block rendering, whereas Paragraph <pre>`one` and `two`</pre>
uses inline rendering, which the table uses.
Not an issue, closing...