-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated the documentation for new preprocessor format #787
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,10 @@ description = "The example book covers examples." | |
build-dir = "my-example-book" | ||
create-missing = false | ||
|
||
[preprocess] | ||
index = true | ||
linkes = true | ||
|
||
[output.html] | ||
additional-css = ["custom.css"] | ||
|
||
|
@@ -27,7 +31,6 @@ It is important to note that **any** relative path specified in the in the | |
configuration will always be taken relative from the root of the book where the | ||
configuration file is located. | ||
|
||
|
||
### General metadata | ||
|
||
This is general information about your book. | ||
|
@@ -59,10 +62,8 @@ This controls the build process of your book. | |
will be created when the book is built (i.e. `create-missing = true`). If this | ||
is `false` then the build process will instead exit with an error if any files | ||
do not exist. | ||
- **preprocess:** Specify which preprocessors to be applied. Default is | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to mention the I've also added a couple tests in 18a36ec to make sure the |
||
`["links", "index"]`. To disable default preprocessors, pass an empty array | ||
`[]` in. | ||
|
||
### Configuring Preprocessors | ||
|
||
The following preprocessors are available and included by default: | ||
|
||
|
@@ -71,14 +72,39 @@ 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. | ||
|
||
- `emoji`: Convert `:emoji:` text into Emojis. eg: `:smile:` to :smile: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ooh, there's an |
||
|
||
**book.toml** | ||
```toml | ||
[build] | ||
build-dir = "build" | ||
create-missing = false | ||
preprocess = ["links", "index"] | ||
|
||
[preprocess] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will need to be changed to something like: [preprocess.links]
[preprocess.index]
[preprocess.emoji] Although those three preprocessors will be enabled by default, so it's kinda redundant to even mention them... |
||
links = true | ||
index = true | ||
emoji = true | ||
``` | ||
|
||
#### Locking a Preprocessor dependency to a renderer | ||
|
||
You can explicitly specify that a preprocessor should run for a renderer by binding the two together. | ||
|
||
``` | ||
[preprocessor.mathjax] | ||
renderers = ["html"] # mathjax only makes sense with the HTML renderer | ||
``` | ||
|
||
#### Nested Configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section will probably need to mention that, like renderers, each preprocessor will always need to be given its own table (e.g. |
||
|
||
Where a preprocessor has more complex configuration available to it, use the | ||
following style of configuration. | ||
|
||
``` | ||
[preprocess.links] | ||
# set the renderers this preprocessor will run for | ||
renderers = ["html"] | ||
some_extra_feature = true | ||
``` | ||
|
||
### HTML renderer options | ||
|
@@ -214,4 +240,4 @@ book's title without needing to touch your `book.toml`. | |
|
||
The latter case may be useful in situations where `mdbook` is invoked from a | ||
script or CI, where it sometimes isn't possible to update the `book.toml` before | ||
building. | ||
building. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct. Each preprocessor gets its own table and you can enable/disable inserting the default preprocessors by setting
build.use-default-preprocessors
totrue
.