Legal contracts in plain text
An open format for drafting contracts in Markdown.
Write Markdown. Get professional output.
Lexicon contracts are valid Markdown that renders anywhere — GitHub, Obsidian, VS Code. When you need formatted output, processors handle numbering, cross-references, and formatting automatically.
---
title: Service Agreement
date:
parties:
- name: Acme Corp
role: Provider
- name: ClientCo
role: Client
---
1. ## Definitions {#definitions}
1. **Service Fee** means the fee set out in the Schedule.
2. **Services** means the services described in [clause 3](#services).
2. ## Payment {#payment}
1. The Client shall pay the Service Fee within 30 days of invoice.
3. ## Services {#services}
1. The Provider shall supply the Services in accordance with the terms of this Agreement.
Why Lexicon
Get started in two commands
Install a Lexicon processor, point it at your Markdown contract, and get formatted output.
# Install the processor
$ cargo install lexicon-docx
# Convert a contract
$ lexicon-docx build contract.md -o contract.docx
✓ contract.docx written (12 clauses, 4 cross-references resolved)
Questions
Why plain text?
Legal contracts change constantly — across drafts, between parties, through negotiations. In Word, tracking those changes means "Track Changes" annotations that accumulate, confuse, and eventually get accepted into an opaque binary. In plain text, every change is a clean diff. Version control tools like Git give you a complete, line-by-line history of who changed what, when, and why — across every draft, not just the last round of redlines.
How does Lexicon work with other tools?
Because Lexicon contracts are plain text, they work natively with any tool that reads text. Need to generate hundreds of NDAs with different party names? Script it. Want an LLM to review a contract for missing clauses or inconsistent definitions? It can read the source directly — no parsing binary formats, no losing structure. The contract is the data.
Is this legally valid?
Lexicon is a format for drafting and managing contracts, not a replacement for legal review. The output is a standard document in whatever format you choose — Word, PDF, HTML. The contract's legal validity depends on its content and execution, not the tool used to write it.
Can I use my existing contracts?
Yes. Lexicon is standard Markdown with a few conventions for legal structure (clause numbering, defined terms, cross-references). The easiest way to convert an existing contract is to upload the .docx along with the Lexicon spec to an LLM — the conversion is near-trivial. From there, you have a plain-text source of truth you can version, automate, and build on.
What does the processor handle automatically?
Lexicon processors convert your Markdown to formatted output with: hierarchical clause numbering (1, 1.1, (a), (i)), cross-reference resolution, defined term validation, cover pages from YAML metadata, tables of contents, signature blocks, schedule generation, and draft watermarks. You write the content; the processor handles the formatting.
What's the relationship between Lexicon and Markdown?
Every Lexicon document is valid Markdown. Lexicon adds conventions — like YAML front matter for parties and metadata, specific heading patterns for clauses, and anchor syntax for cross-references — but nothing that breaks standard Markdown rendering. Your contracts will display correctly on GitHub, in Obsidian, or in any Markdown viewer, even without a Lexicon processor.