···169169 fn new(book: &PreprocessorContext) -> Result<Result<Self>> {
170170 let config = book
171171 .config
172172- .preprocessor(PREPROCESSOR_NAME)
173173- .context("failed to read preprocessor config from book.toml")?;
172172+ .preprocessor(&[PREPROCESSOR_NAME, "mdbook-link-forever"])?;
174173175174 let vcs = match VersionControl::try_from_git(&config, &book.config) {
176175 Ok(Ok(vcs)) => vcs,
+3-1
crates/mdbook-rustdoc-links/src/main.rs
···217217}
218218219219fn config(ctx: &PreprocessorContext) -> Result2<Config> {
220220- let mut config = ctx.config.preprocessor::<Config>(PREPROCESSOR_NAME)?;
220220+ let mut config = ctx
221221+ .config
222222+ .preprocessor::<Config>(&[PREPROCESSOR_NAME, "mdbook-rustdoc-link"])?;
221223222224 if let Some(path) = config.manifest_dir {
223225 config.manifest_dir = Some(ctx.root.join(path))
+23-5
crates/mdbookkit/src/book.rs
···3939}
40404141pub trait BookConfigHelper {
4242- fn preprocessor<'de, T>(&self, name: &str) -> Result<T>
4242+ fn preprocessor<'de, T>(&self, names: &[&str]) -> Result<T>
4343 where
4444 T: Deserialize<'de> + Default;
4545···4747}
48484949impl BookConfigHelper for MDBookConfig {
5050- fn preprocessor<'de, T>(&self, name: &str) -> Result<T>
5050+ fn preprocessor<'de, T>(&self, names: &[&str]) -> Result<T>
5151 where
5252 T: Deserialize<'de> + Default,
5353 {
5454- let name = name.strip_prefix("mdbook-").unwrap_or(name);
5555- let name = format!("preprocessor.{name}");
5656- Ok(self.get::<T>(&name)?.unwrap_or_default())
5454+ fn format_name(name: &str) -> String {
5555+ let name = name.strip_prefix("mdbook-").unwrap_or(name);
5656+ format!("preprocessor.{name}")
5757+ }
5858+5959+ for (idx, name) in names.iter().enumerate() {
6060+ let name = format_name(name);
6161+ if let Some(value) = (self.get::<T>(&name))
6262+ .with_context(|| format!("error while reading [{name}] in book.toml"))?
6363+ {
6464+ if idx != 0 {
6565+ let recommended = format_name(names[0]);
6666+ log::warn!(
6767+ "The book.toml section [{name}] is deprecated. Use [{recommended}] instead."
6868+ );
6969+ }
7070+ return Ok(value);
7171+ }
7272+ }
7373+7474+ Ok(Default::default())
5775 }
58765977 fn markdown_options(&self) -> MarkdownOptions {
+2-2
crates/mdbookkit/src/error.rs
···3636 log::Level::Error => Err(anyhow!("preprocessor has errors")),
3737 log::Level::Warn => match self {
3838 Self::AlwaysFail => {
3939- anyhow!("treating warnings as errors because fail-on-unresolved is \"always\"")
3939+ anyhow!("treating warnings as errors because the `fail-on-warnings` option is set to \"always\"")
4040 .context("preprocessor has errors")
4141 .pipe(Err)
4242 }
···4444 let Some(ci) = Self::warning_as_error() else {
4545 return Ok(());
4646 };
4747- anyhow!("treating warnings as errors because fail-on-unresolved is \"ci\" and CI={ci}")
4747+ anyhow!("treating warnings as errors because the `fail-on-warnings` option is set to \"ci\" and CI={ci}")
4848 .context("preprocessor has errors")
4949 .pipe(Err)
5050 }