showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.35k stars 1.57k forks source link

[GFM] Table delimiter row requires more than one `-` in each cell. #870

Open ghost opened 3 years ago

ghost commented 3 years ago

Does not support table

showdown.setOption('tables', true);
showdown.setOption('tablesHeaderId', true);

var converter = new showdown.Converter(),
text      = `|a|b|c|d|
|:-|:-:|:-:|-:|
|1|2|3|4|`,
                         html      = converter.makeHtml(text);
                        $ ('[data]') .html (html)
SyntaxRules commented 3 years ago

More than one dash is required in the line between table headers and table body. The following works:

| a  | b   | c   | d  |
| :-- | :--: | :--: | --: |
| 1  | 2   | 3   | 4  |
Preview: a b c d
1 2 3 4

According to GFM, one dash tables should be allowed: https://github.github.com/gfm/#tables-extension-