Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables break in markdown-it v12 #113

Closed
valtlai opened this issue Oct 15, 2020 · 2 comments · Fixed by #114
Closed

Tables break in markdown-it v12 #113

valtlai opened this issue Oct 15, 2020 · 2 comments · Fixed by #114

Comments

@valtlai
Copy link
Contributor

valtlai commented Oct 15, 2020

Markdown-it v12 was just released. We can’t just bump the markdown-it version because tables don’t work correctly without code changes. I’m not sure if markdown-it-attrs or markdown-it itself should be updated to fix the issue.

Markdown-it versions:
12.0.0

├── UNMET PEER DEPENDENCY [email protected]
└── [email protected]

Example input:

| Foo   | Baz   |
| ----- | ----- |
| sin   | cos   |
{.lorem}

Current output:

<table>
<thead>
<tr>
<th>Foo</th>
<th>Baz</th>
</tr>
</thead>
<tbody>
<tr>
<td>sin</td>
<td>cos</td>
</tr>
<tr>
<td class="lorem"></td>
<td></td>
</tr>
</tbody>
</table>

Expected output:

<table class="lorem">
<thead>
<tr>
<th>Foo</th>
<th>Baz</th>
</tr>
</thead>
<tbody>
<tr>
<td>sin</td>
<td>cos</td>
</tr>
</tbody>
</table>
@valtlai valtlai changed the title Tables break on markdown-it v12 Tables break in markdown-it v12 Oct 21, 2020
@schl3ck
Copy link

schl3ck commented Nov 10, 2020

I got it to apply the class to the <table> element by moving it to a seperate paragraph:

| Foo   | Baz   |
| ----- | ----- |
| sin   | cos   |

{.lorem}

Looks like markdown-it treats the last line as part of the table even when it doesn't contain any pipes.

@valtlai
Copy link
Contributor Author

valtlai commented Nov 11, 2020

@schl3ck You’re right. That new behavior in markdown-it v12 is correct according to GitHub Flavored Markdown Spec.

Opened PR #114 to update markdown-it to v12 and a test to use a blank line after the table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants