npm.io
1.0.5 • Published 1 year ago

markdown-it-table-merge-cells

Licence
MIT
Version
1.0.5
Deps
0
Size
11 kB
Vulns
0
Weekly
0
Stars
2

markdown-it-table-merge-cells

  • markdown-it 增强辅助类表格语法插件(目前只支持列合并和行合并。后面会考虑加入行列合并。)

  • 由于markdown-it-multimd-table不支持配合prettier格式化一起使用,可读性和可维护性就比较差,因此我自己写一个。

  • 凡是用markdown-it作为解析器的markdown编辑器,只要该编辑器支持配置即可使用此插件扩展表格语法。

  • markdown-it enhanced auxiliary class table syntax plug-in (Currently, only column merging and row merging are supported. Will consider joining the column merge later.)

  • Because markdown-it-multimd-table is not supported with prettier formatting, making it less readable and maintainable, so I wrote my own.

  • Any markdown editor that uses markdown-it as the parser can use this plugin to extend the table syntax as long as the editor supports configuration.

Usage

npm i markdown-it -D
npm i markdown-it-table-merge-cells -D
// 以上两行效果同下行/The above two lines have the same downward effect
npm i markdown-it  markdown-it-table-merge-cells -D


import MarkdownIt from "markdown-it";
import TableMergeCells from "markdown-it-table-merge-cells";

const md = new MarkdownIt()

md.use(TableMergeCells);

console.log(
  md.render(`
|  4col   |   ==    |  ==  |   ==    |
| :-----: | :-----: | :--: | :-----: |
|  2row   | content | 3row | content |
|   ^^    | content |  ^^  | content |
| content | content |  ^^  | content |
`)
);
  • 以下是浏览器上预期的表格:
  • Here's the table expected on browser:
4col
2row content 3row content
content content
content content content

License

MIT itianci