Configuration

This page lists all options for the preprocessor.

For use in book.toml, configure under the [preprocessor.rustdoc-link] table using the keys below, for example:

[preprocessor.rustdoc-link]
rust-analyzer = "path/to/rust-analyzer --option ..."

For use on the command line, use the keys as long arguments, for example:

mdbook-rustdoc-link markdown --rust-analyzer "..."
Option Summary

cache-dir

Directory in which to persist build cache

cargo-features

List of features to activate when running rust-analyzer

fail-on-warnings

Exit with a non-zero status code when some links fail to resolve

manifest-dir

Directory from which to search for a Cargo project

rust-analyzer

Command to use for spawning rust-analyzer

smart-punctuation

Whether to enable punctuations like smart quotes “”

cache-dir

Directory in which to persist build cache.

Setting this will enable caching. Will skip rust-analyzer if cache hits.

Default

None

Type

PathBuf

cargo-features

List of features to activate when running rust-analyzer.

This is just the rust-analyzer.cargo.features config.

In book.toml — to enable all features, use ["all"].

For CLI — to enable multiple features, specify as comma-separated values, or specify multiple times; to enable all features, specify --cargo-features all.

Default

[]

Type

Vec<String>

fail-on-warnings

Exit with a non-zero status code when some links fail to resolve.

Warnings are always printed to the console regardless of this option.

Choice Description
"ci"

Fail if the environment variable CI is set to a value other than 0 or false. Environments like GitHub Actions configure this automatically

"always"

Fail as long as there are warnings, even in local use

Default

"ci"

Type

ErrorHandling

manifest-dir

Directory from which to search for a Cargo project.

By default, the current working directory is used. Use this option to specify a different directory.

The processor requires the Cargo.toml of a package to work. If you are working on a Cargo workspace, set this to the relative path to a member crate.

Default

None

Type

PathBuf

rust-analyzer

Command to use for spawning rust-analyzer.

By default, prebuilt binary from the VS Code extension is tried. If that doesn't exist, it is assumed that rust-analyzer is on PATH. Use this option to override this behavior completely.

The command string will be tokenized by shlex, so you can include arguments in it.

Default

None

Type

String

smart-punctuation

Whether to enable punctuations like smart quotes “”.

This is only meaningful if your links happen to have visible text that has specific punctuation. The processor otherwise passes through the rest of your Markdown source untouched.

In book.toml — this option is not needed because output.html.smart-punctuation is honored.

Default

false

Type

bool