#mdbook #tera #preprocessor

bin+lib mdbook-tera

Tera preprocessor for mdBook

7 releases (4 breaking)

0.5.0 Jan 7, 2022
0.4.2 Dec 29, 2021
0.4.1 Nov 5, 2021
0.4.0 Oct 6, 2020
0.1.0 Feb 27, 2020

#345 in Command line utilities

Download history 4/week @ 2021-10-07 6/week @ 2021-10-14 7/week @ 2021-10-21 7/week @ 2021-10-28 36/week @ 2021-11-04 21/week @ 2021-11-11 83/week @ 2021-11-18 78/week @ 2021-11-25 78/week @ 2021-12-02 110/week @ 2021-12-09 107/week @ 2021-12-16 82/week @ 2021-12-23 88/week @ 2021-12-30 110/week @ 2022-01-06 82/week @ 2022-01-13 74/week @ 2022-01-20

375 downloads per month

MIT license

14KB
286 lines

Build Status Crate Docs

mdbook-tera

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

$ mdbook-tera --help
mdbook-tera 0.5.0
A mdBook preprocessor that renders Tera

USAGE:
    mdbook-tera [OPTIONS] [SUBCOMMAND]

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

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

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 }}

Dependencies

~12MB
~222K SLoC