下载node.js
npm配置淘宝镜像提高下载速度
参考地址
npm install -g cnpm --registry=https://registry.npm.taobao.org; npm config set registry http://registry.cnpmjs.org // 配置源的指向
安装gitbook
cnpm install -g gitbook-cli
检查是否安装成功
gitbook -V
简单使用
由于本人习惯使用linux命令,所以以下操作都在git bash here
中进行
创建
- 文件夹
mkdir gitboot_test
cd gitboot_test
- 初始化
gitbook init
初始化完成后再该命令下回出现如下两个文件
我们可以使用vs code 来打开他们
其中,README文件为说明文档;SUMMARY.md文件为章节目录设置文件,我们通过【】()这种格式定义章节在【】里写入章节名,在()里写入英文名.md
注意,在编辑完SUMMARY文件后需要再次初始化。
启动GitBook服务
- 命令行中输入
gitbook serve
- 在浏览器地址栏中输入
localhost:4000