gfm-table generates GFM (GitHub Flavored Markdown) style table.
$ npm install gfm-table
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
- leftc
- centerr
- 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 |
MIT