All Projects → redbug312 → markdown-it-multimd-table

redbug312 / markdown-it-multimd-table

Licence: MIT license
Multimarkdown table syntax plugin for markdown-it markdown parser

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to markdown-it-multimd-table

ng-treetable
A treetable module for angular 5
Stars: ✭ 32 (-69.23%)
Mutual labels:  table
docker-hub
Docker Hub in your terminal
Stars: ✭ 43 (-58.65%)
Mutual labels:  table
react-datatable
React-datatable is a component which provide ability to create multifunctional table using single component like jQuery Datatable. It's fully customizable and easy to integrate in any react component. Bootstrap compatible.
Stars: ✭ 72 (-30.77%)
Mutual labels:  table
react-datasheet-grid
An Airtable-like / Excel-like component to create beautiful spreadsheets.
Stars: ✭ 227 (+118.27%)
Mutual labels:  table
CppConsoleTable
C++ Console Table: make text table in console easy and set up as you need
Stars: ✭ 53 (-49.04%)
Mutual labels:  table
fast-laravel
基于Swoole的高性能HTTP服务器,加速您Laravel应用程序。
Stars: ✭ 33 (-68.27%)
Mutual labels:  table
au-datatable
Aurelia Datatable, A highly customizable html datatable, build for the Aurelia Framework.
Stars: ✭ 21 (-79.81%)
Mutual labels:  table
terraform-aws-dynamodb-autoscaler
Terraform module to provision DynamoDB autoscaler
Stars: ✭ 21 (-79.81%)
Mutual labels:  table
Table
CLI tables in Swift
Stars: ✭ 53 (-49.04%)
Mutual labels:  table
outfancy
Python3 library to print tables in Terminal.
Stars: ✭ 47 (-54.81%)
Mutual labels:  table
termtable
Simple and highly customizable library to display tables in the terminal.
Stars: ✭ 41 (-60.58%)
Mutual labels:  table
tallboy
Declarative API for drawing unicode/ascii character tables in crystal lang
Stars: ✭ 49 (-52.88%)
Mutual labels:  table
cryptocharts
Cryptocurrency stats and charts displayed in your terminal.
Stars: ✭ 55 (-47.12%)
Mutual labels:  table
tabled
An easy to use library for pretty print tables of Rust structs and enums.
Stars: ✭ 1,337 (+1185.58%)
Mutual labels:  table
celldown.js
Small javascript library for manipulating markdown tables
Stars: ✭ 17 (-83.65%)
Mutual labels:  table
react-bolivianite-grid
React grid component for virtualized rendering large tabular data.
Stars: ✭ 95 (-8.65%)
Mutual labels:  table
org-table-sticky-header
Sticky header for org-mode tables
Stars: ✭ 31 (-70.19%)
Mutual labels:  table
template
Svelte starter template with HMR, code splitting, datatable & modular ui-kit
Stars: ✭ 16 (-84.62%)
Mutual labels:  table
sense-export
Just a simple button to export data in your Qlik Sense applications.
Stars: ✭ 28 (-73.08%)
Mutual labels:  table
paper-datatable-api
A material design implementation of a data table
Stars: ✭ 72 (-30.77%)
Mutual labels:  table

GitHub Action NPM version Coverage Status

MultiMarkdown table syntax plugin for markdown-it markdown parser

Intro

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:

  • Cell spans over columns
  • Cell spans over rows (optional)
  • Divide rows into sections
  • Multiple table headers
  • Table caption
  • Block-level elements such as lists, codes... (optional)
  • Omitted table header (optional)

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
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.

Options

Multiline

Backslash at end merges with line content below.
Feature contributed by Lucas-C.

|   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:

Markdown Rendered HTML
*Italic*

Italic

- Item 1
- Item 2
  • Item 1
  • Item 2
```python
.1 + .2
```
.1 + .2

Rowspan

^^ indicates cells being merged above.
Feature contributed by pmccloghrylaing.

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
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

Headerless

Table header can be eliminated.

|--|--|--|--|--|--|--|--|
|♜|  |♝|♛|♚|♝|♞|♜|
|  |♟|♟|♟|  |♟|♟|♟|
|♟|  |♞|  |  |  |  |  |
|  |♗|  |  |♟|  |  |  |
|  |  |  |  |♙|  |  |  |
|  |  |  |  |  |♘|  |  |
|♙|♙|♙|♙|  |♙|♙|♙|
|♖|♘|♗|♕|♔|  |  |♖|

This is parsed below when the option enabled:

Multibody

An empty line separates consecutive table bodies. When disabled, an empty line always cuts off the tables.

Autolabel

Table id attribute follows the table caption if not labeled. When disabled, caption without labels cannot generate the attribute.

Credits

  • MultiMarkdown, Lightweight markup processor to produce HTML, LaTeX, and more.
  • markdown-it, Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed.

License

This software is licensed under the MIT license © RedBug312.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].