Expand description
Mdbook’s configuration system.
The main entrypoint of the config module is the Config struct. This acts
essentially as a bag of configuration information, with a couple
pre-determined tables (BookConfig and BuildConfig) as well as support
for arbitrary data which is exposed to plugins and alternative backends.
§Examples
use std::path::PathBuf;
use std::str::FromStr;
use mdbook_core::config::Config;
let src = r#"
[book]
title = "My Book"
authors = ["Michael-F-Bryan"]
[preprocessor.my-preprocessor]
bar = 123
"#;
// load the `Config` from a toml string
let mut cfg = Config::from_str(src)?;
// retrieve a nested value
let bar = cfg.get::<i32>("preprocessor.my-preprocessor.bar")?;
assert_eq!(bar, Some(123));
// Set the `output.html.theme` directory
assert!(cfg.get::<toml::Value>("output.html")?.is_none());
cfg.set("output.html.theme", "./themes");
// then load it again, automatically deserializing to a `PathBuf`.
let got = cfg.get("output.html.theme")?;
assert_eq!(got, Some(PathBuf::from("./themes")));Structs§
- Book
Config - Configuration options which are specific to the book and required for loading it from disk.
- Build
Config - Configuration for the build procedure.
- Code
- Configuration for tweaking how the HTML renderer handles code blocks.
- Config
- The overall configuration object for MDBook, essentially an in-memory
representation of
book.toml. - Fold
- Configuration for how to fold chapters of sidebar.
- Html
Config - Configuration for the HTML renderer.
- Playground
- Configuration for tweaking how the HTML renderer handles the playground.
- Configuration for how to render the print icon, print.html, and print.css.
- Rust
Config - Configuration for the Rust compiler(e.g., for playground)
- Search
- Configuration of the search functionality of the HTML renderer.
- Search
Chapter Settings - Search options for chapters (or paths).
Enums§
- Rust
Edition - Rust edition to use for the code.
- Text
Direction - Text direction to use for HTML output