在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):redbug312/markdown-it-multimd-table开源软件地址(OpenSource Url):https://github.com/redbug312/markdown-it-multimd-table开源编程语言(OpenSource Language):JavaScript 97.0%开源软件介绍(OpenSource Introduction):MultiMarkdown table syntax plugin for markdown-it markdown parser IntroMarkdown specs defines only the basics for tables. When users want common
features like 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. Usage// defaults
var md = require('markdown-it')()
.use(require('markdown-it-multimd-table'));
// full options list (equivalent to defaults)
var md = require('markdown-it')()
.use(require('markdown-it-multimd-table'), {
multiline: false,
rowspan: false,
headerless: false,
multibody: true,
aotolabel: true,
});
md.render(/*...*/) For a quick demo: $ mkdir markdown-it-multimd-table
$ cd markdown-it-multimd-table
$ npm install markdown-it markdown-it-multimd-table --prefix .
$ vim test.js
var md = require('markdown-it')()
.use(require('markdown-it-multimd-table'));
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));
$ node test.js > test.html
$ firefox test.html Here's the table expected on browser: Prototype table
Noted that GitHub filters out OptionsMultilineBackslash at end merges with line content below. | Markdown | Rendered HTML |
|--------------|---------------|
| *Italic* | *Italic* | \
| | |
| - Item 1 | - Item 1 | \
| - Item 2 | - Item 2 |
| ```python | ```python \
| .1 + .2 | .1 + .2 \
| ``` | ``` | This is parsed below when the option enabled:
Rowspan
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 |||
[Net ATP yields per hexose] This is parsed below when the option enabled: Net ATP yields per hexose
HeaderlessTable header can be eliminated. |--|--|--|--|--|--|--|--|
|♜| |♝|♛|♚|♝|♞|♜|
| |♟|♟|♟| |♟|♟|♟|
|♟| |♞| | | | | |
| |♗| | |♟| | | |
| | | | |♙| | | |
| | | | | |♘| | |
|♙|♙|♙|♙| |♙|♙|♙|
|♖|♘|♗|♕|♔| | |♖| This is parsed below when the option enabled:
MultibodyAn empty line separates consecutive table bodies. When disabled, an empty line always cuts off the tables. AutolabelTable Credits
LicenseThis software is licensed under the MIT license © RedBug312. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论