How markdown table formatter works
Hand-written markdown tables drift out of alignment the moment a cell is edited: pipes stop lining up, separator rows keep their original width, and short rows leave gaps. This formatter parses the table the way GitHub-flavored markdown does — a header row, a separator row of dashes with optional colons, and data rows, each optionally wrapped in pipes with escaped \| supported inside cells — and rebuilds it with every column padded to its widest cell.
The separator row is rebuilt too, so its dash count always matches the column width, and the alignment colons are preserved by default. If you want to change how the table renders, force left, center, or right alignment for every column, or strip the markers entirely. The result is a diff-friendly, consistently aligned table that renders identically on GitHub, GitLab, and any GFM renderer.
The formatter is forgiving about real-world mess. Rows missing a trailing pipe, rows with no enclosing pipes at all, CRLF line endings, and surrounding blank lines are all handled. Short rows are padded with empty cells and rows with more cells than the header keep their extra cells, each case noted in a warning list; if the separator row is missing entirely, an option adds one for you instead of failing.