mdbook安裝使用實錄

簡介

mdbook是一個基於Rust的電子書系統,效果類似於gitbook。本人寫圖文文章一直都採用的印象筆記,但是寫系列教程的情況不方便管理。因此引入mdBook,分享一下基本安裝使用過程及遇到的問題。

安裝

本機環境是win11。mdBook是寫的 Rust 因此需要Cargo編譯

1.安裝Rust

官方下載地址: https://www.rust-lang.org/zh-CN/tools/install

2.安裝mdBook

cargo install mdbook

安裝過程中出現錯誤

error: linker link.exe not found|  = note: program not foundnote: the msvc targets depend on the msvc linker but link.exe was not foundnote: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.note: VS Code is a different product, and is not sufficient.

解決方案:安裝C++生成工具。從這裏下載  https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
安裝時選擇紅框組件。

重新安裝mdbook,搞定。

創建mdbook

1.init命令

創建第一本mdbook,執行命令行

mdbook init --title 原來你是這樣的java

來看下默認生成的文檔結構吧。

2.build命令

mdbook build

build命令嘗試解析您的SUMMARY.md文件以瞭解您的書的結構並獲取相應的文件。 請注意,在 SUMMARY.md 中提到但不存在的文件將會自動創建。爲方便起見,渲染的輸出將保持與源相同的目錄結構。

3.serve命令

mdbook serve

serve 命令用於通過 HTTP 在 localhost:3000 提供服務來預覽電子教程。

詳細mdBook教程:
https://hellowac.github.io/mdbook-doc-zh/zh-cn/index.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章