Gathering detailed insights and metrics for markdown-it-multimd-table-ext
Gathering detailed insights and metrics for markdown-it-multimd-table-ext
Gathering detailed insights and metrics for markdown-it-multimd-table-ext
Gathering detailed insights and metrics for markdown-it-multimd-table-ext
Multimarkdown table syntax plugin for markdown-it markdown parser
npm install markdown-it-multimd-table-ext
Typescript
Module System
Node Version
NPM Version
74.6
Supply Chain
99
Quality
77.8
Maintenance
100
Vulnerability
100
License
JavaScript (97.57%)
Makefile (2.43%)
Total Downloads
2,792
Last Day
13
Last Week
43
Last Month
177
Last Year
1,068
214 Commits
1 Watching
5 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
4.2.32
Package Id
markdown-it-multimd-table-ext@4.2.32
Unpacked Size
132.13 kB
Size
26.34 kB
File Count
22
NPM Version
10.9.0
Node Version
23.1.0
Publised On
19 Nov 2024
Cumulative downloads
Total Downloads
Last day
62.5%
13
Compared to previous day
Last week
-8.5%
43
Compared to previous week
Last month
18%
177
Compared to previous month
Last year
9%
1,068
Compared to previous year
This is a fork of RedBug312's markdown-it-multimd-table
, used in the bebras
toolchain.*
Below is the original README, slightly modified.
MultiMarkdown table syntax plugin for markdown-it markdown parser
Markdown specs defines only the basics for tables. When users want common
features like colspan
, they must fallback to raw HTML. And writing tables in
HTML is truly lengthy and troublesome.
This plugin extends markdown-it with MultiMarkdown table syntax. MultiMarkdown is an extended Markdown spec. It defines clear rules for advanced Markdown table syntax, while being consistent with original pipe table; markdown-it is a popular Markdown parser in JavaScript and allows plugins extending itself.
The features are provided:
Noted that the plugin is not a re-written of MultiMarkdown. This plugin will behave differently from the official compiler, but doing its best to obey rules defined in MultiMarkdown User's Guide. Please pose an issue if there are weird results for sensible inputs.
1// defaults 2var md = require('markdown-it')() 3 .use(require('markdown-it-multimd-table-ext')); 4 5// full options list (equivalent to defaults) 6var md = require('markdown-it')() 7 .use(require('markdown-it-multimd-table-ext'), { 8 multiline: false, 9 rowspan: false, 10 headerless: false, 11 multibody: true, 12 autolabel: true, 13 }); 14 15md.render(/*...*/)
For a quick demo:
1$ mkdir markdown-it-multimd-table-ext 2$ cd markdown-it-multimd-table-ext 3$ npm install markdown-it markdown-it-multimd-table-ext --prefix . 4$ vim test.js 5 6 var md = require('markdown-it')() 7 .use(require('markdown-it-multimd-table-ext')); 8 9 const exampleTable = 10 "| | Grouping || \n" + 11 "First Header | Second Header | Third Header | \n" + 12 " ------------ | :-----------: | -----------: | \n" + 13 "Content | *Long Cell* || \n" + 14 "Content | **Cell** | Cell | \n" + 15 " \n" + 16 "New section | More | Data | \n" + 17 "And more | With an escaped '\\|' || \n" + 18 "[Prototype table] \n"; 19 20 console.log(md.render(exampleTable)); 21 22$ node test.js > test.html 23$ firefox test.html
Here's the table expected on browser:
Grouping | ||
---|---|---|
First Header | Second Header | Third Header |
Content | Long Cell | |
Content | Cell | Cell |
New section | More | Data |
And more | With an escaped '|' |
Noted that GitHub filters out style
property, so the example uses align
the
obsolete one. However it outputs style="text-align: ..."
in actual.
Backslash at end merges with line content below.
Feature contributed by Lucas-C.
1| Markdown | Rendered HTML |
2|--------------|---------------|
3| *Italic* | *Italic* | \
4| | |
5| - Item 1 | - Item 1 | \
6| - Item 2 | - Item 2 |
7| ```python | ```python \
8| .1 + .2 | .1 + .2 \
9| ``` | ``` |
This is parsed below when the option enabled:
Markdown | Rendered HTML |
---|---|
|
Italic |
|
|
|
|
^^
indicates cells being merged above.
Feature contributed by pmccloghrylaing.
1Stage | Direct Products | ATP Yields 2----: | --------------: | ---------: 3Glycolysis | 2 ATP || 4^^ | 2 NADH | 3--5 ATP | 5Pyruvaye oxidation | 2 NADH | 5 ATP | 6Citric acid cycle | 2 ATP || 7^^ | 6 NADH | 15 ATP | 8^^ | 2 FADH2 | 3 ATP | 9**30--32** ATP ||| 10[Net ATP yields per hexose]
This is parsed below when the option enabled:
Stage | Direct Products | ATP Yields |
---|---|---|
Glycolysis | 2 ATP | |
2 NADH | 3–5 ATP | |
Pyruvaye oxidation | 2 NADH | 5 ATP |
Citric acid cycle | 2 ATP | |
6 NADH | 15 ATP | |
2 FADH2 | 3 ATP | |
30–32 ATP |
Table header can be eliminated.
1|--|--|--|--|--|--|--|--| 2|♜| |♝|♛|♚|♝|♞|♜| 3| |♟|♟|♟| |♟|♟|♟| 4|♟| |♞| | | | | | 5| |♗| | |♟| | | | 6| | | | |♙| | | | 7| | | | | |♘| | | 8|♙|♙|♙|♙| |♙|♙|♙| 9|♖|♘|♗|♕|♔| | |♖|
This is parsed below when the option enabled:
♜ | ♝ | ♛ | ♚ | ♝ | ♞ | ♜ | |
♟ | ♟ | ♟ | ♟ | ♟ | ♟ | ||
♟ | ♞ | ||||||
♗ | ♟ | ||||||
♙ | |||||||
♘ | |||||||
♙ | ♙ | ♙ | ♙ | ♙ | ♙ | ♙ | |
♖ | ♘ | ♗ | ♕ | ♔ | ♖ |
An empty line separates consecutive table bodies. When disabled, an empty line always cuts off the tables.
Table id
attribute follows the table caption if not labeled. When disabled,
caption without labels cannot generate the attribute.
Allows setting the vertical alignment of columns with syntax embedded in the separator row.
| Top | Bottom | Default |
| ^---- | v----- | ------- |
This sets the vertical alignment of the first two column to top and bottom, respectively.
At the beginning of a cell, you can write [<align>]
to set the alignment of the cell. This overrides the default alignment of the column. Both the horizontal and vertical alignment can be set.
| Col 1 | Col 2 | Col 3 | Col 4 |
| --------- | ---------- | ------------ |------------ |
| [^] Top | [v] Bottom | [=] Middle | Content |
| [:-] Left | [-:] Right | [:-:] Center | [-] Default |
When specifying both horizontal and vertical alignment, the horizontal alignment should be written first. The alignment specifiers can be separated by a comma or a space for better readability.
Whereas a simple |
separator indicates a cell boundary, a double vertical bar ‖
in the separator row asks for a line to be drawn.
This adds a left and and right border to the table:
| Col 1 | Col 2 | Col 3 |
‖ ----- | ----- | ----- ‖
| A | B | C |
‖
only has an effect in the separator row and otherwise acts as a normal cell boundary; this adds no line:
‖ Col 1 | Col 2 | Col 3 ‖
| ----- | ----- | ----- |
| A | B | C |
Complementarily, horizontal lines can be inserted in the middle of a table by having a line with hyphens -
instead of actual cell contents (column boundaries are also allowed):
‖ Col 1 | Col 2 | Col 3 ‖
| ----- | ----- | ----- |
| A | B | C |
| ----- | ----- | ----- |
| D | E | F |
Use make browserify
. To publish your fork after updading the package name, use npm publish
.
This software is licensed under the MIT license © RedBug312, jppellet
No vulnerabilities found.
No security vulnerabilities found.