LegalMark is a markup language designed for structured legal and regulatory documents such as policies, regulatory business plans, contracts, and procedures. It enforces explicit document hierarchy, supports automatic numbering, and separates content from presentation.
- C 43.5%
- Python 42%
- C++ 7%
- Vim Script 3%
- Tree-sitter Query 2.5%
- Other 2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- 19.5: spacing, the gap between a header or footer and the body text - 19.8: marker-indent, the bullet or number position; say what indent measures Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c0b4c-6be3-71bd-98e6-f2fa23d2b5d7 |
||
| editors | ||
| src/legalmark | ||
| tests | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
| REVIEW-v0.2.1.md | ||
| SPECIFICATION.md | ||
| uv.lock | ||
LegalMark
A markup language for structured legal and regulatory documents. See SPECIFICATION.md.
This repository also contains the Python reference implementation, and syntax highlighting for Helix, Zed, VS Code, and Vim in editors/.
Development
uv sync
uv run pytest
uv run legalmark check path/to/document.lm # validate and print the numbered outline
uv run legalmark html path/to/document.lm # write document.html (self-contained, images embedded)
uv run legalmark pdf path/to/document.lm # write document.pdf
uv run legalmark parse path/to/document.lm # print the parsed tree as JSON (--resolved to number it)
html and pdf refuse to write output when the document has errors; --force overrides this. PDF output uses WeasyPrint, which is installed with the pdf extra (pip install legalmark[pdf]) and in the development environment.
Conformance tests
tests/conformance/ holds the language-independent conformance suite. Each NAME.lm file is paired with its expected outcome:
NAME.ast.json: the document parses without errors and produces this tree.NAME.resolved.json: the document compiles without diagnostics, and its numbering, references and terms match this summary.NAME.diagnostics: the document produces exactly these diagnostics, one per line, asLINE SEVERITY CODE(for example4 error unknown-element).
See specification Section 21.2 for the details.