mdbook-tera

Crates.iomdbook-tera
lib.rsmdbook-tera
version0.6.0
created_at2020-02-27 02:19:34.315984+00
updated_at2025-10-05 06:51:24.857757+00
descriptionTera preprocessor for mdBook
homepagehttps://github.com/avitex/mdbook-tera
repositoryhttps://github.com/avitex/mdbook-tera
max_upload_size
id212932
size56,576
James (avitex)

documentation

https://docs.rs/mdbook-tera

README

Build Status Crate Docs

mdbook-tera

Tera preprocessor for mdBook API documentation hosted on docs.rs.

$ mdbook-tera --help
Tera preprocessor for mdBook

Usage: mdbook-tera [OPTIONS] [COMMAND]

Commands:
  supports  Check whether a renderer is supported by this preprocessor
  help      Print this message or the help of the given subcommand(s)

Options:
      --json <FILE>              Sets context from JSON file
      --toml <FILE>              Sets context from TOML file
      --template-root <PATH>     Root directory to include templates from [default: ./src]
      --template-include <GLOB>  Include tera templates matching a glob expression [default: **/*.tera]
  -h, --help                     Print help
  -V, --version                  Print version

Usage

First install the tera preprocessor.

cargo install mdbook-tera

Then in your book.toml file, add the tera preprocessor as below.

Default Configuration

# Default options, load a TOML context file from ./src/context.toml
[preprocessor.tera]

JSON Configuration

[preprocessor.tera]
command = "mdbook-tera --json ./src/context.json"

Usage in Markdown files

See example-book for a basic usage.

Simply define your values in the context.toml file, and use them in tera statements. You can access the book context with the key ctx.

# My Heading

{{ my_value }}
Commit count: 44

cargo fmt