guidebook supports Nunjucks/Jinja2 template syntax in Markdown files, powered by the Tera template engine.
Define variables in book.json and use them in Markdown:
{
"variables": {
"version": "2.0.0",
"appName": "My App"
}
}
Current version: {{ book.version }}
Welcome to {{ book.appName }}!
{% if book.version %}
Version: {{ book.version }}
{% else %}
Version not set
{% endif %}
{% elif %} is also supported.
{% for item in book.features %}
- {{ item }}
{% endfor %}
The loop.index variable is available inside loops (1-based).
| Filter | Description |
|---|---|
upper | Convert to uppercase |
lower | Convert to lowercase |
capitalize | Capitalize first letter |
length | Get the length |
default(value="fallback") | Provide a fallback value |
Example:
{{ book.appName | upper }}
{{ book.subtitle | default(value="No subtitle") }}
Template syntax inside code blocks (` and ```) is not processed. This lets you document template syntax without it being evaluated.