Expand description
mdt is a data-driven template engine for keeping documentation
synchronized across your project. It uses comment-based template tags to
define content once and distribute it to multiple locations — markdown
files, code documentation comments (in any language), READMEs, mdbook docs,
and more.
Re-exports§
Modules§
Structs§
- Block
- Check
Result - Result of checking a project for stale consumers.
- Ordered
Float - A float wrapper that implements
Eqvia approximate comparison, allowingArgumentto derivePartialEqcleanly. - Point
- One place in a source file. This is taken from the [unist] crate with the
Copytrait added. - Position
- Location of a node in a source file. This is taken from the
unistcrate with theCopytrait added. - Stale
Entry - A consumer entry that is out of date.
- Transformer
- Update
Result - Result of updating a project.
Enums§
Functions§
- apply_
transformers - Apply a sequence of transformers to content.
- build_
blocks_ from_ groups - Build blocks from already-tokenized groups. This is the shared logic used by both markdown parsing and source file scanning.
- build_
blocks_ from_ groups_ lenient - Like
build_blocks_from_groups, but silently discards unclosed blocks instead of returning an error. Used for source files where HTML comments may appear in string literals without matching close tags. - check_
project - Check whether all consumer blocks in the project are up to date. Consumer blocks that reference non-existent providers are silently skipped.
- compute_
updates - Compute the updated file contents for all consumer blocks.
- extract_
html_ comments - Extract HTML comments (
<!-- ... -->) from raw text content, returningHtmlnodes with correct byte positions. This is used for source files where the markdown AST parser won’t find HTML comments inside code comments. - get_
html_ nodes - parse
- Parse markdown content and return all blocks (provider and consumer) found within it.
- parse_
source - Parse source code content (non-markdown) for mdt blocks by extracting HTML comments directly from the raw text.
- render_
template - Render provider content through minijinja using the given data context. If data is empty or the content has no template syntax, returns the content unchanged.
- validate_
transformers - Validate that all transformer arguments are well-formed. Returns an error for the first invalid transformer found.
- write_
updates - Write the updated contents back to disk.