astanin / python-tabulate

Pretty-print tabular data in Python, a library and a command-line utility. Repository migrated from bitbucket.org/astanin/python-tabulate.
https://pypi.org/project/tabulate/
MIT License
2.1k stars 163 forks source link

Add support for alignments in Markdown tables #261

Open kdeldycke opened 1 year ago

kdeldycke commented 1 year ago

This PR adds supports for column alignments for GitHub-Flavored Markdown (i.e. the github table format). This has been requested on issue #53 and reuse the same code as the pipe format.

Additionally, this PR allows the elements used to produce the alignments segments to be configured by the way of the begin=, hline=, sep= and end= parameters. This will help support of other formats in the future.

And finally, this PR tweak the github format to introduce a space separation between the pipes separating the cells of the table. This is to conform to the GitHub Flavored Markdown Spec.

This closes #53 and also supersedes #260.

kdeldycke commented 1 year ago

All tests are passing and successful. This PR is ready to be merged upstream.