gitbook使用教程
作者:互联网
gitbook使用教程
centos安装
这里安装的是13.14的node,高版本gitbook init会报错
gitbook init Error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be
安装nodejs
下载地址:https://nodejs.org/download/release/v13.14.0/
tar -xvf node-v13.14.0-linux-x64.tar.gz -C /opt
# 添加环境变量
cat <<'EOF'>> /etc/profile
PATH=/opt/node-v13.14.0-linux-x64/bin:$PATH
EOF
source /etc/profile
[root@VM-0-13-centos gitbook]# node -v
v13.14.0
windows安装
安装nodejs
下载地址:https://nodejs.org/download/release/v13.14.0/
添加环境变量:略
安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
安装gitbook-cli
cnpm install -g gitbook-cli --registry=https://registry.npm.taobao.org
gitbook初始化
mkdir gitbook
cd gitbook
gitbook init
初始化成功的样子
[root@VM-0-13-centos gitbook]# gitbook init
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished
[root@VM-0-13-centos gitbook]#
启动项目
[root@VM-0-13-centos gitbook]# cd ..
[root@VM-0-13-centos ~]#
[root@VM-0-13-centos ~]#
[root@VM-0-13-centos ~]# gitbook serve gitbook
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.5s !
Starting server ...
Serving book on http://localhost:4000
访问
打包
gitbook>gitbook build --output .
gitbook>gitbook build --output . gitbook
打包成功之后,默认输出的文件放在 _book
文件夹里面,编译之后的入口: index.html
输出 PDF
cnpm install -g gitbook-pdf --registry=https://registry.npm.taobao.org
gitbook pdf gitbook
#如果,你已经在编写的 gitbook 当前目录,也可以使用相对路径
gitbook pdf .
Summary文件
效果
标签:info,...,教程,loading,OK,centos,gitbook,使用 来源: https://www.cnblogs.com/yzgblogs/p/15969150.html