來自官網的介紹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發佈本身的電子書/ @銅鐳