Auto-fix alignment in markdown docs
Project description
Overview
CLI utility that auto-fixes alignment issues in markdown documentation files - tables, box-drawing diagrams, list descriptions, and more.
┌────────────────────────┐ ┌────────────────────────┐
│ ┌────┐ ┌────┐ │ │ ┌────┐ ┌────┐ │
│ │ A │ │ B │ │ │ │ A │ │ B │ │
│ └──┬─┘ └──┬─┘ │ │ └──┬─┘ └──┬─┘ │
│ │ │ │ │ │ │ │
│ └────┬───┘ │ --> │ └────┬───┘ │
│ v │ │ v │
│ ┌──────┐ │ │ ┌──────┐ │
│ │ C │ │ │ │ C │ │
│ └──────┘ │ │ └──────┘ │
└────────────────────────┘ └────────────────────────┘
More examples
Tables
| Service | Usage | | Service | Usage |
|----------------|-------------------------------| |----------------|-------------------------------|
| Linear API | Status transitions, comments| --> | Linear API | Status transitions, comments |
| GitHub API| Repo clone, PR creation | | GitHub API | Repo clone, PR creation |
List descriptions
- docs/repo.md - mirrors CI steps - docs/repo.md - mirrors CI steps
- docs/guides/testing-strategy.md - test suite --> - docs/guides/testing-strategy.md - test suite
Box widths
┌──────────────┐ ┌──────────────┐
│ Linear UI │ --> │ Linear UI │
│ (userscript)│ │ (userscript)│
└──────────────┘ └──────────────┘
Rail alignment
┌──────┬──────┐ ┌──────┬──────┐
│ │ │ │ │ │
│ │ │ --> │ │ │
│ │ │ │ │ │
└──────┴──────┘ └──────┴──────┘
Arrow alignment
┌──────┐ ┌──────┐
│ step │ │ step │
└──┬───┘ └──┬───┘
│ --> │
v v
┌──────┐ ┌──────┐
│ next │ │ next │
└──────┘ └──────┘
Pipe continuity
┌──────┬──────┐ ┌──────┬──────┐
│ src │ dest │ │ src │ dest │
└──────┴──┬───┘ └──────┴──┬───┘
│ --> │
│ │
│ │
┌─────────┴───┐ ┌─────────┴───┐
│ output │ │ output │
└─────────────┘ └─────────────┘
Box spacing
┌───────────┐ ┌────────────┐
│ errors[] │ │ errors[] │
│ (strings)│ --> │ (strings) │
└───────────┘ └────────────┘
Box walls
┌──────────────────┐ ┌──────────────────┐
│ content here │ │ content here │
│ more text │ --> │ more text │
└────────────────┘ └──────────────────┘
Motivation
In the era of agentic engineering, documentation is the most critical artifact in any codebase. It guides both humans and AI agents. When docs are visually harmonious - with aligned columns, consistent box widths, and straight connector lines - they become easier to read, parse, and maintain by everyone.
Features
- 3 modes - check (default), auto-fix in place, or unified diff
- flexible paths - files, directories, or glob patterns (e.g.
"docs/**/*.md") - CI-friendly - exit code 0 when aligned, 1 when issues found
- 12 alignment checks:
- Table columns - pads cells so every column matches the separator row width
- Box widths - ensures all lines in a box group have the same total length
- Box padding - normalizes left-padding of content lines inside boxes
- Horizontal arrows - closes gaps between
─>/<─arrow tips and box walls - Rail alignment - aligns vertically adjacent box chars to the same column
- Arrow alignment - aligns standalone
v/^arrows; detectsv/^embedded in borders - Pipe continuity - traces from T-junctions to detect drifted connector pipes
- Box spacing - ensures minimum right-side spacing between content and box wall
- Box walls - verifies nested box right walls match their opening/closing borders
- List descriptions - aligns the separator dash in list item descriptions
- Definition lists - aligns the
:separator inkey: valuelist items - Wide chars - detects ambiguous/double-width Unicode chars in code blocks
Commands
docalign <path> # check-only (default) - detect issues, no writes
docalign --check <path> # explicit check-only (same as default)
docalign --fix <path> # auto-fix files in place
docalign --diff <path> # show unified diff of what would change
docalign --verbose <path> # show actionable hints with each error
docalign --ignore tables,pipes <path> # skip specific checks
docalign --help # show help
docalign --version # show version
Paths can be files, directories, or glob patterns (e.g. "docs/**/*.md").
Check names for --ignore: tables, box-widths, box-padding, box-spacing, horiz-arrows, box-walls, rails, arrows, pipes, list-descs, def-lists, wide-chars.
Exit codes: 0 = all aligned, 1 = issues found.
Install
pipx install docalign
# pip install docalign
Update
pipx upgrade docalign
# pip install --upgrade docalign
Uninstall
pipx uninstall docalign
# pip uninstall docalign
Development
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest -v
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docalign-0.1.0.tar.gz.
File metadata
- Download URL: docalign-0.1.0.tar.gz
- Upload date:
- Size: 49.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
536e7de1839b5edf4b83955d80a120bea2e0eabe73acb7d948dc1f2dd9f5b70c
|
|
| MD5 |
05d1c8eb875a795071b5c25e73885612
|
|
| BLAKE2b-256 |
2d113a8904966876c1662e94fce0971e9ad1a99db9f473a69a179374cf41d318
|
Provenance
The following attestation bundles were made for docalign-0.1.0.tar.gz:
Publisher:
release.yml on lucasvtiradentes/doc-align
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docalign-0.1.0.tar.gz -
Subject digest:
536e7de1839b5edf4b83955d80a120bea2e0eabe73acb7d948dc1f2dd9f5b70c - Sigstore transparency entry: 961769584
- Sigstore integration time:
-
Permalink:
lucasvtiradentes/doc-align@c91944c0e4589f18a0919eb618b60f6b57d23c78 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lucasvtiradentes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c91944c0e4589f18a0919eb618b60f6b57d23c78 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file docalign-0.1.0-py3-none-any.whl.
File metadata
- Download URL: docalign-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5fbdff12355f51a2a2a0e21a39f6047941ecf000c6dc1088cdc84eb5431148f
|
|
| MD5 |
79db42f716fdd7b2507140663b811c4c
|
|
| BLAKE2b-256 |
316d81bae5274c034f139ab226bbd782133256e2ed330c1cfdb41d26a81ff44e
|
Provenance
The following attestation bundles were made for docalign-0.1.0-py3-none-any.whl:
Publisher:
release.yml on lucasvtiradentes/doc-align
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docalign-0.1.0-py3-none-any.whl -
Subject digest:
a5fbdff12355f51a2a2a0e21a39f6047941ecf000c6dc1088cdc84eb5431148f - Sigstore transparency entry: 961769674
- Sigstore integration time:
-
Permalink:
lucasvtiradentes/doc-align@c91944c0e4589f18a0919eb618b60f6b57d23c78 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lucasvtiradentes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c91944c0e4589f18a0919eb618b60f6b57d23c78 -
Trigger Event:
workflow_dispatch
-
Statement type: