gfm-table

0.1.0 • Public • Published

gfm-table

gfm-table generates GFM (GitHub Flavored Markdown) style table.

Installation

$ npm install gfm-table

Usage

var table = require('gfm-table')
 
var out = table([
  ['name', 'color', 'count'],
  ['Manx Loaghtan', 'brown', 1200],
  ['Merino', 'white', 534],
  ['Suffolk', 'black', 200]
]);
 
console.log(out);

Output

| name          | color | count |
| ------------- | ----- | ----- |
| Manx Loaghtan | brown | 1200  |
| Merino        | white | 534   |
| Suffolk       | black | 200   |

With alignment options

  • l - left
  • c - center
  • r - right
var table = require('gfm-table')
 
var out = table([
  ['name', 'color', 'count'],
  ['Manx Loaghtan', 'brown', 1200],
  ['Merino', 'white', 534],
  ['Suffolk', 'black', 200]
], ['c', 'l', 'r']);
 
console.log(out);

Output

|     name      | color | count |
|:-------------:|:----- | -----:|
| Manx Loaghtan | brown |  1200 |
|    Merino     | white |   534 |
|    Suffolk    | black |   200 |

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i gfm-table

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • hitsujiwool