Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

25.10. mdbook

mdBook is a command line tool to create books with Markdown. It is ideal for creating product or API documentation, tutorials, course materials or anything that requires a clean, easily navigable and customizable presentation.

25.10.1. 安装

MacOS 安装

			
neo@Neo-Mac-mini-M4 ~ % mdbook
Creates a book from markdown files

Usage: mdbook [COMMAND]

Commands:
  init         Creates the boilerplate structure and files for a new book
  build        Builds a book from its markdown files
  test         Tests that a book's Rust code samples compile
  clean        Deletes a built book
  completions  Generate shell completions for your shell to stdout
  watch        Watches a book's files and rebuilds it on changes
  serve        Serves a book at http://localhost:3000, and rebuilds it on changes
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

For more information about a specific command, try `mdbook <command> --help`
The source code for mdBook is available at: https://github.com/rust-lang/mdBook
			
			

二进制安装

			
github release:https://github.com/rust-lang/mdBook/releases
			
			

25.10.2. 创建工程

			
neo@Neo-Mac-mini-M4 GitHub % mdbook init society 

Do you want a .gitignore to be created? (y/n)
y
What title would you like to give the book? 

2025-09-06 20:05:49 [INFO] (mdbook::book::init): Creating a new book with stub content

All done, no errors...			
			
			

打开 book

			
neo@Neo-Mac-mini-M4 GitHub % cd society 
neo@Neo-Mac-mini-M4 society % mdbook serve --open
2025-09-06 20:14:29 [INFO] (mdbook::book): Book building has started
2025-09-06 20:14:29 [INFO] (mdbook::book): Running the html backend
2025-09-06 20:14:29 [INFO] (mdbook::cmd::serve): Serving on: http://localhost:3000
2025-09-06 20:14:29 [INFO] (mdbook): Opening web browser
2025-09-06 20:14:29 [INFO] (mdbook::cmd::watch::poller): Watching for changes...