1、What is gitbook
https://www.gitbook.com/
GitBook is a modern documentation platform where teams can document everything from products, to APIs and internal knowledge-bases.
2、本地安装
1)安装Node.js (Step by Step)
2) 安装gitbook
MacBookPro:xidianzxm.github.io zhangxm$ npm install gitbook-cli -g
/usr/local/bin/gitbook -> /usr/local/lib/node_modules/gitbook-cli/bin/gitbook.js
+ gitbook-cli@2.3.2
added 578 packages from 672 contributors in 40.548
╭───────────────────────────────────────────────────────────────╮
│ │
│ New minor version of npm available! 6.5.0 → 6.9.0 │
│ Changelog: https://github.com/npm/cli/releases/tag/v6.9.0 │
│ Run npm install -g npm to update! │
│ │
╰───────────────────────────────────────────────────────────────╯
MacBookPro:xidianzxm.github.io zhangxm$
3) 新建电子书目录后gitbook init
MacBookPro:myebook zhangxm$ pwd
/data/gitbook/myebook
MacBookPro:myebook zhangxm$ gitbook init
Installing GitBook 3.2.3
[fsevents] Success: "/private/var/folders/lt/6s_jtwsd4dbcf_hpnsj6v4140000gp/T/tmp-4070429jhVKUPjVXv/node_modules/gitbook/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" is installed via remote
[fsevents] Success: "/private/var/folders/lt/6s_jtwsd4dbcf_hpnsj6v4140000gp/T/tmp-4070429jhVKUPjVXv/node_modules/gitbook/node_modules/nunjucks/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" is installed via remote
gitbook@3.2.3 ../../../var/folders/lt/6s_jtwsd4dbcf_hpnsj6v4140000gp/T/tmp-4070429jhVKUPjVXv/node_modules/gitbook
├── escape-string-regexp@1.0.5
......
└── nunjucks@2.5.2 (asap@2.0.6, yargs@3.32.0, chokidar@1.7.0)
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished
MacBookPro:myebook zhangxm$ ls
README.md SUMMARY.md
SUMMARY.md-书的目录结构
README.md-书的简单介绍
4) 启动gitboot serve 服务
MacBookPro:myebook zhangxm$ gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 1 pages
info: found 0 asset files
info: >> generation finished with success in 0.6s !
Starting server ...
Serving book on http://localhost:4000