showdown icon indicating copy to clipboard operation
showdown copied to clipboard

Footnote Above Table Causes Table Not to Render

Open shawnfunke opened this issue 2 years ago • 1 comments

Summary

Whenever there is a footnote used above a table it will not be rendered correctly. As a workaround a comment can be placed before the actual table.

Example

Footnote [^1]

[^1]: https://example.com

| C1  | C2  |
| --- | --- |
| k1  | v2  |
<p>Footnote <a href="https://example.com">^1</a></p>
<p>C1  | C2  | --- | --- |
| k1  | v2  |</p>

Workaround

Footnote [^1]

[^1]: https://example.com

<!-- comment -->

| C1  | C2  |
| --- | --- |
| k1  | v2  |
<p>Footnote <a href="https://example.com">^1</a></p>
<!-- comment -->
<table>
<thead>
<tr>
<th>C1</th>
<th>C2</th>
</tr>
</thead>
<tbody>
<tr>
<td>k1</td>
<td>v2</td>
</tr>
</tbody>
</table>

shawnfunke avatar Jun 22 '22 16:06 shawnfunke

What I found so far is that the issue comes from the makehtml.stripLinkDefinitions sub-parser ^1.

For the input of the example it matches C1 | C2 as a title and tries to put it back ^2. So it combines blankLines + title, which is \n and C1 | C2 , which then results in the table being broken.

shawnfunke avatar Jun 22 '22 17:06 shawnfunke