TL;DR — Quick Summary
mdBook creates beautiful documentation books from Markdown files. Used by the Rust Book, it generates searchable static sites with themes, syntax highlighting, and live reload.
mdBook turns Markdown into beautiful documentation. The tool behind the Rust Book — search, themes, syntax highlighting, all static.
Installation
# macOS
brew install mdbook
# Arch Linux
sudo pacman -S mdbook
# Cargo
cargo install mdbook
Usage
# Create a new book
mdbook init my-docs
cd my-docs
# Directory structure
# ├── book.toml
# └── src/
# ├── SUMMARY.md
# └── chapter_1.md
# Dev server with live reload
mdbook serve
mdbook serve --port 3000
# Build for production
mdbook build
# Clean
mdbook clean
# Test code blocks
mdbook test
Configuration
# book.toml
[book]
title = "My Documentation"
authors = ["Author"]
language = "en"
src = "src"
[build]
build-dir = "book"
[output.html]
default-theme = "navy"
preferred-dark-theme = "ayu"
git-repository-url = "https://github.com/user/repo"
edit-url-template = "https://github.com/user/repo/edit/main/{path}"
[output.html.search]
enable = true
Summary
- mdBook generates beautiful documentation books from Markdown
- Built-in search, syntax highlighting, multiple themes
- Live reload dev server for instant preview
- Used by the Rust Book, Cargo Book, and thousands of projects
- Written in Rust — fast, single binary, easy to deploy