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 with mismatched headers don't render (but did in ancient marked 0.7.0?) #2745

Closed
gardnerjr opened this issue Mar 1, 2023 · 2 comments

Comments

@gardnerjr
Copy link

Marked version:
4.x
Ancient code on marked 0.7.0 seems to handle this better

Describe the bug
A table with mismatched headers and rows won't render:

| One header |
|:------------- |:-------------|:-----|
| row | has | 3 cols |

We have a site using an ancient verison of marked, ~0.7.0, where this works in a strange way, which generates this:

image

<table>
<thead>
<tr>
<th style="text-align: left;">One header</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">row</td>
<td style="text-align: left;">has</td>
<td style="text-align: left;">3 cols</td>
</tr>
</tbody>
</table>

To Reproduce
Steps to reproduce the behavior:

  1. Marked broken example
    if you add a couple | to the first line to have matching number of columns, the table will start working
  2. CommonMark, DaringFireball don't support tables

Expected behavior
The ancient behavior of creating a table with a partial header was much more forgiving. In this case, the second header line specifying the alignment is correct and i'd expect that to be the thing that "wins".

@gardnerjr
Copy link
Author

Actually i tried with the other versions on the demo site, it looks like i have to go all the way back to 0.3.19 to get an example of it working like would be most forgiving

@calculuschild
Copy link
Contributor

Yep, this is a result of Marked following the spec more closely in later versions. Ancient Marked mistakenly allowed bad table syntax. Newer Marked is better at following the rules.

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

No branches or pull requests

3 participants