Skip to content

hitsujiwool/gfm-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

generate GFM style table

Resources

Stars

Watchers

Forks

Packages

No packages published