cat rough.txt | bx fix
Before → After
+----------+ +----------+
| Frontend |----->| API |
+----------+ +----------+
|
v
+---------+
| Auth |
+---------+
┌──────────┐ ┌─────┐
│ Frontend │───▶│ API │
└──────────┘ └─────┘
│
▼
┌──────┐
│ Auth │
└──────┘
Features
- Parses rough ASCII & Unicode — tolerates misaligned corners, overflowing labels, broken edges
- Preserves your layout — fixes alignment without rearranging boxes
-
4 box styles — single
┌─┐, rounded╭─╮, double╔═╗, bold┏━┓ - Markdown mode — fix diagrams inside code blocks
- Pipe-friendly — stdin/stdout, composes with other tools
- Single binary — Go, no runtime dependencies
Install
Go
go install github.com/justEstif/bx@latest
mise
mise use -g go:github.com/justEstif/bx@latest
mise reshim
From source
git clone https://github.com/justEstif/bx.git
cd bx && go build -o bx .
Usage
# Fix from stdin
cat rough.txt | bx fix
# Choose style: single (default), rounded, double, bold
echo '...' | bx fix --style rounded
# Fix diagrams inside markdown code blocks
bx fix --markdown README.md
# Fix a file directly
bx fix diagram.txt
Styles
┌──────┐
│ Auth │
└──────┘
╭──────╮
│ Auth │
╰──────╯
╔══════╗
║ Auth ║
╚══════╝
┏━━━━━━┓
┃ Auth ┃
┗━━━━━━┛
Why?
LLMs and humans constantly produce broken ASCII diagrams — misaligned
corners, off-by-one edges, inconsistent characters.
bx takes that mess and snaps everything into geometrically
perfect Unicode box-drawing. Works in terminals and markdown code
blocks.