mdformat
$ mdformat Community Low Riskmdformat is an opinionated Python Markdown formatter enforcing canonical CommonMark formatting (with GFM, frontmatter, and table extensions via plugins). Its --check flag provides a clean non-mutating CI gate, while normal invocation normalizes files in place or via stdin/stdout (-).
brew install mdformat Local Markdown formatting via mdformat operates directly on repository files with no MCP benefit.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic headless CLI with --check exit codes, stdin (-) support, and --end-of-line control, though it lacks --json reporting.
--checkflag gives clean 0/non-zero CI status without writing- Supports
-stdin-to-stdout formatting
100% offline local formatter; --check guarantees read-only verification before in-place writes.
--checkperforms zero filesystem writes
Available via Homebrew, pip, and uvx across macOS, Linux, and Windows.
- Easy install via
brew install mdformatoruvx mdformat
Keeps agent-generated Markdown cleanly normalized in a single deterministic command.
- Canonical Black-like opinionated formatting for Markdown
Well-maintained open-source repository (hukkin/mdformat) under MIT license.
- Stable releases on PyPI and Homebrew
Clear Read the Docs manual covering CLI options, .mdformat.toml, and plugin extensions.
- Official docs at mdformat.readthedocs.io
Security, Auth & Guardrails
None required; operates strictly on local Markdown files or stdin.
100% free, offline, and MIT open-source.
# mdformat Agent Rules - Run `mdformat --check <paths>` first to verify whether reformatting is actually needed. - Confirm whether GFM tables/frontmatter plugins (e.g., `mdformat-gfm`) are configured before reformatting docs containing non-CommonMark syntax.
Agent-Ready Command Recipes
Safe Read-Only Queries
mdformat --check README.md docs/
Verifies whether files match canonical CommonMark style and exits non-zero if any file needs reformatting.
Controlled Writes & Previews
mdformat --end-of-line lf docs/
Formats Markdown files under docs/ using Unix LF line endings.
Strengths for Agents
- + Deterministic, Black-style opinionated CommonMark formatting with zero style bikeshedding.
- +
--checkflag provides an explicit read-only verification mode. - + Supports stdin/stdout (
-) and--end-of-linenormalization.
Caveats & Pitfalls
- ! GFM tables, task lists, and YAML frontmatter require extra plugins (
mdformat-gfm,mdformat-frontmatter) to avoid escaping. - ! No
--jsonoutput for programmatic diff summaries.