empress / ember-cli-showdown

Ember component to render markdown into HTML.
https://empress.github.io/ember-cli-showdown/
MIT License
101 stars 35 forks source link

I cannot get ember-cli-showdown to display a table #111

Closed rpringadi closed 2 years ago

rpringadi commented 2 years ago

I managed to get ember-cli-showdown (version 4.5.0) to show various layout (H1, H2, h3, bullets, links, etc.) But I cannot get it to display a table.

Input:

| Category                            | Test Case                                                   | Priority | Technology |
|-------------------------------------|-------------------------------------------------------------|----------|------------|
| Broken Object Level Authorization   | Insecure Direct Object Reference                            | P1       | All        |

Output:

| Category | Test Case | Priority | Technology | |-------------------------------------|-------------------------------------------------------------|----------|------------| | Broken Object Level Authorization | Insecure Direct Object Reference | P1 | All |
LucMorrissette commented 2 years ago

It looks like the "tables" option for showdown.js is disabled by default.

You should be able to set it to "true" right in your component/template or you can configure it globally for your app.

Edit: more info form the WIKI: https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax#tables

rpringadi commented 2 years ago

Thanks for the tip! I managed to display the table.

<MarkdownToHtml @tables={{true}} @tablesHeaderId={{true}} @markdown={{this.model.myMarkdownSource}} />