background
Due regard scattered knowledge before they are written in Gist , the time you are looking for is not very systematic, so I plan to be moved GitBook up unified management, and GitBook After writing the compiler can generate static pages posted to the blog, grid full force look.
GitBook Profile
GitBook preparations
Install Node.js
GitBook is a Node.js based command-line tool, download and install Node.js , after the installation is complete, you can use the following command to verify that the installation was successful.
$ node -v
v7.7.1
Installation GitBook
Enter the following command to install GitBook.
$ npm install gitbook-cli -g
After the installation is complete, you can use the following command to verify that the installation was successful.
$ gitbook -V
CLI version: 2.3.2
GitBook version: 3.2.3
For more details, please refer to GitBook installation documentation to install GitBook.
Installation GitBook Editor
Go GitBook official website to download GitBook editor; If you're a Mac user and installed brew cask
, then you can use the brew cask install gitbook-editor
command line to install GitBook editor.
Preview
After GitBook ready to do a good job, we enter the one you're writing a book directory, enter the following command.
$ gitbook init
warn: no summary file in this book
info: create README.md info: create SUMMARY.md info: initialization is finished
You can see that he would create README.md and SUMMARY.md these two documents, README.md should not be unfamiliar, it is the documentation, and book chapters SUMMARY.md is actually a directory, its default contents are as follows:
# Summary
* [Introduction](README.md)
Next, we enter $ gitbook serve
the command, then enter in the browser address bar http://localhost:4000
can preview books.
Results as shown below:
After running the command generates a folder in the books _book
folder containing the content that is generated html file, we can use the following command to generate the page rather than on the server.
gitbook build
Below we explain in detail the directory structure under GitBook and related documents.
Directory Structure
GitBook basic directory structure is shown below:
.
├── book.json
├── README.md
├── SUMMARY.md ├── chapter-1/ | ├── README.md | └── something.md └── chapter-2/ ├── README.md └── something.md
Let's say something about book.json and SUMMARY.md main file.
book.json
This file is mainly used to store configuration information, I will release my profile.
{
"title": "Blankj's Glory", "author": "Blankj", "description": "select * from learn", "language": "zh-hans", "gitbook": "3.2.3", "styles": { "website": "./styles/website.css" }, "structure": { "readme": "README.md" }, "links": { "sidebar": { "我的狗窝": "https://blankj.com" } }, "plugins": [ "-sharing", "splitter", "expandable-chapters-small", "anchors", "github", "github-buttons", "donate", "sharing-plus", "anchor-navigation-ex", "favicon" ], "pluginsConfig": { "github": { "url": "https://github.com/Blankj" }, "github-buttons": { "buttons": [{ "user": "Blankj", "repo": "glory", "type": "star", "size": "small", "count": true } ] }, "donate": { "alipay": "./source/images/donate.png", "title": "", "button": "赞赏", "alipayText": " " }, "sharing": { "douban": false, "facebook": false, "google": false, "hatenaBookmark": false, "instapaper": false, "line": false, "linkedin": false, "messenger": false, "pocket": false, "qq": false, "qzone": false, "stumbleupon": false, "twitter": false, "viber": false, "vk": false, "weibo": false, "whatsapp": false, "all": [ "google", "facebook", "weibo", "twitter", "qq", "qzone", "linkedin", "pocket" ] }, "anchor-navigation-ex": { "showLevel": false }, "favicon":{ "shortcut": "./source/images/favicon.jpg", "bookmark": "./source/images/favicon.jpg", "appleTouch":