Skip to main content
Monogrid ensures every line in a Unicode box drawing has the same visual width — accounting for CJK characters (2 columns), emoji (2 columns), combining marks (0 width), and ASCII (1 column). The width tables are Q.E.D verified across xterm.js, Alacritty, and Ghostty.

Quick Start

Monogrid is a single binary (2.2 MB) with no runtime dependencies.

Installation

Included with the Monolex app, or install via:
Monogrid is part of the mono- CLI family:

Commands

check — Inspect Without Modifying

Implicit check: monogrid file.md works without the check keyword. Exit code 0 if no issues, 1 if issues found.

fix — Auto-Fix with Loop

Repeats check-fix cycles until 0 issues or max iterations reached.
This command modifies files in place.

qed — Q.E.D Deep Verification

Character-by-character width analysis. For each box:
  • Calculates visual width of every line
  • Lists every non-ASCII character with its Unicode codepoint and width
  • Groups by category (COMBINING, BMP_WIDE, HIGH_WIDE, DEFAULT)
  • Verifies recalculated width matches expected
Only meaningful after all issues are fixed.

structure — Structural Analysis

Detects inner boxes that overflow outer box boundaries. Shows left/right margins for each nested box. Cannot be auto-fixed — requires manual redesign.

report — Compact File Survey

One-line-per-file summary sorted by issue count. Useful for surveying large documentation sets before batch fixing.

Workflow


What It Checks

Monogrid enforces 9 alignment rules: Rules 1 and 6 are auto-fixable. All other rules require manual correction because they need semantic understanding of the diagram.

Width Rules

CodexMono renders characters at these widths:
Common mistake: ⚠ (U+26A0) is width 1, not 2. But ⚡ (U+26A1) is width 2. These are only 1 codepoint apart but have different widths. Monogrid’s tables handle this correctly.

Self-Verification

Monogrid’s own --help output passes monogrid check with 0 issues:

Origin

Monogrid is an exact port of check-boxes.py v5.7 (Python, 1,984 lines) to Rust (2,719 lines). The Unicode width tables were verified through ASURA 3-Phase Research across three terminal emulators. Both versions produce identical results on all test files.