olekukonko / tablewriter

ASCII table in golang
MIT License
4.28k stars 359 forks source link

Add support for markdown column alignment #181

Open WillAbides opened 3 years ago

WillAbides commented 3 years ago

resolves #173

This adds support for column alignment in markdown tables so that the rendered markdown table will have the same column alignment as the text version.

An example from a test:

|   DATE   |       DESCRIPTION        | CV2  | AMOUNT |
|----------|:-------------------------|-----:|:------:|
| 1/1/2014 | Domain name              | 2233 | $10.98 |
| 1/1/2014 | January Hosting          | 2233 | $54.95 |
| 1/4/2014 | February Hosting         | 2233 | $51.00 |
| 1/4/2014 | February Extra Bandwidth | 2233 | $30.00 |

renders as:

DATE DESCRIPTION CV2 AMOUNT
1/1/2014 Domain name 2233 $10.98
1/1/2014 January Hosting 2233 $54.95
1/4/2014 February Hosting 2233 $51.00
1/4/2014 February Extra Bandwidth 2233 $30.00
olekukonko commented 3 years ago

@mattn what do you think?

mfridman commented 2 years ago

This would be extra fantastic. Especially as more and more apps add proper markdown support.

Anything the community can do to help out? cc @mattn (👋 long time)

jippi commented 1 year ago

Would love to see this land. @olekukonko is the code/approach fine? if yes, I'm happy to do the work to revive this PR so its mergeable :)

olekukonko commented 1 year ago

@jippi will review this in detail and revert ... however this may be highly dependent on the introduction of theme

jippi commented 1 year ago

@olekukonko thank you, I appreciate it :) Please let me know if I can support it in any way as well

WillAbides commented 1 year ago

I noticed the activity here and merged master into the PR branch.

jippi commented 1 year ago

Thank you @WillAbides ! :)

@olekukonko How does it look from your point of view? Does it need any further polishing / tweaks?