Update docs and tweak error messages.

This commit is contained in:
Eric Huss 2020-04-21 15:34:59 -07:00
parent 6b550cb4bb
commit 2732c5e8f7
3 changed files with 18 additions and 10 deletions

View File

@ -331,7 +331,7 @@ the usual `RUST_LOG` to control logging verbosity.
## Handling missing backends ## Handling missing backends
If you should enable a backend that isn't installed, the default behavior is to throw an error: If you enable a backend that isn't installed, the default behavior is to throw an error:
```text ```text
The command wasn't found, is the "wordcount" backend installed? The command wasn't found, is the "wordcount" backend installed?

View File

@ -306,11 +306,17 @@ specify which preprocessors should run before the Markdown renderer.
A custom renderer can be enabled by adding a `[output.foo]` table to your A custom renderer can be enabled by adding a `[output.foo]` table to your
`book.toml`. Similar to [preprocessors](#configuring-preprocessors) this will `book.toml`. Similar to [preprocessors](#configuring-preprocessors) this will
instruct `mdbook` to pass a representation of the book to `mdbook-foo` for instruct `mdbook` to pass a representation of the book to `mdbook-foo` for
rendering. rendering. See the [alternative backends] chapter for more detail.
Custom renderers will have access to all configuration within their table The custom renderer has access to all the fields within its table (i.e.
(i.e. anything under `[output.foo]`), and the command to be invoked can be anything under `[output.foo]`). mdBook checks for two common fields:
manually specified with the `command` field.
- **command:** The command to execute for this custom renderer. Defaults to
the name of the renderer with the `mdbook-` prefix (such as `mdbook-foo`).
- **optional:** If `true`, then the command will be ignored if it is not
installed, otherwise mdBook will fail with an error. Defaults to `false`.
[alternative backends]: ../for_developers/backends.md
## Environment Variables ## Environment Variables

View File

@ -166,15 +166,17 @@ impl CmdRenderer {
}; };
if is_optional { if is_optional {
warn!("The command was not found, but was marked as optional."); warn!(
warn!("\tCommand: {}", self.cmd); "The command `{}` for backend `{}` was not found, \
but was marked as optional.",
self.cmd, self.name
);
return Ok(()); return Ok(());
} else { } else {
error!( error!(
"The command wasn't found, is the \"{}\" backend installed?", "The command `{}` wasn't found, is the `{}` backend installed?",
self.name self.cmd, self.name
); );
error!("\tCommand: {}", self.cmd);
} }
} }
_ => {} _ => {}