1 | [![NPM version](https://img.shields.io/npm/v/markdown-it-multimd-table.svg?style=flat)](https://www.npmjs.org/package/markdown-it-multimd-table)
|
2 | [![Build Status](https://travis-ci.org/RedBug312/markdown-it-multimd-table.svg?branch=master)](https://travis-ci.org/RedBug312/markdown-it-multimd-table)
|
3 | [![Coverage Status](https://coveralls.io/repos/github/RedBug312/markdown-it-multimd-table/badge.svg?branch=master)](https://coveralls.io/github/RedBug312/markdown-it-multimd-table?branch=master)
|
4 |
|
5 | Multimarkdown table syntax plugin for markdown-it markdown parser
|
6 |
|
7 | ## Intro
|
8 | Bored with HTML table tags when I need some extended table functions like `colspan` in Markdown. I found that [MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6/) had defined complete and clear rules for advanced table syntax, which is compatible to standard Markdown table syntax at the same time.
|
9 |
|
10 | For example, the following features are given:
|
11 | * `colspan` attribute
|
12 | * Multiple `<thead>` and `<tbody>`
|
13 | * Captions
|
14 |
|
15 | So I altered the table parser in markdown-it for the Multimarkdown syntax.
|
16 |
|
17 | NOTE: This plugin might behave differently from MultiMarkdown for some edging cases; For this plugin was developed mainly under the rules in [MultiMarkdown User's Guide](http://fletcher.github.io/MultiMarkdown-5/tables). Please impose an issue if you find problems related.
|
18 |
|
19 | ## Usage
|
20 | ```javascript
|
21 | var md = require('markdown-it')()
|
22 | .use(require('markdown-it-multimd-table'));
|
23 |
|
24 | md.render(/*...*/)
|
25 | ```
|
26 |
|
27 | For test, do this in terminal:
|
28 | ```bash
|
29 | $ npm install markdown-it-multimd-table --prefix .
|
30 | $ vim test.js
|
31 |
|
32 | var md = require('markdown-it')()
|
33 | .use(require('markdown-it-multimd-table'));
|
34 | const exampleTable =
|
35 | "| | Grouping || \n" +
|
36 | "First Header | Second Header | Third Header | \n" +
|
37 | " ------------ | :-----------: | -----------: | \n" +
|
38 | "Content | *Long Cell* || \n" +
|
39 | "Content | **Cell** | Cell | \n" +
|
40 | " \n" +
|
41 | "New section | More | Data | \n" +
|
42 | "And more | With an escaped '\\|' ||\n" +
|
43 | "[Prototype table] \n";
|
44 | console.log(md.render(exampleTable));
|
45 |
|
46 | $ node test.js > test.html
|
47 | $ firefox test.html
|
48 | ```
|
49 |
|
50 | ## Credits
|
51 | * [MultiMarkdown](https://fletcher.github.io/MultiMarkdown-6/), Lightweight markup processor to produce HTML, LaTeX, and more.
|
52 | * [markdown-it](https://markdown-it.github.io/), Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed
|
53 |
|
54 | ## License
|
55 | This software is licensed under the [MIT license](https://opensource.org/licenses/mit-license.php) © RedBug312.
|