1、安裝 Node.js:https://nodejs.org/en/
2、安裝 GitBook:
npm install gitbook-cli -g
gitbook -V #查看gitbook是否成功安裝。
nodejs 鏡像配置
npm config set registry http://registry.npm.taobao.org
3、gitbook使用
gitbook init //初始化目錄文件
初始化效果:
編輯 SUMMARY.md 文件,內容修改為:
# 目錄 * [前言](README.md) * [第一章](Chapter1/README.md) * [第1節:first](Chapter1/first.md) * [第2節:second](Chapter1/senond.md) * [第3節:third](Chapter1/third.md) * [第4節:fourth](Chapter1/fourth.md) * [第二章](Chapter2/README.md) * [第三章](Chapter3/README.md) * [第四章](Chapter4/README.md)
再次執行 gitbook init 命令,GitBook 會查找 SUMMARY.md 文件中描述的目錄和文件,如果沒有則會將其創建。
gitbook serve //來預覽這本書籍
問題:gitbook serve 經常報錯找不到文件
解決方法:
cd ~/.gitbook/versions/版本/lib/output/website/
vim copyPluginAssets.js
刪除112行
參考鏈接:
https://blankj.com/gitbook/gitbook/
https://jingyan.baidu.com/article/e8cdb32b33e8f637052bada8.html