Updated documentation to reflect changes to Chapter and preprocessors.

This commit is contained in:
Adam Kerrigan 2021-02-15 17:01:43 +00:00
parent 0b9570b160
commit bd23d3ce56
2 changed files with 23 additions and 0 deletions

View File

@ -105,6 +105,25 @@ The following preprocessors are available and included by default:
- `index`: Convert all chapter files named `README.md` into `index.md`. That is
to say, all `README.md` would be rendered to an index file `index.html` in the
rendered book.
- `metadata`: Reads an optional TOML header from the markdown chapter sources
to provide chapter specific information. This data is then made available to
handlebars.js. The supported fields are `author`, `title`, `description`, `keywords`,
`date` and `modified`.
**Sample Chapter**
```toml
---
author = "Jane Doe" # this is written to the author meta tag
title = "Blog Post #1" # this overwrites the default title handlebar
date = "2021/02/14"
keywords = [
"Rust",
"Blog",
] # this sets the keywords meta tag
description = "A blog about rust-lang" # this sets the description meta tag
---
This is my blog about rust.
```
**book.toml**
@ -116,6 +135,8 @@ create-missing = false
[preprocessor.links]
[preprocessor.index]
[preprocessor.metadata]
```
### Custom Preprocessor Configuration

View File

@ -38,6 +38,8 @@ Here is a list of the properties that are exposed:
containing all the chapters of the book. It is used for example to construct
the table of contents (sidebar).
Further properties can be exposed through the `chapter_config` field of a `Chapter` which is accessible to preprocessors.
## Handlebars Helpers
In addition to the properties you can access, there are some handlebars helpers