parse-markdown-table-cli
v0.0.6
Published
Convert a markdown table from text to JSON objects
Readme
Parse Markdown Table CLI
Convert a markdown table from text to JSON objects
Usage
--help
input-stream | parse-markdown-table [options]
Options:
--version Show version number [boolean]
--format Structure of output [choices: "list", "dict", "jsonl"] [default: "dict"]
--indentType Type of indentation [choices: "tab", "space", "none"] [default: "space"]
--indentSize Size of indentation
(only apply if --indentType=space) [number] [default: 2]
--help Show help [boolean]
Examples:
parse-markdown-table < table.md Print JSON representation of table inside table.md
parse-markdown-table Read a markdown table from stdin and parse itExamples
--format dict
echo '
| id | name | email |
|----|-------------|--------------------------|
| 1 | John Doe | [email protected] |
| 2 | Peter Smith | [email protected] |
| 3 | Julia Jones | [email protected] |
' | parse-markdown-table --format dictOutput:
[
{
"id": "1",
"name": "John Doe",
"email": "[email protected]"
},
{
"id": "2",
"name": "Peter Smith",
"email": "[email protected]"
},
{
"id": "3",
"name": "Julia Jones",
"email": "[email protected]"
}
]--format list
echo '
| id | name | email |
|----|-------------|--------------------------|
| 1 | John Doe | [email protected] |
| 2 | Peter Smith | [email protected] |
| 3 | Julia Jones | [email protected] |
' | parse-markdown-table --format listOutput:
{
"headers": [
"id",
"name",
"email"
],
"rows": [
[
"1",
"John Doe",
"[email protected]"
],
[
"2",
"Peter Smith",
"[email protected]"
],
[
"3",
"Julia Jones",
"[email protected]"
]
]
}--format jsonl
echo '
| id | name | email |
|----|-------------|--------------------------|
| 1 | John Doe | [email protected] |
| 2 | Peter Smith | [email protected] |
| 3 | Julia Jones | [email protected] |
' | parse-markdown-table --format jsonl{"id":"1","name":"John Doe","email":"[email protected]"}
{"id":"2","name":"Peter Smith","email":"[email protected]"}
{"id":"3","name":"Julia Jones","email":"[email protected]"}