Convert csv to markdown.
$ go install github.com/uchiiii/csv2md@latest
$ csv2md help
NAME:
csv2md - convert csv to markdown
USAGE:
csv2md [global options] command [command options] [arguments...]
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--delimiter value, -d value CSV delimiter, expected values: ',', ';'. (default: ",")
--padding value, -p value The number of spaces to add between table cells and column dividers. (default: 2)
--help, -h show help (default: false)
# here testdata in this reository is used.
$ csv2md ./testdata/test1.csv
input: (csv file)
First Name,Last Name,Location,Allegiance
Mance,Rayder,North of the Wall,Wildlings
Margaery,Tyrell,The Reach,House Tyrell
Danerys,Targaryen,Meereen,House Targaryen
Tyrion,Lannister,King's Landing,House Lannister
output: (markdown)
First Name | Last Name | Location | Allegiance |
---|---|---|---|
Mance | Rayder | North of the Wall | Wildlings |
Margaery | Tyrell | The Reach | House Tyrell |
Danerys | Targaryen | Meereen | House Targaryen |
Tyrion | Lannister | King's Landing | House Lannister |
raw output:
| First Name | Last Name | Location | Allegiance |
|--------------|-------------|---------------------|-------------------|
| Mance | Rayder | North of the Wall | Wildlings |
| Margaery | Tyrell | The Reach | House Tyrell |
| Danerys | Targaryen | Meereen | House Targaryen |
| Tyrion | Lannister | King's Landing | House Lannister |
Features (Different from csv2md)
- Newline within cell in csv is converted to
<br/>
which is newline sign in markdown. - Even if the first cell is empty like
testdata/test4.csv
, the output is still valid markdown table.
Whichever it is bug reports, fixes, or features, you are WELLCOME opening issue or pull request any time.
Copyright (c) 2020 Ryosuke Horiuchi. Licensed under the MIT License.