Auto-fix Markdown Tables
Automatically detect and fix misaligned markdown tables across all .md files in the project.
Step 1: Run the formatter
Preferred — the project's own task
Specs projects ship a task for this. Check first:
task --list | grep -E 'md:(fix-tables|fixstyle)'
task md:fix-tables # tables only
task md:fixstyle # tables + markdownlint --fix
Use md:fixstyle when the project also lints markdown in CI (a Markdown workflow running
markdownlint-cli2) — aligning tables alone can still leave the linter red.
Fallback — no Taskfile in this project
docker run --rm --volume $(pwd):/app --workdir /app node:24.15.0-bookworm bash -c "shopt -s globstar && npx --yes markdown-table-formatter **/*.md"
This command:
- Mounts the current directory into a Node.js 24 container
- Uses
shopt -s globstarto enable recursive**glob expansion in bash - Runs
markdown-table-formatteron every.mdfile found recursively - Modifies files in-place — no output is written elsewhere
Step 2: Review the changes
After the formatter runs, check what was changed:
git diff --stat
For a detailed view of the actual table changes:
git diff
Verify that only whitespace/padding inside table cells changed — no content, wording, or structure should be altered. If unexpected changes appear, investigate before proceeding.
Step 3: Confirm
If the diff looks correct, the tables are properly aligned and the files are ready to commit. No further action is needed.