v0.1.0
First release of the LegalDown reference implementation: a parser, document model, serializer, and validator for the LegalDown plain-text legal document format.
Targets specification v0.1 at conformance Level 1 — Core (§16.2): parse and validate a single document.
What's in it
- Parser and document model — YAML frontmatter plus a heading/block document tree, with
{#identifier}anchors on headings, list items, and paragraphs. - Validator — the §15 rule set at Core level. Every diagnostic carries the specification's stable rule id (§15.1) and severity, so tooling can suppress one check, escalate another, or gate a build on exactly the rules it cares about.
- Serializer —
Documentback to LegalDown source. - Definitions (§7) — quoted term followed by
{{def:}}, across the eight accepted quotation mark pairs, with auto-derived identifiers. - Command line —
legaldown validatewith plain-text and JSON output (§15.9),--ignoreby rule id,--warnings-as-errors,--strict, recursive directory walking, and exit codes suitable for gating a build. SPEC_VERSIONandCONFORMANCE_LEVELexported so consumers can assert what they validate against.
Frontmatter is read as exactly the shape §3 defines, and the parser never rewrites its input to make a document valid — what you authored is what the validator judges.
Conformance
Verified against the specification's own fixtures corpus: 57 of the corpus's 95 rules are implemented, and every one the corpus exercises at Core level passes. Per §16.5, the rules that are not implemented are named in CONFORMANCE.md rather than left to be discovered — they are the ones needing filesystem access: includes, attachment file contents, and bilingual document sets.
Install
pip install legaldown-validator
Python 3.11+. The distribution is legaldown-validator; the import name is legaldown. Only dependency: PyYAML. Ships a py.typed marker.