markdown-js icon indicating copy to clipboard operation
markdown-js copied to clipboard

Support for Tables

Open NomNuggetNom opened this issue 10 years ago • 1 comments

It'd be really cool if some support for tables could be added, like GitHub's Markdown supports.

NomNuggetNom avatar Dec 22 '14 20:12 NomNuggetNom

There is some support for tables. In the tests,

My reading of this is that you have to use the non-default "Maruku" dialect for it to work: https://github.com/evilstreak/markdown-js/blob/master/test/features.t.js#L73-L74

and after some experimentation, I was able to get it to work:

z = "Entity      | Result\n------------|----------\n`©`    |  ©\n`£`   |  £\n`a b`  |  a b\n`λ`  |  λ\n`—`   |  &mdash";
markdown.toHTML(z, 'Maruku');

results in

<table><thead><tr><th>Entity</th><th>Result</th></tr></thead><tbody><tr><td><code>&amp;copy;</code></td><td>&amp;copy;</td></tr><tr><td><code>&amp;pound;</code></td><td>&amp;pound;</td></tr><tr><td><code>a&amp;nbsp;b</code></td><td>a&amp;nbsp;b</td></tr><tr><td><code>&amp;lambda;</code></td><td>&amp;lambda;</td></tr><tr><td><code>&amp;mdash;</code></td><td>&amp;mdash</td></tr></tbody></table>

mustmodify avatar Jan 15 '15 20:01 mustmodify