diff --git a/src/book/mod.rs b/src/book/mod.rs index 9e718598..0dd6edda 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -340,15 +340,23 @@ fn determine_preprocessors(md_book: &MDBook) -> Vec> { if let Some(preprocess_array) = md_book.config.get("pre_process").and_then(|o| o.as_array()) { for key in preprocess_array.iter() { if key.as_str().map_or(false, |key| key == "links") { - let preprocessor = preprocess::links::ReplaceAllPreprocessor { + let replace_all_preprocessor = preprocess::links::ReplaceAllPreprocessor { src_dir: md_book.source_dir(), }; - preprocessors.push(Box::new(preprocessor)) + preprocessors.push(Box::new(replace_all_preprocessor)) } } } + if preprocessors.is_empty() { + let replace_all_preprocessor = preprocess::links::ReplaceAllPreprocessor { + src_dir: md_book.source_dir(), + }; + + preprocessors.push(Box::new(replace_all_preprocessor)) + } + preprocessors }