Skip to content

Fix alignments in github tables#410

Merged
astanin merged 1 commit into
astanin:masterfrom
kdeldycke:fix-github-colalign
Mar 5, 2026
Merged

Fix alignments in github tables#410
astanin merged 1 commit into
astanin:masterfrom
kdeldycke:fix-github-colalign

Conversation

@kdeldycke
Copy link
Copy Markdown
Contributor

This fix the support of colalign for github table format.

tabulate v0.10 has just been released. It was supposed to fix alignment in markdown tables but it does not.

With the latest master commit I get:

$ uvx -v --from "git+https://github.com/astanin/python-tabulate.git" python -c "from tabulate import tabulate; print(tabulate([['Alice', 24], ['Bob', 19]], headers=['Name', 'Age'], tablefmt='github', colalign=('left', 'right')))"
(...)
DEBUG Attempting GitHub fast path for: git+https://github.com/astanin/python-tabulate.git
DEBUG Attempting to fetch `pyproject.toml` from: https://raw.githubusercontent.com/astanin/python-tabulate/26ccb780f4ae05995485e6f3199bcc5f7214decf/pyproject.toml
DEBUG Solving with target Python version: >=3.14.3
DEBUG Looking at `.dist-info` at: /Users/kde/.cache/uv/archive-v0/8nSHlzFznZ4vHkzGxye7Z/lib/python3.14/site-packages/tabulate-0.10.1.dev34+g26ccb780f.dist-info
(...)
| Name   |   Age |
|--------|-------|
| Alice  |    24 |
| Bob    |    19 |

Instead I am expecting to get:

| Name   |   Age |
|:-------|------:|
| Alice  |    24 |
| Bob    |    19 |

This PR fix this issue, by making github and pipe produce the same syntax.

This PR:

@kdeldycke kdeldycke force-pushed the fix-github-colalign branch from 0f4b86b to 046af03 Compare March 5, 2026 12:15
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.22%. Comparing base (26ccb78) to head (046af03).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #410      +/-   ##
==========================================
+ Coverage   84.21%   84.22%   +0.01%     
==========================================
  Files           1        1              
  Lines         893      894       +1     
  Branches      217      217              
==========================================
+ Hits          752      753       +1     
  Misses        107      107              
  Partials       34       34              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

kdeldycke added a commit to kdeldycke/click-extra that referenced this pull request Mar 5, 2026
@astanin astanin merged commit 8014ec6 into astanin:master Mar 5, 2026
19 checks passed
@kdeldycke
Copy link
Copy Markdown
Contributor Author

Thanks @astanin for the quick merge! :)

@kdeldycke kdeldycke deleted the fix-github-colalign branch March 5, 2026 14:27
kdeldycke added a commit to kdeldycke/python-tabulate that referenced this pull request Apr 6, 2026
kdeldycke added a commit to kdeldycke/python-tabulate that referenced this pull request Apr 6, 2026
kdeldycke added a commit to kdeldycke/python-tabulate that referenced this pull request Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

left, right, and center-aligned Markdown tables

3 participants