Skip to content

Commit 2732c5e

Browse files
committed
Update docs and tweak error messages.
1 parent 6b550cb commit 2732c5e

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

book-example/src/for_developers/backends.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ the usual `RUST_LOG` to control logging verbosity.
331331

332332
## Handling missing backends
333333

334-
If you should enable a backend that isn't installed, the default behavior is to throw an error:
334+
If you enable a backend that isn't installed, the default behavior is to throw an error:
335335

336336
```text
337337
The command wasn't found, is the "wordcount" backend installed?

book-example/src/format/config.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,17 @@ specify which preprocessors should run before the Markdown renderer.
306306
A custom renderer can be enabled by adding a `[output.foo]` table to your
307307
`book.toml`. Similar to [preprocessors](#configuring-preprocessors) this will
308308
instruct `mdbook` to pass a representation of the book to `mdbook-foo` for
309-
rendering.
309+
rendering. See the [alternative backends] chapter for more detail.
310310

311-
Custom renderers will have access to all configuration within their table
312-
(i.e. anything under `[output.foo]`), and the command to be invoked can be
313-
manually specified with the `command` field.
311+
The custom renderer has access to all the fields within its table (i.e.
312+
anything under `[output.foo]`). mdBook checks for two common fields:
313+
314+
- **command:** The command to execute for this custom renderer. Defaults to
315+
the name of the renderer with the `mdbook-` prefix (such as `mdbook-foo`).
316+
- **optional:** If `true`, then the command will be ignored if it is not
317+
installed, otherwise mdBook will fail with an error. Defaults to `false`.
318+
319+
[alternative backends]: ../for_developers/backends.md
314320

315321
## Environment Variables
316322

src/renderer/mod.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,17 @@ impl CmdRenderer {
166166
};
167167

168168
if is_optional {
169-
warn!("The command was not found, but was marked as optional.");
170-
warn!("\tCommand: {}", self.cmd);
169+
warn!(
170+
"The command `{}` for backend `{}` was not found, \
171+
but was marked as optional.",
172+
self.cmd, self.name
173+
);
171174
return Ok(());
172175
} else {
173176
error!(
174-
"The command wasn't found, is the \"{}\" backend installed?",
175-
self.name
177+
"The command `{}` wasn't found, is the `{}` backend installed?",
178+
self.cmd, self.name
176179
);
177-
error!("\tCommand: {}", self.cmd);
178180
}
179181
}
180182
_ => {}

0 commit comments

Comments
 (0)