Skip to content
/ mdtable Public
generated from moul/golang-repo-template

csv/json to markdown tables with customizable format

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

moul/mdtable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

mdtable

This Go program converts a CSV/JSON file into a Markdown table using a configurable format string. It leverages the power of the tabwriter and text/template packages to generate neatly formatted tables from CSV/JSON data.

go.dev reference License GitHub release Docker Metrics Made by Manfred Touron

Go Release PR GolangCI codecov Go Report Card CodeFactor

Gitpod ready-to-code

Usage

foo@bar:~$ mdtable
USAGE
  mdtable csv [flags]

FLAGS
  -csv-no-header false                      csv: no header, just body
  -md-body {{range .Cols}}{{.}}\t{{end}}    mdtable body format
  -md-header {{range .Cols}}{{.}}\t{{end}}  mdtable header format
exit status 1
foo@bar:~$ cat testdata/file2.csv
Name,Age,Email
John Doe,30,[email protected]
Jane Smith,25,[email protected]

foo@bar:~$ cat testdata/file2.csv | mdtable csv
|Name       |Age |Email            |
|----       |--- |-----            |
|John Doe   |30  |[email protected] |
|Jane Smith |25  |[email protected] |

foo@bar:~$ cat testdata/file2.csv | mdtable csv -csv-no-header
|<!-- -->   |<!-- --> |<!-- -->         |
|--------   |-------- |--------         |
|Name       |Age      |Email            |
|John Doe   |30       |[email protected] |
|Jane Smith |25       |[email protected] |

foo@bar:~$ cat testdata/file2.csv | mdtable csv -md-header="foo\tbar\tbaz\t" -md-body="{{range .Cols}}<<{{.}}>>\t{{end}}"
|foo            |bar    |baz                  |
|---            |---    |---                  |
|<<John Doe>>   |<<30>> |<<[email protected]>> |
|<<Jane Smith>> |<<25>> |<<[email protected]>> |

Install

Using go

go get moul.io/mdtable

Releases

See https://github.com/moul/mdtable/releases

Contribute

Contribute <3

I really welcome contributions. Your input is the most precious material. I'm well aware of that and I thank you in advance. Everyone is encouraged to look at what they can do on their own scale; no effort is too small.

Everything on contribution is sum up here: CONTRIBUTING.md

Dev helpers

Pre-commit script for install: https://pre-commit.com

Contributors ✨

All Contributors

Thanks goes to these wonderful people (emoji key):


Manfred Touron

🚧 📖 ⚠️ 💻

moul-bot

🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

Stargazers over time

Stargazers over time

License

© 2021-2023 Manfred Touron

Licensed under the Apache License, Version 2.0 (LICENSE-APACHE) or the MIT license (LICENSE-MIT), at your option. See the COPYRIGHT file for more details.

SPDX-License-Identifier: (Apache-2.0 OR MIT)