欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

gitbook使用

程序员文章站 2022-06-01 16:32:05
...

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
+ [email protected]
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
[email protected] ../../../var/folders/lt/6s_jtwsd4dbcf_hpnsj6v4140000gp/T/tmp-4070429jhVKUPjVXv/node_modules/gitbook
├── [email protected]
......
└── [email protected] ([email protected], [email protected], [email protected])
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
5)浏览器查看电子书

gitbook使用