Write it once, sync it everywhere. Doc drift is dead.
Markdown templates that keep your READMEs, doc comments, and docs sites in lockstep — with data interpolation, transformers, and CI verification.
mdt helps library and tool maintainers keep README sections, source-doc comments, and docs-site content synchronized across a project. Define content once with comment-based template tags, then reuse it across markdown files, code documentation comments, READMEs, mdbook docs, and more so your docs do not drift.
You have the same install instructions in three places:
readme.md:
## Installation
npm install my-libsrc/lib.rs:
//! ## Installation
//!
//! npm install my-lib
docs/getting-started.md:
## Installation
npm install my-libYou update one. The others drift. CI doesn't catch it.
Define it once in a *.t.md template file (the "t" stands for template):
<!-- {@install} -->
npm install my-lib
<!-- {/install} -->Use it everywhere:
<!-- {=install} -->
(replaced automatically)
<!-- {/install} -->Run mdt update — all three files are in sync. Run mdt check in CI — drift is caught before merge.
- Install with npm:
npm install -g @m-d-t/cli- Or run it without installing:
npx @m-d-t/cli --help- Or download a prebuilt binary from the latest GitHub release
- Or install with Cargo:
cargo install mdt_climkdir my-project && cd my-project
mdt initThis creates .templates/template.t.md (your source blocks) and mdt.toml (config).
In .templates/template.t.md:
<!-- {@greeting} -->
Hello from mdt!
<!-- {/greeting} -->In readme.md:
<!-- {=greeting} -->
<!-- {/greeting} -->mdt updateEvery target block named greeting now has the same content. Run mdt check in CI to catch drift.
- Template Syntax
- CLI Reference
- Data Interpolation
- Transformers
- CI Integration
- Source File Support
- Proof of Value
- Migration Walkthrough
If you use a coding agent that supports the Agent Skills standard (like Pi), install the official mdt skill:
pi install npm:@m-d-t/skillsThe @m-d-t/skills package teaches your agent template syntax, MCP tools, CLI workflows, transformer patterns, and configuration — so it can fully manage your project's documentation templates.
| Crate | Description |
|---|---|
mdt_core |
Core library — lexer, parser, scanner, and template engine |
mdt_cli |
CLI tool — mdt binary for managing templates |
mdt_lsp |
LSP server — editor integration with diagnostics, completions, hover, and more |
mdt_mcp |
MCP server — AI assistant integration via the Model Context Protocol |
devenv is used to provide a reproducible development environment for this project. Follow the getting started instructions.
To automatically load the environment you should install direnv and then load the direnv.
# The security mechanism didn't allow to load the `.envrc`.
# Since we trust it, let's allow it execution.
direnv allow .At this point you should see the nix commands available in your terminal. Run install:all to install all tooling and dependencies.