gjtorikian / commonmarker

Ruby wrapper for the comrak (CommonMark parser) Rust crate
MIT License
429 stars 82 forks source link

tables with escaped pipes are not recognized #166

Closed thyresias closed 2 years ago

thyresias commented 2 years ago

According to GitHub Flavored Markdown Spec example 200:

| f\|oo  |
| ------ |
| b `\|` az |
| b **\|** im |

should render as

<table>
<thead>
<tr>
<th>f|oo</th>
</tr>
</thead>
<tbody>
<tr>
<td>b <code>|</code> az</td>
</tr>
<tr>
<td>b <strong>|</strong> im</td>
</tr>
</tbody>
</table>

But:

puts CommonMarker.render_html(<<~MD, %i(DEFAULT), %i(table))
| f\|oo  |
| ------ |
| b `\|` az |
| b **\|** im |
MD

results in:

<p>| f|oo  |
| ------ |
| b <code>|</code> az |
| b <strong>|</strong> im |</p>
thyresias commented 2 years ago

Error: ruby translates \| to |, \\| is needed. My bad.