Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avitex/mdbook-tera
Tera preprocessor for mdBook
https://github.com/avitex/mdbook-tera
mdbook rust-lang tera
Last synced: 28 days ago
JSON representation
Tera preprocessor for mdBook
- Host: GitHub
- URL: https://github.com/avitex/mdbook-tera
- Owner: avitex
- License: mit
- Created: 2020-02-26T06:14:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-22T09:44:48.000Z (over 1 year ago)
- Last Synced: 2024-10-13T15:55:16.207Z (2 months ago)
- Topics: mdbook, rust-lang, tera
- Language: Rust
- Homepage:
- Size: 115 KB
- Stars: 19
- Watchers: 4
- Forks: 5
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - avitex/mdbook-tera - Tera preprocessor for mdBook (others)
README
[![Build Status](https://github.com/avitex/mdbook-tera/workflows/build/badge.svg)](https://github.com/avitex/mdbook-tera/actions?query=workflow:build)
[![Crate](https://img.shields.io/crates/v/mdbook-tera.svg)](https://crates.io/crates/mdbook-tera)
[![Docs](https://docs.rs/mdbook-tera/badge.svg)](https://docs.rs/mdbook-tera)# mdbook-tera
**[Tera](https://github.com/Keats/tera) preprocessor for [mdBook](https://github.com/rust-lang/mdBook)**
API documentation hosted on [docs.rs](https://docs.rs/mdbook-tera).```text
$ mdbook-tera --help
mdbook-tera 0.5.1
A mdBook preprocessor that renders TeraUSAGE:
mdbook-tera [OPTIONS] [SUBCOMMAND]OPTIONS:
-h, --help Print help information
--json Sets context from JSON file
--template-include Include tera templates matching a glob expression [default:
**/*.tera]
--template-root Root directory to include templates from [default: ./src]
--toml Sets context from TOML file
-V, --version Print version informationSUBCOMMANDS:
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.
```text
cargo install mdbook-tera
```Then in your `book.toml` file, add the tera preprocessor as below.
### Default Configuration
```toml
# Default options, load a TOML context file from ./src/context.toml
[preprocessor.tera]
```### JSON Configuration
```toml
[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`.```md
# My Heading{{ my_value }}
```