redbug312 / markdown-it-multimd-table

Multimarkdown table syntax plugin for markdown-it markdown parser
MIT License
146 stars 37 forks source link

Example is not working for me #24

Closed christiansaiki closed 4 years ago

christiansaiki commented 4 years ago

Hello, thanks for creating this library. Unfortunately the example is not working for me.

I'm trying to run this test.js file

var md = require('markdown-it')()
    .use(require('markdown-it-multimd-table'), {
        multiline:  false,
        rowspan:    true
    });

const exampleTable =
    "|             |          Grouping           || \n" +
    "First Header  | Second Header | Third Header | \n" +
    " ------------ | :-----------: | -----------: | \n" +
    "Content       |          *Long Cell*        || \n" +
    "Content       |   **Cell**    |         Cell | \n" +
    "                                               \n" +
    "New section   |     More      |         Data | \n" +
    "And more      | With an escaped '\\|'       || \n" +
    "[Prototype table]                              \n";

console.log(md.render(exampleTable));

But the output is:

<p>|             |          Grouping           ||
First Header  | Second Header | Third Header |
------------ | :-----------: | -----------: |
Content       |          <em>Long Cell</em>        ||
Content       |   <strong>Cell</strong>    |         Cell |</p>
<p>New section   |     More      |         Data |
And more      | With an escaped '|'       ||
[Prototype table]</p>

What am I doing wrong? Thanks!

christiansaiki commented 4 years ago

BTW it was not working on version 4.0.0 By moving to version 3.2.3 I've managed to create the table 👍

redbug312 commented 4 years ago

Hi. I found version 4.0.0 cannot handle trailing spaces. In the case, the separator line was recognized invalid for the spaces and failed the whole table. This bug has been fixed up in version 4.0.1. Thanks for the bug report!