0.1.0 • Published 10 years ago

gfm-table v0.1.0

Weekly downloads
10
License
MIT
Repository
github
Last release
10 years ago

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