MdBook is a Rust-based command line tool that helps create books with Markdown and Rust. With the mdBook tool, You can create a product, API documentation, tutorials, course materials, or anything. You can easily deploy various platforms like GitHub pages, etc.
Common Features
- mdBook CLI is a lightweight markdown tool.
- mdbook cli integrated search, pagination, and navbar support.
- Code highlighting for many different languages.
- You can also run and edit code in the browser and copy code with one click.
- mdbook Tool provides different themes, and you can change the theme with one click.
- Preprocessors are extensions that can modify the raw Markdown before it gets sent to the renderer.
- Adding or extend your mdBook functionality with the plugin.
- mdBook tool has been written in Rust for speed, safety, and simplicity.
How to install mdBook CLI?
mdBook comes with two types of installation options available. 1.Install with Pre-compiled binaries 2. Build from source using cargo
Install with Pre-compiled binaries.
It is a very complicated and time-consuming step for beginners, and I do not recommend it.
- Go to the mdbook Github release page.
- Select the binary file according to your operating system and download it locally.
- Extract the folder and folder containing the mdbook executable file.
- Now add your path into the PATH variable to run the mdbook executable for any location in your machine.
Build from source using cargo.
The recommended way to install the mdbook CLI tool in your system with cargo CLI. Cargo is a cli tool provided by Rust foundation. It helps to create a new project, run the code, etc. But with cargo, Now you can install and build a Rust binary from to source and download it on the Default location is $HOME/.cargo/bin.
You do not need to add the mdbook binary PATH manually into bashrc. The cargo automatically does it, and you can run the mdbook cli anywhere in the machine.
cargo install mdbook
Command out put look like
create the new book with mdbook cli
mdbook init my-first-book
The folder Output is look.
tree
.
├── book
├── book.toml
└── src
├── chapter_1.md
└── SUMMARY.md
2 directories, 3 files
Information
book.toml
file contain all the configuration related to the book.- The
src
folder contains all your markdown files. - The
book
folder contains production built.
Conclusion
Mdbook is a specific design for rust developers, and you do not need to learn any frontend framework for designing and building documents. With mdbook, you can easily write a document with Markdown and the functionality like search, navbar, code highlighting, pagination, etc., provided by mdbook.