Commit 2732c5e 1 parent 6b550cb commit 2732c5e Copy full SHA for 2732c5e
File tree 3 files changed +18
-10
lines changed
3 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ the usual `RUST_LOG` to control logging verbosity.
331
331
332
332
## Handling missing backends
333
333
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:
335
335
336
336
``` text
337
337
The command wasn't found, is the "wordcount" backend installed?
Original file line number Diff line number Diff line change @@ -306,11 +306,17 @@ specify which preprocessors should run before the Markdown renderer.
306
306
A custom renderer can be enabled by adding a ` [output.foo] ` table to your
307
307
` book.toml ` . Similar to [ preprocessors] ( #configuring-preprocessors ) this will
308
308
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.
310
310
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
314
320
315
321
## Environment Variables
316
322
Original file line number Diff line number Diff line change @@ -166,15 +166,17 @@ impl CmdRenderer {
166
166
} ;
167
167
168
168
if is_optional {
169
- warn ! ( "The command was not found, but was marked as optional." ) ;
170
- warn ! ( "\t Command: {}" , self . cmd) ;
169
+ warn ! (
170
+ "The command `{}` for backend `{}` was not found, \
171
+ but was marked as optional.",
172
+ self . cmd, self . name
173
+ ) ;
171
174
return Ok ( ( ) ) ;
172
175
} else {
173
176
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
176
179
) ;
177
- error ! ( "\t Command: {}" , self . cmd) ;
178
180
}
179
181
}
180
182
_ => { }
You can’t perform that action at this time.
0 commit comments