Skip to content

ifiokjr/mdt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

182 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

mdt

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.


Status Coverage Unlicense


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.

The Problem

You have the same install instructions in three places:

readme.md:

## Installation

npm install my-lib

src/lib.rs:

//! ## Installation
//!
//! npm install my-lib

docs/getting-started.md:

## Installation

npm install my-lib

You update one. The others drift. CI doesn't catch it.

The Fix

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.

Installation

  • Install with npm:
npm install -g @m-d-t/cli
  • Or run it without installing:
npx @m-d-t/cli --help
cargo install mdt_cli

Quick Start

1. Initialize

mkdir my-project && cd my-project
mdt init

This creates .templates/template.t.md (your source blocks) and mdt.toml (config).

2. Define a source block

In .templates/template.t.md:

<!-- {@greeting} -->

Hello from mdt!

<!-- {/greeting} -->

3. Use it in your README

In readme.md:

<!-- {=greeting} -->
<!-- {/greeting} -->

4. Sync

mdt update

Every target block named greeting now has the same content. Run mdt check in CI to catch drift.

Learn More

Agent Skill Package

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/skills

The @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.

Crates

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

Contributing

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.

About

Write it once, sync it everywhere; documentation drift is dead.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors