python-tabulate icon indicating copy to clipboard operation
python-tabulate copied to clipboard

left, right, and center-aligned Markdown tables

Open tanimislam opened this issue 5 years ago • 3 comments

I realize that Markdown is a mess, but for tablefmt="github" with stralign argument, the header line (which goes as -----------) can be modified as the following:

  • stralign="left": header lines will have :---------.
  • stralign="right": header lines will have ---------:.
  • stralign="center": header lines have :--------:.

tanimislam avatar Apr 25 '20 20:04 tanimislam

I just had a look at implementing this and realised that this is exactly what the 'pipe' format does. The README even points out that the 'github' format is the 'pipe' format without alignment markers, although I missed that the first time I read through the patterns.

samueljsb avatar Aug 05 '22 16:08 samueljsb

Had the same issue trying to produce a GitHub table with alignment directives. I ended up with a workaround to emulate that behavior. For reference, my hackish code is available at: https://github.com/kdeldycke/meta-package-manager/blob/af261b7194c592bbd45a6910bed8063fa6c59fbe/meta_package_manager/inventory.py#L56-L87

kdeldycke avatar Oct 06 '22 11:10 kdeldycke

For reference, I proposed a PR to address this issue at: https://github.com/astanin/python-tabulate/pull/261

kdeldycke avatar Apr 04 '23 14:04 kdeldycke