安装参考 https://github.com/GitbookIO/gitbook/blob/master/docs/setup.md
使用参考 https://www.kancloud.cn/xiaoyulive/gitbook/506288
安装
1. 安装 gitbook-cli
Requirements
Installing GitBook is easy and straightforward. Your system just needs to meet these two requirements:
- NodeJS (v4.0.0 and above is recommended)
- Windows, Linux, Unix, or Mac OS X
Install with NPM
The best way to install GitBook is viaNPM. At the terminal prompt, simply run the following command to install GitBook:
$ npm install gitbook-cli -g
【注】按下面的步骤使用 GitBook Editor
的话文档里面的 gitbook init
操作就不需要了
2. 安装 GitBook Editor
启动后界面如下
首先设置下 GitBook 库路径,操作如下:
GitBook Editor -> Change Library Path
选择一个合适的路径即可(请注意“合适的路径”, windows 上使用默认路径gitbook serve
可能会报错) ;不需要登录,选择
login
下面的Do that later
跳过即可;如下图所示,点击
+ New Book
即可开始编辑文档了,具体使用参考开头的连接
- 进入新建的文档根目录,可以执行 gitbook-cli 的相关命令
gitbook help
build [book] [output] build a book
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
--format Format to build to (Default is website; Values are website, json, ebook)
--[no-]timing Print timing debug information (Default is false)
serve [book] [output] serve the book as a website for testing
--port Port for server to listen on (Default is 4000)
--lrport Port for livereload server to listen on (Default is 35729)
--[no-]watch Enable file watcher and live reloading (Default is true)
--[no-]live Enable live reloading (Default is true)
--[no-]open Enable opening book in browser (Default is false)
--browser Specify browser for opening book (Default is )
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
--format Format to build to (Default is website; Values are website, json, ebook)
install [book] install all plugins dependencies
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
parse [book] parse and print debug information about a book
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
init [book] setup and create files for chapters
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
pdf [book] [output] build a book into an ebook file
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
epub [book] [output] build a book into an ebook file
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)
mobi [book] [output] build a book into an ebook file
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)