mdtable

0.2.0 • Public • Published

mdtable

(╯°□°)╯︵ ┻━┻ Generate markdown tables

Install

$ npm install mdtable
$ yarn add mdtable

Usage

const mdtable = require('mdtable')

const table = {
  header: ['A', 'B', 'C'],
  alignment: ['L', 'C', 'R'],
  rows: [
    ['1', '2', '3'],
    ['4', '5', '6'],
    ['7', '8', '9']
  ]
}

const settings = {
  borders: true, // Toggle outer borders of the table
  padding: 1     // Padding on each side of the longest string
}

mdtable(table, settings)
// -> `
| A | B | C |
|:--|:-:|--:|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 8 |
`

Install

npm i mdtable@0.2.0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • jamesford