Skip to content

Commit f2d7b70

Browse files
Pull out default preprocessors into function
1 parent 4177288 commit f2d7b70

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/book/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,18 @@ fn determine_renderers(config: &Config) -> Vec<Box<Renderer>> {
333333
renderers
334334
}
335335

336+
fn default_preprocessors() -> Vec<Box<Preprocessor>> {
337+
vec![Box::new(LinkPreprocessor::new())]
338+
}
339+
336340
/// Look at the `MDBook` and try to figure out what preprocessors to run.
337341
fn determine_preprocessors(config: &Config) -> Result<Vec<Box<Preprocessor>>> {
338342

339343
let preprocess_list = match config.build.preprocess {
340344
Some(ref p) => p,
341345
// If no preprocessor field is set, default to the LinkPreprocessor. This allows you
342346
// to disable the LinkPreprocessor by setting "preprocess" to an empty list.
343-
None => return Ok(vec![Box::new(LinkPreprocessor::new())])
347+
None => return Ok(default_preprocessors())
344348
};
345349

346350
let mut preprocessors: Vec<Box<Preprocessor>> = Vec::new();

0 commit comments

Comments
 (0)