javascriptgithub-flavored-markdownshowdown

Enhance Showdown.js table code so that it supports left/right alignment of table headers


Im using Showdown.js and have implemented the tables extensions and got it working for normal tables.

The extension does not support 'Github Flavoured Markdown' for header alignment.

Example:

|Normal Heading | Right Aligned |
| ------------- | ------------: |     

Please help me with what code I can include in my table.js file to add this support.

I found similar code in marked.js here.


Solution

  • Showdown >= 1.2.0 now has built in support for tables (with alignment) in core. You just need to activate it in the options:

    var conv = new showdown.Converter({tables: true});