0.1.0 • Published 5 years ago

markdown-it-indented-tables v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

markdown-it-indented-tables

build status npm version npm downloads MIT license

Markdown tables with indents. Fast and easy to read and write.

Render this...

```table
#   $       Name
-   -:      -------
1   $1.39   Lemonade
2   $2.49   *Watermelon* juice
```

Into this...

Contents

Install

$ yarn add markdown-it-indented-tables

Use as a markdown-it plugin:

var md = require('markdown-it')()
            .use(require('markdown-it-indented-tables'))

Usage Rules (with Examples)

  1. Surround tables in a table fence
  2. Separate columns with 2+ spaces
  3. Underline the first row to mark as a header
  4. Use inline markdown

1. Surround tables in a table fence

```table
```

or

~~~table
~~~

2. Separate columns with 2+ spaces

Separate each column with 2+ spaces in the first row.

```table
here    are   four    columns
one     two   three   four
```
```table
this is only        two columns
the second starts   here
```
```table
this is also         two columns
indents   in   later rows   don't   matter
```

3. Underline the first row to mark as a header

Underline the first row with dashes '-' and colons ':' in the second row to designate the first a header.

For a header underline row to be valid:

  • Only use '-', ':', and ' ' characters
  • Start every column with '-' or ':'
  • Start & end default-align column underlines with '-'
  • Start right-align underlines with '-' and end with ':'
  • Start & end center-align underlines with ':'
  • Start (explicit) left-align underlines with ':' and end with '-'
  • Only the first and last character in each column's underline are examined for alignment
  • Minimum length for an underline is one character

Examples of valid header rows:

Default   Alignment   With   Dashes
-------   ---------   ----   ------

Minimum   Underline   Length  Is  1
-         -           -       -   -

Right   Align   Columns
----:   -:      ---------:

Center  Align   Columns
:----:  :-:     :

Left  Align   Columns
:---  :-      :--------

4. Use inline markdown

Most inline markdown is supported.

```table
**strong**   *emphasis*
`code`       [link](#)
```

Acknowledgements

markdown-it — Markdown parser, done right.
markdown-it-testgen
markdown-it-textual-uml

Related

markdown-it-table
markdown-it-multimd-table

License

MIT