Linter
The linter inspects an all2md AST Document and reports structural,
heading, link, list, table, image, and typography issues via a rule-based
engine. Because it operates on the AST, it works against every format
all2md can parse. A subset of rules carry safe auto-fixes that the framework
applies in place when the user passes --fix (or calls
lint_and_fix_document from Python).
For CLI usage, rule catalogue, and --fix documentation, see Command Line Interface
(Lint Command section) and Configuration Files ([tool.all2md.lint]).
Public Entry Points
Lint an already-parsed |
|
Parse |
|
Lint and fix |
|
Parse, lint+fix, and rewrite |
|
Run a |
|
Result of linting a single document. |
|
Result of running |
|
Frozen configuration for a lint run. |
Violations
Severity levels for lint violations. |
|
A single lint violation emitted by a rule. |
Auto-Fix Framework
Fixes are attached to violations via the Violation.fix field. The
framework applies them through all2md.linter.fixes.apply_fixes() (or
the LintRunner.lint_and_fix_* convenience wrappers). Rule authors call
LintRule.build_violation() with a fix=LintFix(...) kwarg to attach
a fix.
Safety classification for an auto-fix. |
|
A fix attached to a |
|
Mutation primitives passed to |
|
Record of a fix that was (or would have been) applied. |
|
Apply every fix attached to |
Rule Base and Registry
Every built-in and third-party rule subclasses LintRule and is registered
with the process-wide rule_registry singleton. Plugins can register
additional rules via the all2md.lint_rules entry point group (see
Plugin Development Guide).
Abstract base class for lint rules. |
|
Input passed to every |
|
Singleton registry mapping rule codes to |
The module-level all2md.linter.rule_registry instance is the preferred
access point for the singleton — import it directly rather than instantiating
RuleRegistry by hand.
Reporters
Abstract base for reporters. |
|
Return a reporter by short name. |
|
Render lint results in a ruff-style single-line-per-violation format. |
|
Render lint results as JSON suitable for CI consumption. |