# mdBook — Create Books from Markdown Like Gitbook in Rust > mdBook creates online books from Markdown files, similar to Gitbook but implemented in Rust. Used for the official Rust Book, Cargo Book, Tokio Tutorial, and many open-source documentation sites. Fast builds and a clean default theme. ## Install Save as a script file and run: ## Quick Use ```bash cargo install mdbook mdbook init my-book cd my-book mdbook serve # Dev server at :3000 mdbook build # Build to book/ ``` Directory structure: ``` my-book/ ├── book.toml └── src/ ├── SUMMARY.md ├── chapter_1.md └── chapter_2/ ├── section_1.md └── section_2.md ``` `src/SUMMARY.md`: ```markdown # Summary - [Introduction](./chapter_1.md) - [Getting Started](./chapter_2/section_1.md) - [Installation](./chapter_2/section_2.md) ``` ## Intro mdBook is a command-line tool and Rust library to create online books from Markdown files. Similar to Gitbook but implemented in Rust — fast, single binary, no Node.js required. Used for the official Rust Book, Cargo Book, Tokio Tutorial, Bevy Book, and many Rust ecosystem docs. - **Repo**: https://github.com/rust-lang/mdBook - **Stars**: 21K+ - **Language**: Rust - **License**: MPL 2.0 ## What mdBook Does - **Markdown to HTML** — clean default theme - **SUMMARY.md** — table of contents as navigation - **Search** — full-text search built in - **Syntax highlighting** — for code blocks - **Preprocessors** — custom Markdown transforms - **Renderers** — HTML (default), PDF, EPUB via plugins - **Themes** — customizable CSS - **Link checking** — validate internal links - **Includes** — embed file contents with `{{#include}}` - **Rust code testing** — `mdbook test` runs Rust code examples ## Comparison | Tool | Language | Speed | Node.js | |---|---|---|---| | mdBook | Rust | Fast | No | | Gitbook | JS | Medium | Yes | | Docusaurus | JS | Medium | Yes | | VitePress | JS | Fast | Yes | | Sphinx | Python | Medium | No | ## 常见问题 FAQ **Q: 和 VitePress 比?** A: mdBook 零依赖(单 Rust 二进制),VitePress 需要 Node.js 但支持 Vue 组件和更丰富的自定义。纯文档选 mdBook,交互式文档选 VitePress。 ## 来源与致谢 Sources - Docs: https://rust-lang.github.io/mdBook - GitHub: https://github.com/rust-lang/mdBook - License: MPL 2.0 --- Source: https://tokrepo.com/en/workflows/ce6e1a98-3651-11f1-9bc6-00163e2b0d79 Author: Script Depot