Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

All configuration lives in book.toml at the project root. Here is a typical setup:

[book]
authors = ["Your Name"]
language = "en"
src = "src"
title = "My Awesome Book"

[build]
build-dir = "book"

[output.html]
git-repository-url = "https://github.com/youruser/yourrepo"

Key sections

[book]

KeyDescription
titleDisplayed in the browser tab and sidebar header
authorsList of author names
languageBCP 47 language tag (e.g. en, de)
srcDirectory containing your Markdown source files

[build]

KeyDescription
build-dirOutput directory for the rendered book (default book)

[output.html]

KeyDescription
git-repository-urlAdds a link icon in the top-right corner pointing to your repo
default-themeSet the default theme (Light, Rust, Coal, Navy, Ayu)
preferred-dark-themeTheme used when the OS requests dark mode

mdBook ships with a client-side search engine that is enabled by default. It builds a search index at compile time and bundles it into the output. Readers can press S or click the magnifying-glass icon to search across the entire book — no server required.

You can configure search in book.toml:

[output.html.search]
enable = true            # enabled by default
limit-results = 30       # max results shown
use-hierarchical-headings = true  # show parent headings in results

The search index adds some weight to the final output. If your book is very large and you want to reduce the download size, you can set enable = false, but for most books the convenience far outweighs the extra kilobytes.

Further reading

See the mdBook documentation for the full list of options.