├── .gitignore ├── README.md ├── SUMMARY.md ├── assets ├── basic-usage │ ├── gitbook-editor.png │ └── gitbook-sample.png ├── customize │ └── book-json.png ├── gitbook.com │ ├── book-git-project.png │ ├── book-properties.png │ ├── book-property-domain.png │ ├── book-property-github.png │ ├── book-property-theme.png │ ├── domain-name-config.png │ ├── domain-name-for-test.png │ ├── github-new-project.png │ ├── github-webhook.png │ ├── github.png │ ├── new-book-button.png │ ├── new-book-content-domain.png │ ├── new-book-domain.png │ ├── new-book.png │ ├── publish-book.png │ ├── read-book.png │ ├── select-theme.png │ └── updated-from-github.png ├── github-pages │ └── gitbook-git-pages.png └── plugins │ ├── comscore-theme.png │ └── disqus.png ├── basic-usage └── README.md ├── book.json ├── customize ├── README.md └── book.json.md ├── gitbook.com ├── README.md ├── config.md ├── config │ ├── domain.md │ ├── github.md │ └── theme.md ├── edit.md └── newbook.md ├── github-pages └── README.md ├── installation └── README.md ├── introduction └── README.md └── plugins ├── README.md ├── functional ├── README.md ├── codeblock-filename.md ├── disqus.md ├── multipart.md └── toggle-chapters.md └── theme ├── README.md └── comscore.md /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | _book 3 | *.swp 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitBook 简明教程 2 | 3 | 本教程主要围绕 GitBook 的安装,使用,集成,书籍发布,个性化以及实用插件几个方面。 4 | 5 | 其中借鉴了一些官方的文档以及在互联网上找到的一些内容,主要结合个人经验写成。由于经验有限,难免存在诸多疏漏或者理解不到位的地方,还请斧正! 6 | 7 | 本书发布在 [http://www.chengweiyang.cn/gitbook](http://www.chengweiyang.cn/gitbook)。 8 | 9 | **注意:由于我已经很久没有使用 GitBook 了,GitBook 更新非常快,所以教程中提到的一些插件很可能已经不能正常使用了,特别是 multipart 插件。** 10 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | # GitBook 简明教程 2 | 3 | ## Part I - GitBook Basic 4 | * [简介](introduction/README.md) 5 | * [安装](installation/README.md) 6 | * [使用](basic-usage/README.md) 7 | * [GitBook.com](gitbook.com/README.md) 8 | * [新建书籍](gitbook.com/newbook.md) 9 | * [编辑书籍](gitbook.com/edit.md) 10 | * [配置书籍](gitbook.com/config.md) 11 | * [书籍主题](gitbook.com/config/theme.md) 12 | * [GitHub 集成](gitbook.com/config/github.md) 13 | * [绑定域名](gitbook.com/config/domain.md) 14 | ## Part II - GitBook Advanced 15 | * [个性化配置](customize/README.md) 16 | * [book.json](customize/book.json.md) 17 | * [插件](plugins/README.md) 18 | * [主题插件](plugins/theme/README.md) 19 | * [comscore](plugins/theme/comscore.md) 20 | * [实用插件](plugins/functional/README.md) 21 | * [disqus](plugins/functional/disqus.md) 22 | * [multipart](plugins/functional/multipart.md) 23 | * [toggle-chapters](plugins/functional/toggle-chapters.md) 24 | * [codeblock-filename](plugins/functional/codeblock-filename.md) 25 | * [发布到 GitHub Pages](github-pages/README.md) 26 | -------------------------------------------------------------------------------- /assets/basic-usage/gitbook-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/basic-usage/gitbook-editor.png -------------------------------------------------------------------------------- /assets/basic-usage/gitbook-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/basic-usage/gitbook-sample.png -------------------------------------------------------------------------------- /assets/customize/book-json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/customize/book-json.png -------------------------------------------------------------------------------- /assets/gitbook.com/book-git-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/book-git-project.png -------------------------------------------------------------------------------- /assets/gitbook.com/book-properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/book-properties.png -------------------------------------------------------------------------------- /assets/gitbook.com/book-property-domain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/book-property-domain.png -------------------------------------------------------------------------------- /assets/gitbook.com/book-property-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/book-property-github.png -------------------------------------------------------------------------------- /assets/gitbook.com/book-property-theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/book-property-theme.png -------------------------------------------------------------------------------- /assets/gitbook.com/domain-name-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/domain-name-config.png -------------------------------------------------------------------------------- /assets/gitbook.com/domain-name-for-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/domain-name-for-test.png -------------------------------------------------------------------------------- /assets/gitbook.com/github-new-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/github-new-project.png -------------------------------------------------------------------------------- /assets/gitbook.com/github-webhook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/github-webhook.png -------------------------------------------------------------------------------- /assets/gitbook.com/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/github.png -------------------------------------------------------------------------------- /assets/gitbook.com/new-book-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/new-book-button.png -------------------------------------------------------------------------------- /assets/gitbook.com/new-book-content-domain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/new-book-content-domain.png -------------------------------------------------------------------------------- /assets/gitbook.com/new-book-domain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/new-book-domain.png -------------------------------------------------------------------------------- /assets/gitbook.com/new-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/new-book.png -------------------------------------------------------------------------------- /assets/gitbook.com/publish-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/publish-book.png -------------------------------------------------------------------------------- /assets/gitbook.com/read-book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/read-book.png -------------------------------------------------------------------------------- /assets/gitbook.com/select-theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/select-theme.png -------------------------------------------------------------------------------- /assets/gitbook.com/updated-from-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/gitbook.com/updated-from-github.png -------------------------------------------------------------------------------- /assets/github-pages/gitbook-git-pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/github-pages/gitbook-git-pages.png -------------------------------------------------------------------------------- /assets/plugins/comscore-theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/plugins/comscore-theme.png -------------------------------------------------------------------------------- /assets/plugins/disqus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chengweiv5/gitbook/116ddd92faf24db5713be00cb6457385d99b85ed/assets/plugins/disqus.png -------------------------------------------------------------------------------- /basic-usage/README.md: -------------------------------------------------------------------------------- 1 | # 基本使用 2 | 3 | gitbook 的基本用法非常简单,基本上就只有两步: 4 | 5 | 1. 使用 `gitbook init` 初始化书籍目录 6 | 2. 使用 `gitbook serve` 编译书籍 7 | 8 | 下面将结合一个非常简单的实例,来介绍 gitbook 的基本用法。 9 | 10 | ## gitbook init 11 | 12 | 首先,创建如下目录结构: 13 | 14 | ```bash 15 | $ tree book/ 16 | book/ 17 | ├── README.md 18 | └── SUMMARY.md 19 | 20 | 0 directories, 2 files 21 | ``` 22 | 23 | README.md 和 SUMMARY.md 是两个必须文件,README.md 是对书籍的简单介绍: 24 | 25 | ```bash 26 | $ cat book/README.md 27 | # README 28 | 29 | This is a book powered by [GitBook](https://github.com/GitbookIO/gitbook). 30 | ``` 31 | 32 | SUMMARY.md 是书籍的目录结构。内容如下: 33 | 34 | ```bash 35 | $ cat book/SUMMARY.md 36 | # SUMMARY 37 | 38 | * [Chapter1](chapter1/README.md) 39 | * [Section1.1](chapter1/section1.1.md) 40 | * [Section1.2](chapter1/section1.2.md) 41 | * [Chapter2](chapter2/README.md) 42 | ``` 43 | 44 | 创建了这两个文件后,使用 `gitbook init`,它会为我们创建 SUMMARY.md 中的目录结构。 45 | 46 | ```bash 47 | $ cd book 48 | $ gitbook init 49 | $ tree 50 | . 51 | ├── README.md 52 | ├── SUMMARY.md 53 | ├── chapter1 54 | │   ├── README.md 55 | │   ├── section1.1.md 56 | │   └── section1.2.md 57 | └── chapter2 58 | └── README.md 59 | 60 | 2 directories, 6 files 61 | ``` 62 | 63 | 注意:在我的实验中,`gitbook init` 只支持**两级**目录! 64 | 65 | ## gitbook serve 66 | 67 | 书籍目录结构创建完成以后,就可以使用 `gitbook serve` 来编译和预览书籍了: 68 | 69 | ```bash 70 | $ gitbook serve 71 | Press CTRL+C to quit ... 72 | 73 | Live reload server started on port: 35729 74 | Starting build ... 75 | Successfully built! 76 | 77 | Starting server ... 78 | Serving book on http://localhost:4000 79 | ``` 80 | 81 | `gitbook serve` 命令实际上会首先调用 `gitbook build` 编译书籍,完成以后会打开一个 web 服务器,监听在本地的 4000 端口。 82 | 83 | 现在,可以用浏览器打开 http://127.0.0.1:4000 查看书籍的效果,如下图: 84 | 85 | ![gitbook](../assets/basic-usage/gitbook-sample.png "sample book generated by gitbook") 86 | 87 | 现在,gitbook 为我们创建了书籍目录结构后,就可以向其中添加真正的内容了,文件的编写使用 markdown 语法,在文件修改过程中,每一次保存文件,`gitbook serve` 都会自动重新编译,所以可以持续通过浏览器来查看最新的书籍效果! 88 | 89 | 另外,用户还可以下载 [gitbook 编辑器](https://www.gitbook.com/editor),做到所见即所得的编辑,如下图所示: 90 | 91 | ![gitbook editor](../assets/basic-usage/gitbook-editor.png "gitbook editor") 92 | 93 | gitbook editor 的使用非常简单,这里不再介绍! 94 | -------------------------------------------------------------------------------- /book.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Chengwei Yang ", 3 | "description": "A GitBook about learning GitBook", 4 | "extension": null, 5 | "generator": "site", 6 | "isbn": null, 7 | "links": { 8 | "sharing": { 9 | "all": null, 10 | "facebook": null, 11 | "google": null, 12 | "twitter": null, 13 | "weibo": null 14 | }, 15 | "sidebar": { 16 | "About Me": "http://www.chengweiyang.cn/about", 17 | "Chengwei's Blog": "http://www.chengweiyang.cn" 18 | } 19 | }, 20 | "output": null, 21 | "pdf": { 22 | "fontSize": 12, 23 | "footerTemplate": null, 24 | "headerTemplate": null, 25 | "margin": { 26 | "bottom": 36, 27 | "left": 62, 28 | "right": 62, 29 | "top": 36 30 | }, 31 | "pageNumbers": false, 32 | "paperSize": "a4" 33 | }, 34 | "plugins": [ 35 | "disqus", 36 | "anchors", 37 | "comscore", 38 | "multipart", 39 | "codeblock-filename" 40 | ], 41 | "pluginsConfig": { 42 | "disqus": { 43 | "shortName": "introducetogitbook" 44 | } 45 | }, 46 | "title": "GitBook 简明教程", 47 | "variables": {} 48 | } 49 | -------------------------------------------------------------------------------- /customize/README.md: -------------------------------------------------------------------------------- 1 | # 个性化配置 2 | 3 | 除了修改书籍的主题外,还可以通过配置 `book.json` 文件来修改 gitbook 在编译书籍时的行为,例如:修改书籍的名称,显示效果等等。 4 | -------------------------------------------------------------------------------- /customize/book.json.md: -------------------------------------------------------------------------------- 1 | # book.json 2 | 3 | gitbook 在编译书籍的时候会读取书籍源码顶层目录中的 `book.js` 或者 `book.json`,这里以 `book.json` 为例,参考 [gitbook 文档](https://github.com/GitbookIO/gitbook) 可以知道,`book.json` 支持如下配置: 4 | 5 | ```json 6 | { 7 | // Folders to use for output 8 | // Caution: it overrides the value from the command line 9 | // It's not advised this option in the book.json 10 | "output": null, 11 | 12 | // Generator to use for building 13 | // Caution: it overrides the value from the command line 14 | // It's not advised this option in the book.json 15 | "generator": "site", 16 | 17 | // Book metadats (somes are extracted from the README by default) 18 | "title": null, 19 | "description": null, 20 | "isbn": null, 21 | 22 | // For ebook format, the extension to use for generation (default is detected from output extension) 23 | // "epub", "pdf", "mobi" 24 | // Caution: it overrides the value from the command line 25 | // It's not advised this option in the book.json 26 | "extension": null, 27 | 28 | // Plugins list, can contain "-name" for removing default plugins 29 | "plugins": [], 30 | 31 | // Global configuration for plugins 32 | "pluginsConfig": { 33 | "fontSettings": { 34 | "theme": "sepia", "night" or "white", 35 | "family": "serif" or "sans", 36 | "size": 1 to 4 37 | } 38 | }, 39 | 40 | // Variables for templating 41 | "variables": {}, 42 | 43 | // Links in template (null: default, false: remove, string: new value) 44 | "links": { 45 | // Custom links at top of sidebar 46 | "sidebar": { 47 | "Custom link name": "https://customlink.com" 48 | }, 49 | 50 | // Sharing links 51 | "sharing": { 52 | "google": null, 53 | "facebook": null, 54 | "twitter": null, 55 | "weibo": null, 56 | "all": null 57 | } 58 | }, 59 | 60 | 61 | // Options for PDF generation 62 | "pdf": { 63 | // Add page numbers to the bottom of every page 64 | "pageNumbers": false, 65 | 66 | // Font size for the fiel content 67 | "fontSize": 12, 68 | 69 | // Paper size for the pdf 70 | // Choices are [u’a0’, u’a1’, u’a2’, u’a3’, u’a4’, u’a5’, u’a6’, u’b0’, u’b1’, u’b2’, u’b3’, u’b4’, u’b5’, u’b6’, u’legal’, u’letter’] 71 | "paperSize": "a4", 72 | 73 | // Margin (in pts) 74 | // Note: 72 pts equals 1 inch 75 | "margin": { 76 | "right": 62, 77 | "left": 62, 78 | "top": 36, 79 | "bottom": 36 80 | }, 81 | 82 | //Header HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. 83 | "headerTemplate": null, 84 | 85 | //Footer HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. 86 | "footerTemplate": null 87 | } 88 | } 89 | ``` 90 | 91 | 注意:上面的内容直接从 [gitbook 文档](https://github.com/GitbookIO/gitbook) 中复制,所以可能过期! 92 | 93 | 首先,将这个文件放到书籍代码顶层目录中,命名为 `book.json`,然后编译书籍: 94 | 95 | ```bash 96 | $ gitbook build 97 | ``` 98 | 99 | 可以看到,编译完成,使用 100 | 101 | ```bash 102 | $ gitbook serve 103 | ``` 104 | 105 | 然后将浏览器指向 `http://127.0.0.1:4000`,可以看到,什么都没有改变! 106 | 107 | 是的,虽然这里 `book.json` 文件非法,但是 `gitbook build` 并没有报错!所以,用户需要自己准备工具来保证 `book.json` 必须是一个合法的 JSON 文件,并且不能含有非法配置项。 108 | 109 | 首先,删除注释项,以及空行,如果是在 vim 中,可以执行下面的命令: 110 | 111 | ```vim 112 | :%g/\s*\/\//d 113 | :%g/^\s*$/d 114 | ``` 115 | 116 | 然后,使用 python 来检查 book.json 是否合法,同样,在 vim 中执行下面的命令: 117 | 118 | ```vim 119 | :%!python -m json.tool 120 | ``` 121 | 122 | 很显然,下面的配置不能通过,所以删去(注:但是默认主题却是使用的这个配置!)。 123 | 124 | ```json 125 | "pluginsConfig": { 126 | "fontSettings": { 127 | "theme": "sepia", "night" or "white", 128 | "family": "serif" or "sans", 129 | "size": 1 to 4 130 | } 131 | }, 132 | ``` 133 | 134 | 最后,剩下的内容如下: 135 | 136 | ```json 137 | { 138 | "description": null, 139 | "extension": null, 140 | "generator": "site", 141 | "isbn": null, 142 | "links": { 143 | "sharing": { 144 | "all": null, 145 | "facebook": null, 146 | "google": null, 147 | "twitter": null, 148 | "weibo": null 149 | }, 150 | "sidebar": {} 151 | }, 152 | "output": null, 153 | "pdf": { 154 | "fontSize": 12, 155 | "footerTemplate": null, 156 | "headerTemplate": null, 157 | "margin": { 158 | "bottom": 36, 159 | "left": 62, 160 | "right": 62, 161 | "top": 36 162 | }, 163 | "pageNumbers": false, 164 | "paperSize": "a4" 165 | }, 166 | "plugins": [], 167 | "title": null, 168 | "variables": {} 169 | } 170 | ``` 171 | 172 | 现在,修改一些配置,修改后为: 173 | 174 | ```json 175 | { 176 | "author": "Chengwei Yang ", 177 | "description": "This is a sample book created by gitbook", 178 | "extension": null, 179 | "generator": "site", 180 | "isbn": null, 181 | "links": { 182 | "sharing": { 183 | "all": null, 184 | "facebook": null, 185 | "google": null, 186 | "twitter": null, 187 | "weibo": null 188 | }, 189 | "sidebar": { 190 | "Chengwei's Blog": "http://www.chengweiyang.cn" 191 | } 192 | }, 193 | "output": null, 194 | "pdf": { 195 | "fontSize": 12, 196 | "footerTemplate": null, 197 | "headerTemplate": null, 198 | "margin": { 199 | "bottom": 36, 200 | "left": 62, 201 | "right": 62, 202 | "top": 36 203 | }, 204 | "pageNumbers": false, 205 | "paperSize": "a4" 206 | }, 207 | "plugins": [], 208 | "title": "Sample GitBook", 209 | "variables": {} 210 | } 211 | ``` 212 | 213 | 现在,重新编译书籍,预览效果,如下图所示: 214 | 215 | ![configure book.json](../assets/customize/book-json.png) 216 | 217 | 可以看到,书籍的标题变成了 "Sample GitBook",而且在左边的导航栏中添加了一个链接! 218 | 219 | 需要注意的是:GitBook.com 上的书籍标题经试验不能通过配置 `book.json` 的方式修改 `title`,需要在书籍的属性页面中的 'Settings' 中进行修改! 220 | -------------------------------------------------------------------------------- /gitbook.com/README.md: -------------------------------------------------------------------------------- 1 | # GitBook.com 2 | 3 | [GitBook.com](https://www.gitbook.com/) 是一个围绕 gitbook 发行书籍的社区,于 2014 年初创,GitBook.com 提供免费和付费的服务,而且免费账户就可以享受诸多服务,包括: 4 | 5 | - 1 本私有书籍 6 | - 托管不限数量的公开书籍 7 | - 售卖不限数量的书籍,并分享 80% 的书籍收入 8 | - 不限数量的协作者 9 | - 免费的在线书籍编辑器 10 | 11 | 对于普通用户来说,免费账号就已经够用,因为虽然限制为 1 本私有书籍,但是并没有限制书籍的大小,所以对于个人的学习笔记来说非常合适,用户甚至可以将所有知识归类放入一本私有书籍中!当然,GitBook.com 限制私有书籍数量但不限公开书籍数量的政策,显然是鼓励用户能够共享知识! 12 | -------------------------------------------------------------------------------- /gitbook.com/config.md: -------------------------------------------------------------------------------- 1 | # 配置书籍 2 | 3 | 每本书籍都有一个属性页面,可以配置书籍的各方面属性,接下来将介绍以下几个方面的配置: 4 | 5 | - 书籍主题 6 | - GitHub 集成 7 | - 绑定域名 8 | 9 | 其它方面的配置比较简单,请读者自行摸索! 10 | -------------------------------------------------------------------------------- /gitbook.com/config/domain.md: -------------------------------------------------------------------------------- 1 | # 绑定域名 2 | 3 | 除了可以使用类似 `http://chengweiv5.gitbooks.io/test/content/index.html` 地址访问用户的书籍外,还可以为每本书绑定域名,前提是用户有自己的域名。 4 | 5 | 这里继续以 test book 为例,将其绑定到 test.chengweiyang.cn,这样,用户就可以通过新的域名访问本书! 6 | 7 | ## 修改书籍的域名配置 8 | 9 | 首先,在书籍的属性页面找到 "Domain Names" 属性,如下图: 10 | 11 | ![book domain names](../../assets/gitbook.com/book-property-domain.png) 12 | 13 | 点击 "Domain Names",进入配置页面,如下图: 14 | 15 | ![domain name config](../../assets/gitbook.com/domain-name-config.png) 16 | 17 | 分别为书籍的封面和内容设置一个域名,如下图所示: 18 | 19 | ![domain name for test](../../assets/gitbook.com/domain-name-for-test.png) 20 | 21 | 需要注意的是:这里只能是一个合法的域名,不能是域名下的某个地址,例如:`chengweiyang.cn/test`, `chengweiyang.cn/test/content`。 22 | 23 | ## 配置域名 24 | 25 | 将书籍的访问地址修改为个人的域名后,还需要让个人域名能够找到书籍的内容,这里参考 [gitbook 文档](http://help.gitbook.io/book/domains.html) 来配置。主要的是要为你的域名添加子域名 CNAME,并且指向 gitbook.com,然后等待域名生效,可能需要几分钟到几小时不等。 26 | 27 | 这里不再演示怎样为你的域名添加 CNAME 记录,各个域名服务商提供的工具可能不同,所以用户可以咨询域名提供商获取帮助。 28 | 29 | ## 验证 30 | 31 | 可以使用 `nslookup` 来验证是否解析成功: 32 | 33 | ```bash 34 | $ nslookup test.chengweiyang.cn 35 | Server: 10.11.50.66 36 | Address: 10.11.50.66#53 37 | 38 | Non-authoritative answer: 39 | test.chengweiyang.cn canonical name = www.gitbook.com. 40 | www.gitbook.com canonical name = saga-4658.herokussl.com. 41 | saga-4658.herokussl.com canonical name = elb049689-1604000308.us-east-1.elb.amazonaws.com. 42 | Name: elb049689-1604000308.us-east-1.elb.amazonaws.com 43 | Address: 23.21.177.67 44 | Name: elb049689-1604000308.us-east-1.elb.amazonaws.com 45 | Address: 23.21.212.67 46 | Name: elb049689-1604000308.us-east-1.elb.amazonaws.com 47 | Address: 23.21.54.142 48 | 49 | $ nslookup content.test.chengweiyang.cn 50 | Server: 10.11.50.65 51 | Address: 10.11.50.65#53 52 | 53 | Non-authoritative answer: 54 | content.test.chengweiyang.cn canonical name = www.gitbook.com. 55 | www.gitbook.com canonical name = saga-4658.herokussl.com. 56 | saga-4658.herokussl.com canonical name = elb049689-1604000308.us-east-1.elb.amazonaws.com. 57 | Name: elb049689-1604000308.us-east-1.elb.amazonaws.com 58 | Address: 23.21.212.67 59 | Name: elb049689-1604000308.us-east-1.elb.amazonaws.com 60 | Address: 23.21.54.142 61 | Name: elb049689-1604000308.us-east-1.elb.amazonaws.com 62 | Address: 23.21.177.67 63 | ``` 64 | 65 | 现在,将浏览器指向 `http://test.chengweiyang.cn` 就可以看到书籍了。 66 | 67 | ![test book new domain](../../assets/gitbook.com/new-book-domain.png) 68 | 69 | 点击 "READ" 按钮,或者直接将浏览器指向 `http://content.test.chengweiyang.cn` 就可以阅读书籍内容了! 70 | 71 | ![read test book](../../assets/gitbook.com/new-book-content-domain.png) 72 | -------------------------------------------------------------------------------- /gitbook.com/config/github.md: -------------------------------------------------------------------------------- 1 | # GitHub 集成 2 | 3 | GitBook.com 为每本书籍都创建了一个 Git 项目,并且使用这个 Git 项目来管理书籍源码(注意:这里的源码是指所有用户提交的内容)。正如在 [编辑书籍](/edit.html) 中介绍的那样,我们可以通过向书籍的 Git 项目提交内容来更新书籍。 4 | 5 | 另外,GitBook.com 还可以集成 [GitHub](https://github.com),所以用户可以将书籍的源码通过 GitHub 上的项目来管理,这样可以使用 GitHub 带来的各种优点,例如: 6 | 7 | - 其它用户可以 fork 8 | - 用户可以点赞,获得更新提醒 9 | - 用户可以贡献自己的内容 10 | 11 | 等等。 12 | 13 | 这里,接着之前的实例,将使用 GitHub 中的项目来替代 GitBook.com 上的项目 `https://git.gitbook.com/chengweiv5/test.git`。 14 | 15 | ## 使用 GitHub 上的项目 16 | 17 | 首先,将书籍的 Git 项目设置为 GitHub 上的项目,进入书籍属性页面,找到 "GitHub" 图标,如下图: 18 | 19 | ![book github](../../assets/gitbook.com/book-property-github.png) 20 | 21 | 输入将要使用的 GitHub 上的项目,注意是公开的项目,如下图: 22 | 23 | ![new github tree](../../assets/gitbook.com/github.png) 24 | 25 | 保存后,可以看到之前不可点击的 "Add a deployment webhook" 按钮已经可以点击了,这个按钮表示:每当用户配置的 GitHub 上的项目更新时,自动更新书籍! 26 | 27 | ![github webhook](../../assets/gitbook.com/github-webhook.png) 28 | 29 | ## 创建 GitHub 项目 30 | 31 | 假设上面配置的 GitHub 中的项目并不存在,那么,首先,登陆 GitHub,然后创建一个 test 项目,如下图所示: 32 | 33 | ![create github project](../../assets/gitbook.com/github-new-project.png) 34 | 35 | ## 导入代码 36 | 37 | 现在,将书籍原来的 Git 项目内容导入到新建的 GitHub 中的项目中,假设已经将 `https://git.gitbook.com/chengweiv5/test.git` 项目克隆到了 test 目录: 38 | 39 | ```bash 40 | $ cd test 41 | 42 | $ git remote add github https://github.com/chengweiv5/test.git 43 | 44 | $ git push -u github master 45 | Counting objects: 31, done. 46 | Delta compression using up to 4 threads. 47 | Compressing objects: 100% (26/26), done. 48 | Writing objects: 100% (31/31), 6.58 KiB | 0 bytes/s, done. 49 | Total 31 (delta 7), reused 0 (delta 0) 50 | To https://github.com/chengweiv5/test.git 51 | * [new branch] master -> master 52 | Branch master set up to track remote branch master from github. 53 | ``` 54 | 55 | `git push` 命令中的 `-u` 表示将本地 master 分支的上游分支设置为 github/master,所以以后修改了本地 master 分支后,`git push` 将推送到 github 上,而非原来的 `https://git.gitbook.com/chengweiv5/test.git`。 56 | 57 | ## 更新书籍 58 | 59 | 现在,可以通过提交变更到 GitHub 项目中来更新书籍了,例如: 60 | 61 | ```bash 62 | $ git diff 63 | diff --git a/README.md b/README.md 64 | index e7b10b8..c776a52 100644 65 | --- a/README.md 66 | +++ b/README.md 67 | @@ -2,3 +2,5 @@ GitBook Example 68 | ======= 69 | 70 | Welcome in your GitBook! 71 | + 72 | +Hello from GitHub! 73 | 74 | $ git commit -asm "hello from github" 75 | [master d985a79] hello from github 76 | 1 file changed, 2 insertions(+) 77 | 78 | $ git push 79 | Counting objects: 3, done. 80 | Delta compression using up to 4 threads. 81 | Compressing objects: 100% (3/3), done. 82 | Writing objects: 100% (3/3), 392 bytes | 0 bytes/s, done. 83 | Total 3 (delta 0), reused 0 (delta 0) 84 | To https://github.com/chengweiv5/test.git 85 | b6a8b3f..d985a79 master -> master 86 | ``` 87 | 88 | ![hello from github](../../assets/gitbook.com/updated-from-github.png) 89 | -------------------------------------------------------------------------------- /gitbook.com/config/theme.md: -------------------------------------------------------------------------------- 1 | # 书籍主题 2 | 3 | GitBook.com 上的书籍可以自由配置主题,首先进入书籍的属性页面,下拉页面找到 "Theme" 图标,如下图所示: 4 | 5 | ![theme](../../assets/gitbook.com/book-property-theme.png) 6 | 7 | 点击 "Theme" 后,出现主题选择页面,目前提供了 4 种可选主题,用户可以选择其中一种作为书籍的主题,如下图所示: 8 | 9 | ![select theme](../../assets/gitbook.com/select-theme.png) 10 | 11 | 最后,点击 "Save" 按钮,保存即可! 12 | -------------------------------------------------------------------------------- /gitbook.com/edit.md: -------------------------------------------------------------------------------- 1 | # 编辑书籍 2 | 3 | 在创建了书籍后,可以使用免费的在线编辑器进行编辑,也可以使用 [gitbook editor](https://www.gitbook.com/editor) 编辑,甚至使用任何喜欢的文本编辑器来编辑,例如:Vim。 4 | 5 | ## 在线编辑 6 | 7 | 进入到书籍的属性页面后,点击 "Edit Book" 按钮即可打开在线编辑器。 8 | 9 | GitBook 的在线编辑器对于国内用户来说,很可能不能访问,所以最好还是下载 [gitbook editor](https://www.gitbook.com/editor) 到本地,安装后使用,或者使用自己喜欢的文本编辑器直接编辑。 10 | 11 | ## gitbook editor 12 | 13 | gitbook editor 实际上就是一个本地应用版的在线编辑器,使用方式和在线编辑器类似,所见即所得,这里不再介绍,读者可以参考 [gitbook 使用](/basic-usage/README.html) 中的内容。 14 | 15 | ## Git & Markdown 16 | 17 | 另一种方式,是直接使用文本编辑器,编写 Markdown 文档,然后,使用 Git 提交到书籍的远程项目,当然,提交前,最好在本地使用 `gitbook` 预览效果;提交后,GitBook.com 会自动生成更新书籍的内容。 18 | 19 | ### 克隆书籍源代码 20 | 21 | GitBook.com 上的每本书都使用 Git 项目来管理,所以,这里首先需要克隆需要编辑书籍的 Git 项目,登陆 GitBook.com 后,跳转到书籍的属性页面,如下图所示: 22 | 23 | ![book properties](../assets/gitbook.com/book-properties.png) 24 | 25 | 点击 "Edit Book" 上方的 "learn more",将会展现此书籍的 Git 项目地址,以及简单的使用方法,如下图所示: 26 | 27 | ![git project](../assets/gitbook.com/book-git-project.png) 28 | 29 | 使用如下命令,克隆书籍的源代码: 30 | 31 | ```bash 32 | $ git clone https://git.gitbook.com/chengweiv5/test.git 33 | Cloning into 'test'... 34 | remote: Counting objects: 28, done. 35 | remote: Compressing objects: 100% (17/17), done. 36 | remote: Total 28 (delta 6), reused 28 (delta 6) 37 | Unpacking objects: 100% (28/28), done. 38 | Checking connectivity... done. 39 | 40 | $ cd test/ 41 | 42 | $ ls 43 | README.md SUMMARY.md 44 | 45 | $ git log --oneline 46 | 07bde6c Cleanup example 47 | 6d368db Add _book to gitignore 48 | 20779f5 Add explanation in README.md 49 | 1b5b1a6 Create chapter-1/ARTICLE1.md 50 | 77b1858 Add help message in SUMMARY.md 51 | 210e3fe Create chapter-1/README.md 52 | 5570112 Create SUMMARY.md 53 | 2a8a0c3 Initial commit 54 | ``` 55 | 56 | 可以看到,创建好的书籍默认已经创建了一些内容,但是这些内容是还没有发布的,所以其它人不能阅读! 57 | 58 | ### 编辑内容 59 | 60 | 现在,可以参考 [gitbook 使用](/basic-usage/README.html) 中的内容来编辑书籍内容,使用 `gitbook init`, `gitbook serve` 来预览,完成后,可以提交修改: 61 | 62 | ```bash 63 | $ git commit -asm "init book" 64 | ``` 65 | 66 | ### 发布内容 67 | 68 | 最后,提交到远程 Git 项目: 69 | 70 | ```bash 71 | $ git push 72 | Counting objects: 3, done. 73 | Delta compression using up to 4 threads. 74 | Compressing objects: 100% (3/3), done. 75 | Writing objects: 100% (3/3), 362 bytes | 0 bytes/s, done. 76 | Total 3 (delta 1), reused 0 (delta 0) 77 | To https://git.gitbook.com/chengweiv5/test.git 78 | 07bde6c..b6a8b3f master -> master 79 | ``` 80 | 81 | ### 阅读书籍 82 | 83 | 提交到 GitBook.com 后,书籍就自动发布了,用户就可以通过书籍的地址访问了,例如:`http://chengweiv5.gitbooks.io/test/` 84 | 85 | ![publish book](../assets/gitbook.com/publish-book.png) 86 | 87 | 点击 "READ" 按钮,就可以阅读书籍的内容了,如下图所示: 88 | 89 | ![read book](../assets/gitbook.com/read-book.png) 90 | -------------------------------------------------------------------------------- /gitbook.com/newbook.md: -------------------------------------------------------------------------------- 1 | # 新建书籍 2 | 3 | 要使用 GitBook.com 来托管你的书籍,首先需要注册一个账号,免费注册后,用户也可以选择升级为付费用户,享受更多的服务! 4 | 5 | 登陆 [GitBook.com](https://www.gitbook.com) 后,在用户页面,可以管理现有书籍以及创建新的书籍,如下图: 6 | 7 | ![create a new book](../assets/gitbook.com/new-book-button.png "create a new book") 8 | 9 | 点击 "+ Create a new book" 后,跳转到新建书籍页面,如下图: 10 | 11 | ![setup a new book](../assets/gitbook.com/new-book.png "setup a new book") 12 | 13 | 目前有 4 中书籍主题可以选择,这里以默认的 `Basic` 主题为例,输入书籍名字后,点击 "Create book",完成书籍的创建。 14 | 15 | 创建完成后,就会进入书籍属性页面,如下图所示: 16 | 17 | ![book properties](../assets/gitbook.com/book-properties.png) 18 | 19 | 这里可以进行对书籍的各个属性进行配置,例如: 20 | 21 | - 编辑书籍(Edit Book) 22 | - 书籍主题(Theme) 23 | - 绑定 GitHub(GitHub) 24 | - 绑定域名(Domain Names) 25 | 26 | 等。 27 | 28 | 以上几个配置将在后面介绍,其它的配置比较简单,请读者自行探索! 29 | -------------------------------------------------------------------------------- /github-pages/README.md: -------------------------------------------------------------------------------- 1 | # 发布到 GitHub Pages 2 | 3 | 除了能够将书籍发布到 GitBook.com 外,还可以将书籍发布到 GitHub Pages,由于没有找到官方文档,所以这里记录的是我自己正在使用的一种方法。 4 | 5 | 如果读者不了解 GitHub Pages 为何物,简单说就是一个可以托管静态网站的 Git 项目,支持使用 markdown 语法以及 Jekyll 来构建,或者直接使用已经生成好的静态站点。详细可以参考 [GitHub Pages 主页](https://pages.github.com/)。 6 | 7 | 由于 gitbook 书籍可以通过 `gitbook` 本地构建出 site 格式,所以可以直接将构建好的书籍直接放到 GitHub Pages 中托管,之后,可以通过如下地址访问书籍: 8 | 9 | `.github.io/` 10 | 11 | 例如:这本书中使用的例子 'test' 项目可以通过地址:*chengweiv5.github.io/test* 来访问。 12 | 13 | 当访问 *chengweiv5.github.io/test* 时,会访问 *chengweiv5/test* 项目的 *gh-pages* 分支的内容,所以需要为项目创建一个 *gh-pages* 分支,并且将静态站点内容放入其中。也就是说,test 项目将有如下两个分支: 14 | 15 | - master, 保存书籍的源码 16 | - gh-pages, 保存书籍编译后的 HTML 文件 17 | 18 | ## 构建书籍 19 | 20 | 首先,使用 `gitbook build` 将书籍内容输出到默认目录,也就是当前目录下的 *_book* 目录。 21 | 22 | ```bash 23 | $ gitbook build 24 | Starting build ... 25 | Successfully built! 26 | 27 | $ ls _book 28 | GLOSSARY.html chapter1 chapter2 gitbook glossary_index.json index.html search_index.json 29 | ``` 30 | 31 | ## 创建 gh-pages 分支 32 | 33 | 执行如下命令来创建分支,并且删除不需要的文件: 34 | 35 | ```bash 36 | $ git checkout --orphan gh-pages 37 | $ git rm --cached -r . 38 | $ git clean -df 39 | $ rm -rf *~ 40 | ``` 41 | 42 | 现在,目录下应该只剩下 *_book* 目录了,首先,忽略一些文件: 43 | 44 | ```bash 45 | $ echo "*~" > .gitignore 46 | $ echo "_book" >> .gitignore 47 | $ git add .gitignore 48 | $ git commit -m "Ignore some files" 49 | ``` 50 | 51 | 然后,加入 *_book* 下的内容到分支中: 52 | 53 | ```bash 54 | $ cp -r _book/* . 55 | $ git add . 56 | $ git commit -m "Publish book" 57 | ``` 58 | ## 上传书籍内容到 GitHub 59 | 60 | 现在,可以将编译好的书籍内容上传到 GitHub 中 *test* 项目的 *gh-pages* 分支了,虽然这里还没有创建分支,上传和创建会一步完成! 61 | 62 | ```bash 63 | $ git push -u origin gh-pages 64 | Counting objects: 49, done. 65 | Delta compression using up to 4 threads. 66 | Compressing objects: 100% (45/45), done. 67 | Writing objects: 100% (49/49), 1.34 MiB | 131.00 KiB/s, done. 68 | Total 49 (delta 5), reused 0 (delta 0) 69 | To https://github.com/chengweiv5/test.git 70 | * [new branch] gh-pages -> gh-pages 71 | Branch gh-pages set up to track remote branch gh-pages from github. 72 | ``` 73 | 74 | 现在,书籍的内容已经上传到 GitHub 上,所以通过访问 *chengweiv5.github.io/test* 就可以阅读 *test* 这本书了! 75 | 76 | ![gitbook git-pages](../assets/github-pages/gitbook-git-pages.png) 77 | 78 | 注意:由于我将 *chengweiv5.github.io* 重定向到了个人站点 *www.chengweiyang.cn*,所以可以看到,浏览器中的 URL 自动变成了 *www.chengweiyang.cn/test*,非常 cool! 关于怎样重定向 GitHub Pages 到个人域名,请参考博客:[怎样使用 GitHub Pages 搭建个人站点](http://www.chengweiyang.cn/2014/07/19/Whats-behind-this-site/)。 79 | -------------------------------------------------------------------------------- /installation/README.md: -------------------------------------------------------------------------------- 1 | # 安装 2 | 3 | [gitbook](https://github.com/GitbookIO/gitbook) 的安装非常简单,详细指南可以参考 [gitbook 文档](https://github.com/GitbookIO/gitbook)。 4 | 5 | 这里的安装只需要一步就能完成! 6 | 7 | ```bash 8 | $ npm install gitbook-cli -g 9 | ``` 10 | 11 | 需要注意的是:用户首先需要安装 nodejs,以便能够使用 npm 来安装 gitbook。 12 | -------------------------------------------------------------------------------- /introduction/README.md: -------------------------------------------------------------------------------- 1 | # 简介 2 | 3 | > Modern book format and toolchain using Git and Markdown 4 | 5 | 这是 [gitbook](https://github.com/GitbookIO/gitbook) 项目主页上对 gitbook 的定义。 6 | 7 | gitbook 首先是一个软件,正如上面定义的那样,它使用 Git 和 Markdown 来编排书本,如果用户没有听过 Git 和 Markdown,那么 gitbook 可能不适合你! 8 | 9 | 本书也是使用 gitbook 生成,所以在看到这里的时候,你应该对 gitbook 的魔力有了初步印象! 10 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # 插件 2 | 3 | gitbook 还支持许多插件,用户可以从 [NPM](https://www.npmjs.com) 上搜索 gitbook 的插件,[gitbook 文档](https://github.com/GitbookIO/plugin) 推荐插件的命名方式为: 4 | 5 | - gitbook-plugin-X: 插件 6 | - gitbook-theme-X: 主题 7 | 8 | 所以,可以通过以上两种方式来搜索 gitbook 的插件或者主题。 9 | -------------------------------------------------------------------------------- /plugins/functional/README.md: -------------------------------------------------------------------------------- 1 | # 实用插件 2 | 3 | 除了主题插件意外,gitbook 也有很多实用性插件,用户可以在 [GitHub](https://github.com/GitbookIO/gitbook) 或者 [NPM](https://www.npmjs.com) 上搜索 `gitbook-plugin` 来查找。 4 | 5 | 里将介绍其中几种插件的使用,包括: 6 | 7 | - disqus, 集成用户评论系统 8 | -------------------------------------------------------------------------------- /plugins/functional/codeblock-filename.md: -------------------------------------------------------------------------------- 1 | # codeblock-filename 2 | 3 | [codeblock-filename](https://www.npmjs.com/package/gitbook-plugin-codeblock-filename) 可以为代码添加一个文件名,以便显示当前代码段属于的文件。 4 | 5 | 例如: 6 | 7 | ```python:hello.py 8 | print "hello" 9 | ``` 10 | -------------------------------------------------------------------------------- /plugins/functional/disqus.md: -------------------------------------------------------------------------------- 1 | # Disqus 2 | 3 | [Disqus](https://disqus.com) 是一个非常流行的为网站集成评论系统的工具,同样,gitbook 也可以集成 disqus 以便可以和读者交流。 4 | 5 | 首先,需要在 disqus 上注册一个账号,然后添加一个 website,这会获得一个关键字,然后在集成时配置这个关键字即可。 6 | 7 | ## 安装 disqus 插件 8 | 9 | 可以参考 [插件项目主页](https://github.com/GitbookIO/plugin-disqus) 来安装,命令如下: 10 | 11 | ```bash 12 | $ npm install gitbook-plugin-disqus -g 13 | ``` 14 | 15 | 然后,修改 `book.json` 配置文件,添加插件的配置内容: 16 | 17 | ```json 18 | { 19 | "plugins": ["disqus"], 20 | "pluginsConfig": { 21 | "disqus": { 22 | "shortName": "introducetogitbook" 23 | } 24 | } 25 | } 26 | ``` 27 | 28 | 注意:上面的 `shortName` 的值就是你在 disqus 上创建的 website 获得的唯一关键字。 29 | 30 | 效果如下图所示: 31 | 32 | ![disqus](../../assets/plugins/disqus.png) 33 | -------------------------------------------------------------------------------- /plugins/functional/multipart.md: -------------------------------------------------------------------------------- 1 | # multipart 2 | 3 | [multipart](https://www.npmjs.com/package/gitbook-plugin-multipart) 插件可以将书籍分成几个部分,例如: 4 | 5 | - GitBook Basic 6 | - GitBook Advanced 7 | 8 | 对有非常多章节的书籍非常有用,分成两部分后,各个部分的章节都从 1 开始编号。 9 | 10 | ## 安装及配置 11 | 12 | 和安装其它插件一样,执行以下命令: 13 | 14 | ```bash 15 | $ npm install gitbook-plugin-multipart -g 16 | ``` 17 | 18 | 然后编辑 `book.json` 添加 multipart 到 plugins 中: 19 | 20 | ```json 21 | "plugins": [ 22 | "multipart" 23 | ], 24 | ``` 25 | -------------------------------------------------------------------------------- /plugins/functional/toggle-chapters.md: -------------------------------------------------------------------------------- 1 | # toggle-chapters 2 | 3 | [toggle-chapters](https://www.npmjs.com/package/gitbook-plugin-toggle-chapters) 插件的效果是:默认只在目录导航中显示章的标题,而不会显示小节的标题,点击每一章或者每一节会显示当前章或节的子目录,如果有的话,但是同时会收起其它之前展开的章节。所以,个人认为不是非常实用,因为这样子用户不能快速跳转到没有展开的章节! 4 | 5 | 安装和使用非常简单,参考官方文档即可! 6 | -------------------------------------------------------------------------------- /plugins/theme/README.md: -------------------------------------------------------------------------------- 1 | # 主题插件 2 | 3 | 虽然 gitbook 默认的主题已经非常不错,但是,还有一些非常值得推荐的主题,用户可以通过在 [NPM](https://www.npmjs.com) 上搜索 `gitbook-theme` 来查找主题插件。 4 | 5 | 这里将分别介绍几种主题插件的使用方法,抛砖引玉! 6 | -------------------------------------------------------------------------------- /plugins/theme/comscore.md: -------------------------------------------------------------------------------- 1 | # ComScore 2 | 3 | ComScore 是一个彩色主题,默认的 gitbook 主题是黑白的,也就是标题和正文都是黑色的,而 ComScore 可以为各级标题添加不同的颜色,更容易区分各级标题,效果如下图所示: 4 | 5 | ![comscore theme](../../assets/plugins/comscore-theme.png) 6 | --------------------------------------------------------------------------------