来自官网的介绍javascript
GitBook is a modern publishing toolchain. Making both writing and collaboration easy.java
GitBook 是一个基于 Node.js 的命令行工具,可以使用 Github/Git 和 Markdown 来制做精美的电子书,GitBook 并不是关于 Git 的教程。node
GitBook支持输出多种文档格式:git
微信小程序使用手册 https://wechats.github.io/tinyapp-doc/github
$ npm install gitbook-cli -g
$ gitbook init [目录名]
这时会在对应目录下生成 README.md 和 SUMMARY.md。 README.md 即为书的简介,会做为书的第一页显示。 SUMMARY.md 是书的目录,是 Gitbook 生成电子书的文件索引。npm
{ "plugins": [ "betterchinese", "-duoshuo", "highlight", "lunr", "baidu_gio", "search", "fontsettings", "theme-default", "toolbar", "sharing" ], "pluginsConfig": { "lunr": { "maxIndexSize": 1000000, "ignoreSpecialCharacters": false }, "baidu_gio": { "token": "Your Token" }, "toolbar": { "buttons": [ { "label": "GitHub", "icon": "fa fa-github", "url": "https://github.com/wechats/tinyapp-doc" }, { "label": "PDF", "icon": "fa fa-file-pdf-o", "url": "https://wechats.github.io/tinyapp-doc/gen/tinyapp-doc.pdf" } ] }, "sharing": { "facebook": false, "twitter": false, "google": false, "weibo": true, "instapaper": false, "vk": false, "all": ["weibo"] } } }
book.json 是 Gitbook 的配置文件,plugins 元素定义 Gitbook 须要哪些插件,开头有‘-’表明禁用某个插件,pluginsConfig 定义某个插件的配置。 Gitbook 默认包含的插件分别是:json
* highlight * search * lunr * sharing * fontsettings * theme-default
若是想安装新插件,只须要先查询到插件名,而后写到 plugins 里面,再执行小程序
$ gitbook install
Gitbook 会自动安装并使用新插件。微信小程序
当编辑完 Gitbook,咱们能够经过如下命令进行测试:服务器
$ gitbook serve
而后访问 http://localhost:4000 就能看到书的效果
经过如下命令,能够输出 Gitbook 静态网站到 _book 文件夹
$ gitbook build
$ gitbook pdf
$ gitbook mobi
$ gitbook epub
Gitbook 官网: https://www.gitbook.com
Gitbook Github: https://github.com/GitbookIO/gitbook
Gitbook Editor: https://www.gitbook.com/editor
Gitbook 插件页:http://plugins.gitbook.com
Gitbook 官方手册:http://toolchain.gitbook.com/
原文请戳: http://www.tonglei.win/2016/10/18/IT学习/Gitbook/学习gitbook发布本身的电子书/ @铜镭