安装GitBook环境

1、安装

# npm install gitbook
# npm install ebook-convert
npm install gitbook-cli -g 
gitbook install

2、设置国内源

npm config set registry https://registry.npmjs.org/
npm config set registry https://registry.npm.taobao.org

3、增加转PDF支持

# windows
https://calibre-ebook.com/download_windows64

#linux
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
sudo apt-get install libfontconfig1 libxcomposite1 libxdamage1 libxfixes3 libgl1

#linux字体安装
#将需要的字体拷贝到这个文件夹
#/usr/share/fonts/truetype/winfonts
#刷新
sudo fc-cache -fv
#确保ubuntu认到字体
fc-list :lang=zh-cn

4、基本操作

# 新建一本书的目录结构
gitbook init

# 开启网站查看书的内容
gitbook serve .

# 图书生成pdf
gitbook pdf .

Leave a Reply

Your email address will not be published. Required fields are marked *

*