rust-lang / book

The Rust Programming Language
https://doc.rust-lang.org/book/
Other
14.56k stars 3.31k forks source link

preprocessors need to be integrated with the rust build system #3927

Open ehuss opened 1 month ago

ehuss commented 1 month ago

https://github.com/rust-lang/book/pull/3918 and https://github.com/rust-lang/book/pull/3907 seem to have introduced some new preprocessors. These will need to be integrated with the rust build system so that the book gets built correctly. At a minimum, it will need to be integrated in rustbook/src/main.rs, by calling with_preprocessor when building the book. The preprocessors will need to be declared as path dependencies in rustbook/Cargo.toml. This will also probably require some wiring to detect when these custom preprocessors are enabled in book.toml (which should be accessible via something like book.config.get_preprocessor).

This should probably be done before you start using these preprocessors to ensure the published documentation isn't broken.

chriskrycho commented 1 month ago

Noted, and thank you, @ehuss! 👍🏼 A quick status note:

I am using book.config.get_preprocessor already in tests for the preprocessors, so I have a reasonably good idea how to make sure we do that in the build. I’ll follow up with @carols10cents to make sure I don’t miss anything.

chriskrycho commented 1 month ago

For those following along at home: rust-lang/rust#125408 has the goods, and is (I believe!) ready to go. 👍🏼

chriskrycho commented 1 month ago

Status:

One highly likely possibility here is that we end up publishing these to crates.io and then pulling them in as normal (i.e. not path) dependencies in the src/tools/rustbook in the rust repo.