Marked: Tables are broken on v0.6

Created on 27 Feb 2019  路  3Comments  路  Source: markedjs/marked

Describe the bug
Tables are broken!

To Reproduce
Go to https://marked.js.org and use the following table with versions 0.3 and 0.4+

Marked v0.3
image

Marked v0.4+
image

Markdown example

Name | Insert | Access | Search | Delete | Comments
-|-|-|-|-
[**Array**](#Array) | [*O(n)*](#Insert-element-on-an-array) | [*O(1)*](#Access-an-element-in-an-array) | [*O(n)*](#Search-an-element-in-an-array) | [*O(n)*](#Deleting-elements-from-an-array) | Insertion to the end is `O(1)`. [Details here.](#Array-operations-time-complexity)
[(Hash)**Map**](#HashMaps) | [*O(1)**](#Insert-element-on-a-HashMap-runtime) | [*O(1)**](#Search-Access-an-element-on-a-HashMap-runtime) | [*O(1)**]



Expected behavior
The table should render as in versions 0.3

Most helpful comment

Looks like you are missing a column for the line of dashes

- -|-|-|-|-
+ -|-|-|-|-|-

If you copy your markdown example into github it won't render as a table

All 3 comments

Looks like you are missing a column for the line of dashes

- -|-|-|-|-
+ -|-|-|-|-|-

If you copy your markdown example into github it won't render as a table

Also compare marked with the commonmark output.

Neither produce a table.
This is probably due to better conformance to the commonmark spec.

So it looks like version 0.3 was more forgiving. As @UziTech pointed out I was missing the |-. Now, it works with any version of marked and github:

Name | Insert | Access | Search | Delete | Comments
-|-|-|-|-|-
Array | O(n) | O(1) | O(n) | O(n) | Insertion to the end is O(1). Details here.
(Hash)Map | O(1) | O(1) | O(1)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsemozhetbyt picture vsemozhetbyt  路  4Comments

toc
zoe-cjf picture zoe-cjf  路  3Comments

raguay picture raguay  路  4Comments

eGavr picture eGavr  路  4Comments

cusalvi picture cusalvi  路  3Comments