mdBook is a command-line tool written in Rust and used to create books in Markdown. It is ideal for creating product or API documentation, tutorials, course materials, or any presentation that needs to be concise, easy to navigate, and customizable. The functionality is similar to Gitbook, and the biggest advantage is speed.
Lightweight, Markdown syntax
Search, integrated search function
Syntax highlighting, syntax highlighting
Multiple themes, Theme custom output format
Preprocessor, support preprocessor support, extensions to modify markdown renderer before it
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh......
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run:
source"$HOME/.cargo/env"# cargo versioncargo 1.65.0 (4bc8f24d3 2022-10-20)
After installing Rust, build and install mdBook on the command line. After the installation is complete:
# mdbook init devops-manualDo you want a .gitignore to be created? (y/n)y
What title would you like to give the book?
devops-manual
2022-10-06 13:59:33 [INFO](mdbook::book::init): Creating a new book with stub content
All done, no errors...
# tree devops-manualdevops-manual
├── book
├── book.toml
└── src
├── SUMMARY.md
└── chapter_1.md
2 directories, 3 files
Start mdbook and test the local preview: ```shell # mdbook serve –open 2022-10-06 14:04:05 [INFO] (mdbook::book): Book building has started 2022-10-06 14:04: 05 [INFO] (mdbook::book): Running the html backend 2022-10-06 14:04:05 [INFO] (mdbook::cmd::serve): Serving on: http://localhost:3000 2022- 10-06 14:04:05 [INFO] (mdbook): Opening web browser 2022-10-06 14:04:05 [INFO] (warp::server): Server::run; addr=127.0.0.1:3000 2022-10-06 14:04:05 [INFO] (warp::server): listening on http://127.0.0.1:3000
2022-10-06 14:04:05 [INFO] (mdbook::cmd::watch): Listening for changes…
The --open option will open the default web browser to view the new book. For the generated mdBook new book directory structure:
- book.toml: describes how to build the e-book settings, written in TOML syntax- SUMMARY.md : Located in src/SUMMARY.md, this file contains a list of all chapters in the book. Before viewing a chapter, you must add it to this list.- src: This directory stores the source files of the book. Each chapter has a separate Markdown file - book: stores e-book HTML files. When you build a book (mdbook build), e-book static files will be generated in this directory for hosting on other web services, such as Github Pages.At this point, if we want to write an e-book about DevOps, we only need to write the table of contents and then write each chapter one by one.For example, here is mine: devops-manual/SUMMARY.md
```yaml
# Summary[Introduction](README.md)
# DevOps Project - [DevOps](xops/devops.md)# DevOps Tool Chain - [Basic Tools]( base/readme.md)- [Git](base/git.md)
- [Docker](base/docker.md)
- [Makefile](base/makefile.md)
- [Product Requirements](project/readme.md )
- [Jira](project/jira.md)
- [PingCode](project/jira.md)
- [Code Management](code/readme.md)
- [Gitlab](code/gitlab.md)
- [Github] (code/github.md)
- [Gerrit](code/Gerrit.md)
- [Test Security Scan](test/readme.md)
- [Jmeter](test/jmeter.md)
- [SnoarQube](test/snoarqube.md)
- [BlackDuck](test/blackduck.md)
- [Fortify]( test/fortify.md)
- [Compile and Build](makebuild/readme.md)
- [Maven](makebuild/maven.md)
- [Gradle](makebuild/gradle.md)
- [Node](makebuild/node.md )
- [Npm](makebuild/npm.md)
- [Cargo](makebuild/cargo.md)
- [Product Warehouse](hub/readme.md)
- [Harbor](hub/harbor.md)
- [Nexus] (hub/nexus.md)
- [Jfrog artifactory](hub/jfrog.md)
- [Automated Deployment](autodeploy/readme.md)
- [Ansible](autodeploy/ansible.md)
- [ArgoCD](autodeploy/argocd.md)
- [Helm](autodeploy/ helm.md)
- [Kustomize](autodeploy/kustomize.md)
- [Log monitoring link](logmonitor/readme.md)
- [EFK](logmonitor/efk.md)
- [Prometheus](logmonitor/prometheus.md )
- [Grafana](logmonitor/grafana.md)
- [Loki](logmonitor/loki.md)
- [Skywalking](logmonitor/skywalking.md)
- [Jaeger](logmonitor/jadger.md)
- [Pinpoint](logmonitor/pinpoint.md) - [Other tools](others/readme.md) - [Rancher](others/rancher.md) - [Jumpserver](others/jumpserver.md) - [Nacos](others /nacos.md) - [Consul](others/consul.md) - [Trafik](others/apisix.md) - [Apisix](others/apisix.md) - [Terraform](others/terraform.md) - [Pulumi](others/pulumi.md) - [Valut](others/valut.md) - [Development language](language/readme.md) - [Shell](language/shell.md) - [Python](language /python.md) - [Golang](language/golang.md) - [Framework module](framework/readme.md) - [Gin](framework/gin.md) - [Vue](framework/vue.md) - [React-antd] (framework/antd.md) - [Django](framework/django.md) - [Bootstrap](framework/bootstrap.md) - [Swagger](framework/swagger.md) - [Postman](framework/postman.md ) - [ApiPost7](framework/apipost7.md) - [RBAC](framework/rbac.md) - [JWT](framework/jwt.md) - [XOPS](xops/xops.md) - [GitOps]( xops/gitops.md) - [AiOps](xops/aiops.md)
- [MLOps](xops/mlops.md)
- [FinOps](xops/finops.md)
- [DevSecOps](xops/devsecopsmd)
- [DevDBOps](xops/devdbops. md)
- [Chaos Engineering](xops/hundun.md)`
After completing the above writing work, you only need to build mdbook, then map the book directory to the nginx directory, and configure the virtual host. Isn’t it simple?