Catch broken code examples before users do.
Validate code blocks in Markdown and MDX documentation. Go, TypeScript, Rust, Nix, HCL, and Templ. Pure Go, no CGO. CI-friendly.
# Validate all Go code blocks in your docs
md-go-validator .
# JSON output for CI
md-go-validator -f json -o results.json .
# Multiple languages
md-go-validator -l go,typescript,rust . Built for documentation that ships.
Every feature designed for real-world CI pipelines and developer workflows.
Multi-Language Validation
Go (built-in parser), TypeScript, TSX, Rust, Nix, HCL/Terraform, and Templ — all embedded, no external tools.
6-Strategy Go Parser
Progressive parsing handles partial snippets: complete files, package wrappers, function bodies, expressions, statements, and imports.
CI-Friendly Output
Table, JSON, YAML, CSV, Markdown, SARIF, and quiet formats. Structured exit codes (0/1/2) for pipeline integration.
Pure Go, No CGO
Uses gotreesitter (pure-Go tree-sitter) for multi-language parsing. Compiles to any GOOS/GOARCH with zero C dependencies.
Baseline Regression Mode
Generate a baseline of known errors, then fail only on new issues. Perfect for incremental adoption in existing projects.
Skip Directives
Mark intentionally incomplete snippets with <!-- skip-validate -->. Custom directives configurable via YAML.
How it works.
Four-step pipeline from markdown to validation report.
Extract
Scan Markdown and MDX files for fenced code blocks. Recursive directory traversal with glob excludes.
Route
Each block is routed to the correct language validator via the registry. Auto-detected from the info string.
Validate
Go blocks pass through 6 progressive parsing strategies. Other languages use embedded tree-sitter parsers.
Report
Results in table, JSON, YAML, CSV, Markdown, SARIF, or quiet format. Structured exit codes for CI.
Why md-go-validator?
Purpose-built for documentation validation. Not a generic linter.
Drop it into any workflow.
CI pipelines, pre-commit hooks, GitHub Actions, or your own Go tools.
CI Pipelines
Block PRs that break documentation code examples
Pre-commit Hooks
Catch errors locally before they reach CI
GitHub Actions
Built-in action with zero install needed
Library Integration
Embed validation in your own Go tools
SARIF Reports
Upload results to GitHub Code Scanning
Start validating in seconds.
One install, one command, zero broken docs.