README
tablemark-cli ·
Generate markdown tables from JSON data at the command line.
Parse JSON input data into a markdown table from the command line,
powered by the tablemark
module.
features
This utility supports:
- JSON file input from a provided path
- data piped from
stdin
- NDJSON formatted data (newline delimited JSON).
installation
yarn global add tablemark-cli
usage
Usage: tablemark <input-file> > <output-file> [options]
Commands:
help Display help
Options:
-a, --align <list> List of alignment types, applied in order to columns. (defaults to [])
-c, --columns <list> List of column names, defaults to object keys. (defaults to [])
-h, --help Output usage information
-v, --version Output the version number
To use the align
and column
options, you can use the -a
or
-c
flags multiple times, like this:
tablemark input.json > output.md -a left -a center
... which will align the first two columns left and center respectively.
stdin
tablemark < input.json > output.md
ndjson
NDJSON is a form of JSON that delimits multiple JSON objects by newlines:
{"name":"trilogy","repo":"[citycide/trilogy](https://github.com/citycide/trilogy)","desc":"No-hassle SQLite with type-casting schema models and support for native & pure JS backends."}
{"name":"strat","repo":"[citycide/strat](https://github.com/citycide/strat)","desc":"Functional-ish JavaScript string formatting, with inspirations from Python."}
{"name":"tablemark-cli","repo":"[citycide/tablemark-cli](https://github.com/citycide/tablemark-cli)","desc":"Generate markdown tables from JSON data at the command line."}
This input from a file or stdin is supported just as if it were a JSON compatible array:
tablemark input.ndjson > output.md
see also
tablemark
– the module used by this utility
contributing
Search the issues if you come across any trouble, open a new one if it hasn't been posted, or, if you're able, open a pull request. Contributions of any kind are welcome in this project.
The following people have already contributed their time and effort:
- Thomas Jensen (@tjconcept)
Thank you!
license
MIT © Bo Lingen / citycide