This is a wrapper around mdbook
, which is used to generate the book-style documentation in the Rust project. This wrapper serves a few purposes:
This is invoked automatically when building mdbook-style documentation, for example via ./x doc
.
This package defines a separate cargo workspace from the main Rust workspace for a few reasons (ref #127786:
Some books have custom mdbook preprocessors that need to be integrated with both the book's repository, and the build system here in the rust-lang/rust
repository. To add a new preprocessor, there are few things to do:
[preprocessor]
table to the book's book.toml
file. I recommend setting the command so that the preprocessor gets built automatically. It may look something like:[preprocessor.spec] command = "cargo run --manifest-path my-cool-extension/Cargo.toml" [build] extra-watch-dirs = ["my-cool-extension/src"]
Cargo.toml
.with_preprocessor
in rustbook/src/main.rs
../x doc MY-BOOK-NAME --open
and verify the content looks correct../x test tidy
and ./x test MY-BOOK-NAME
.