├── .gitignore ├── README.md ├── SUMMARY.md ├── _book ├── book │ ├── editor.html │ ├── gitbook-cli.html │ └── index.html ├── end │ └── index.html ├── gitbook │ ├── app.js │ ├── fonts │ │ ├── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── merriweather │ │ │ ├── 250.woff │ │ │ ├── 250i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 700.woff │ │ │ ├── 700i.woff │ │ │ ├── 900.woff │ │ │ └── 900i.woff │ │ └── opensans │ │ │ ├── 300.woff │ │ │ ├── 300i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 600.woff │ │ │ ├── 600i.woff │ │ │ ├── 700.woff │ │ │ └── 700i.woff │ ├── images │ │ ├── apple-touch-icon-precomposed-152.png │ │ └── favicon.ico │ ├── plugins │ │ └── gitbook-plugin-livereload │ │ │ └── plugin.js │ ├── print.css │ └── style.css ├── howtouse │ ├── Nodejsinstall.html │ ├── gitbookcli.html │ ├── gitbookinstall.html │ └── index.html ├── imgs │ ├── create_gitbook.png │ ├── git_repository.png │ ├── gitbook_github.png │ ├── github_integration.png │ ├── node.js.png │ ├── settings.png │ └── yl.png ├── index.html ├── output │ ├── index.html │ ├── outfile.html │ └── pdfandebook.html ├── publish │ ├── gitbook.html │ ├── github.html │ ├── gitpages.html │ └── index.html └── search_index.json ├── book ├── README.md ├── editor.md └── gitbook-cli.md ├── end └── README.md ├── gitbook入门教程.pdf ├── howtouse ├── Nodejsinstall.md ├── README.md ├── gitbookcli.md └── gitbookinstall.md ├── imgs ├── create_gitbook.png ├── git_repository.png ├── gitbook_github.png ├── github_integration.png ├── node.js.png ├── settings.png └── yl.png ├── outbook ├── book │ ├── editor.html │ ├── gitbook-cli.html │ └── index.html ├── end │ └── index.html ├── gitbook │ ├── app.js │ ├── fonts │ │ ├── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── merriweather │ │ │ ├── 250.woff │ │ │ ├── 250i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 700.woff │ │ │ ├── 700i.woff │ │ │ ├── 900.woff │ │ │ └── 900i.woff │ │ └── opensans │ │ │ ├── 300.woff │ │ │ ├── 300i.woff │ │ │ ├── 400.woff │ │ │ ├── 400i.woff │ │ │ ├── 600.woff │ │ │ ├── 600i.woff │ │ │ ├── 700.woff │ │ │ └── 700i.woff │ ├── images │ │ ├── apple-touch-icon-precomposed-152.png │ │ └── favicon.ico │ ├── print.css │ └── style.css ├── howtouse │ ├── Nodejsinstall.html │ ├── gitbookcli.html │ ├── gitbookinstall.html │ └── index.html ├── imgs │ ├── create_gitbook.png │ ├── git_repository.png │ ├── gitbook_github.png │ ├── github_integration.png │ ├── node.js.png │ ├── settings.png │ └── yl.png ├── index.html ├── output │ ├── index.html │ ├── outfile.html │ └── pdfandebook.html ├── publish │ ├── gitbook.html │ ├── github.html │ ├── gitpages.html │ └── index.html └── search_index.json ├── output ├── README.md ├── outfile.md └── pdfandebook.md └── publish ├── README.md ├── gitbook.md ├── github.md └── gitpages.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Node rules: 2 | ## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 3 | .grunt 4 | 5 | ## Dependency directory 6 | ## Commenting this out is preferred by some people, see 7 | ## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git 8 | node_modules 9 | 10 | # Book build output 11 | 12 | 13 | # eBook build output 14 | *.epub 15 | *.mobi 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Gitbook 入门教程 3 | ========== 4 | 5 | 6 | ####本书参考如下两篇文章整理而成,并且有所修改: 7 | 8 | 1. 在线阅读: 9 | 2. 在线阅读: 10 | 11 | > GitBook 是一个基于 Node.js 的命令行工具,可使用 Github/Git 和 Markdown 来制作精美的电子书。 12 | 13 | 本书将简单介绍如何安装、编写、生成、发布一本在线图书,且示例全部在windows下展示(其他系统差不多一致): 14 | 15 | ## 支持格式 16 | 17 | GitBook支持输出多种文档格式,如: 18 | 19 | - 静态站点:GitBook默认输出该种格式,生成的静态站点可直接托管搭载Github Pages服务上; 20 | - PDF:需要安装[ebook-concert](http://calibre-ebook.com/download)依赖; 21 | - eBook:需要安装[ebook-concert](http://calibre-ebook.com/download); 22 | - 单HTML网页:支持将内容输出为单页的HTML,不过一般用在将电子书格式转换为PDF或eBook的中间过程; 23 | - JSON:一般用于电子书的调试或元数据提取。 24 | 25 | ## Gitbook项目地址 26 | 27 | - GitBook项目官网: 28 | - GitBook Github地址: 29 | 30 | ## 本项目地址 31 | 32 | - 仓库: 33 | - 在线阅读: 34 | 35 | -------------------------------------------------------------------------------- /SUMMARY.md: -------------------------------------------------------------------------------- 1 | 2 | * [基本安装](howtouse/README.md) 3 | - [Node.js安装](howtouse/Nodejsinstall.md) 4 | - [Gitbook安装](howtouse/gitbookinstall.md) 5 | - [Gitbook命令行速览](howtouse/gitbookcli.md) 6 | * [图书编辑](book/README.md) 7 | - [gitbook命令行&markdown编辑](book/gitbook-cli.md) 8 | - [gitbook editor编辑](book/editor.md) 9 | * [图书输出](output/README.md) 10 | - [输出为静态网站](output/outfile.md) 11 | - [输出PDF](output/pdfandebook.md) 12 | * [发布](publish/README.md) 13 | - [发布到gitbook.com](publish/gitbook.md) 14 | - [发布到github仓库](publish/github.md) 15 | - [发布到Github Pages](publish/gitpages.md) 16 | * [结束](end/README.md) 17 | -------------------------------------------------------------------------------- /_book/book/editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | gitbook editor编辑 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

gitbook editor编辑

422 |

gitbook editor 实际上就是一个本地应用版的在线编辑器,使用方式和 gitbook在线编辑器类似,而这里的目录及章节是使用编辑器添加生成,同时也会存放到本地之前建立的目录.

423 | 424 | 425 |
426 | 427 | 428 |
429 |
430 |
431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 |
439 |
440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 454 | 455 | 456 | 457 | 458 | 459 | -------------------------------------------------------------------------------- /_book/book/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 图书编辑 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

书籍编辑

422 |

gitbook书籍编辑有两种方法:

423 |
    424 |
  • gitbook命令行&markdown编辑:README.mdSUMMARY.md是Gitbook项目必备的两个文件,也就是一本最简单的gitbook也必须含有这两个文件,它们在一本Gitbook中具有不同的用处;
  • 425 |
  • 使用gitbook官方编辑器编辑,下载到本地即可。
  • 426 |
427 | 428 | 429 |
430 | 431 | 432 |
433 |
434 |
435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 |
443 |
444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 458 | 459 | 460 | 461 | 462 | 463 | -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/250.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/250.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/250i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/250i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/400.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/400i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/400i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/700.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/700i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/700i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/900.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/merriweather/900i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/merriweather/900i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/300.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/300i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/300i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/400.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/400i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/400i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/600.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/600.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/600i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/600i.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/700.woff -------------------------------------------------------------------------------- /_book/gitbook/fonts/opensans/700i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/fonts/opensans/700i.woff -------------------------------------------------------------------------------- /_book/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /_book/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /_book/gitbook/plugins/gitbook-plugin-livereload/plugin.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var newEl = document.createElement('script'), 3 | firstScriptTag = document.getElementsByTagName('script')[0]; 4 | 5 | if (firstScriptTag) { 6 | newEl.async = 1; 7 | newEl.src = '//' + window.location.hostname + ':35729/livereload.js'; 8 | firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag); 9 | } 10 | 11 | })(); 12 | -------------------------------------------------------------------------------- /_book/gitbook/print.css: -------------------------------------------------------------------------------- 1 | .link-inherit{color:inherit}.link-inherit:hover,.link-inherit:focus{color:inherit}.hidden{display:none}.hljs-comment,.hljs-title{color:#8e908c}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#c82829}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#f5871f}.ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#eab700}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor{color:#3e999f}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{display:block;background:white;color:#4d4d4c;padding:.5em}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}.page.page-toc .glossary{margin-bottom:40px}.page.page-toc .glossary h2 a,.page.page-toc .glossary h2 a:hover{color:inherit;text-decoration:none}.page.page-toc .glossary .glossary-index{list-style:none;margin:0;padding:0}.page.page-toc .glossary .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}.page .book-chapter{display:none}body .page{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;line-height:1.4;color:#333;overflow:hidden;line-height:1.6;word-wrap:break-word;display:block}body .page>*:first-child{margin-top:0!important}body .page>*:last-child{margin-bottom:0!important}body .page a{background:transparent}body .page a:active,body .page a:hover{outline:0}body .page strong{font-weight:bold}body .page h1{font-size:2em;margin:.67em 0}body .page img{border:0}body .page hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}body .page pre{overflow:auto}body .page code,body .page pre{font-family:monospace,monospace;font-size:1em}body .page table{border-collapse:collapse;border-spacing:0}body .page td,body .page th{padding:0}body .page *{-moz-box-sizing:border-box;box-sizing:border-box}body .page a{color:#4183c4;text-decoration:none}body .page a:hover,body .page a:focus,body .page a:active{text-decoration:underline}body .page hr{height:0;margin:15px 0;overflow:hidden;background:transparent;border:0;border-bottom:1px solid #ddd}body .page hr:before,body .page hr:after{display:table;content:" "}body .page hr:after{clear:both}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{margin-top:15px;margin-bottom:15px;line-height:1.1}body .page h1{font-size:30px}body .page h2{font-size:21px}body .page h3{font-size:16px}body .page h4{font-size:14px}body .page h5{font-size:12px}body .page h6{font-size:11px}body .page blockquote{margin:0}body .page ul,body .page ol{padding:0;margin-top:0;margin-bottom:0}body .page ol ol{list-style-type:lower-roman}body .page dd{margin-left:0}body .page code,body .page pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}body .page pre{margin-top:0;margin-bottom:0}body .page .markdown-body>*:first-child{margin-top:0!important}body .page .markdown-body>*:last-child{margin-bottom:0!important}body .page .anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}body .page .anchor:focus{outline:0}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:bold;line-height:1.4}body .page h1{padding-bottom:.3em;font-size:2.25em;line-height:1.2;border-bottom:1px solid #eee}body .page h2{padding-bottom:.3em;font-size:1.75em;line-height:1.225;border-bottom:1px solid #eee}body .page h3{font-size:1.5em;line-height:1.43}body .page h4{font-size:1.25em}body .page h5{font-size:1em}body .page h6{font-size:1em;color:#777}body .page p,body .page blockquote,body .page ul,body .page ol,body .page dl,body .page table,body .page pre{margin-top:0;margin-bottom:16px}body .page hr{height:4px;padding:0;margin:16px 0;background-color:#e7e7e7;border:0 none}body .page ul,body .page ol{padding-left:2em}body .page ol ol,body .page ol ul,body .page ul ul{margin-top:0;margin-bottom:0}body .page dl{padding:0}body .page dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}body .page dl dd{padding:0 16px;margin-bottom:16px}body .page blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}body .page blockquote>:first-child{margin-top:0}body .page blockquote>:last-child{margin-bottom:0}body .page table{display:block;width:100%;overflow:auto}body .page table th{font-weight:bold}body .page table th,body .page table td{padding:6px 13px;border:1px solid #ddd}body .page table tr{background-color:#fff;border-top:1px solid #ccc}body .page table tr:nth-child(2n){background-color:#f8f8f8}body .page img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box;page-break-inside:avoid}body .page code{padding:0;padding-top:.2em;padding-bottom:.2em;margin:0;font-size:85%;background-color:#f7f7f7;border-radius:3px}body .page code:before,body .page code:after{letter-spacing:-0.2em;content:"\00a0"}body .page pre>code{padding:0;margin:0;font-size:100%;white-space:pre;background:transparent;border:0}body .page .highlight pre,body .page pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f7f7f7;border:0;border-radius:3px}body .page pre{word-wrap:normal}body .page pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}body .page pre code:before,body .page pre code:after{content:normal}body .page .highlight{background:#fff} -------------------------------------------------------------------------------- /_book/howtouse/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 基本安装 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

基本安装

422 |

本章内容讲述Gitbook的安装及命令行的功能快速预览说明。

423 | 424 | 425 |
426 | 427 | 428 |
429 |
430 |
431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 |
439 |
440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 454 | 455 | 456 | 457 | 458 | 459 | -------------------------------------------------------------------------------- /_book/imgs/create_gitbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/create_gitbook.png -------------------------------------------------------------------------------- /_book/imgs/git_repository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/git_repository.png -------------------------------------------------------------------------------- /_book/imgs/gitbook_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/gitbook_github.png -------------------------------------------------------------------------------- /_book/imgs/github_integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/github_integration.png -------------------------------------------------------------------------------- /_book/imgs/node.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/node.js.png -------------------------------------------------------------------------------- /_book/imgs/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/settings.png -------------------------------------------------------------------------------- /_book/imgs/yl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/_book/imgs/yl.png -------------------------------------------------------------------------------- /_book/output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 图书输出 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

图书输出

422 |

本章内容讲述如何将编写好的图书输出为我们所需要的格式。目前为止,Gitbook支持如下格式输出:

423 |
    424 |
  • 静态HTML,可以看作一个静态网站
  • 425 |
  • PDF格式
  • 426 |
  • eBook格式
  • 427 |
  • 单个HTML文件
  • 428 |
  • JSON格式
  • 429 |
430 |

我们这里着重说下如何输出静态的HTML和PDF文件。

431 | 432 | 433 |
434 | 435 | 436 |
437 |
438 |
439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 |
447 |
448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 462 | 463 | 464 | 465 | 466 | 467 | -------------------------------------------------------------------------------- /_book/publish/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 发布 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

发布

422 |

本章内容讲述将之前编辑的gitbook书籍发布到线上,主要是:

423 |
    424 |
  • 将其发布到GitBook.com线上个人仓库
  • 425 |
  • 发布到github仓库,使用git管理,同时编辑时也可以同步到GitBook.com
  • 426 |
  • 发布到github pages上面
  • 427 |
428 | 429 | 430 |
431 | 432 | 433 |
434 |
435 |
436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 |
444 |
445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 459 | 460 | 461 | 462 | 463 | 464 | -------------------------------------------------------------------------------- /book/README.md: -------------------------------------------------------------------------------- 1 | 书籍编辑 2 | ==== 3 | 4 | gitbook书籍编辑有两种方法: 5 | 6 | - gitbook命令行&markdown编辑:`README.md`和`SUMMARY.md`是Gitbook项目必备的两个文件,也就是一本最简单的gitbook也必须含有这两个文件,它们在一本Gitbook中具有不同的用处; 7 | - 使用gitbook官方编辑器编辑,[下载](https://github.com/GitbookIO/editor/releases)到本地即可。 8 | -------------------------------------------------------------------------------- /book/editor.md: -------------------------------------------------------------------------------- 1 | gitbook editor编辑 2 | ==== 3 | [gitbook editor](https://github.com/GitbookIO/editor/releases) 实际上就是一个本地应用版的在线编辑器,使用方式和 [gitbook](gitbook.com)在线编辑器类似,而这里的目录及章节是使用编辑器添加生成,同时也会存放到本地之前建立的目录. -------------------------------------------------------------------------------- /book/gitbook-cli.md: -------------------------------------------------------------------------------- 1 | gitbook命令行&markdown编辑 2 | ==== 3 | ##1. 首先介绍下一本书的主要文件: 4 | ### README.md 5 | 6 | 这个文件相当于一本Gitbook的简介,最上层(和SUMMARY.md同级)的是本书的Introduction。 7 | 8 | ### SUMMARY.md() 9 | 10 | 这个文件是一本书的目录结构,使用Markdown语法, 这个文件在使用gitbook命令行之前要先写好,以便之后生成书籍目录,如我们这本书的`SUMMARY.md`: 11 | 12 | ``` 13 | * [基本安装](howtouse/README.md) 14 | - [Node.js安装](howtouse/Nodejsinstall.md) 15 | - [Gitbook安装](howtouse/gitbookinstall.md) 16 | - [Gitbook命令行速览](howtouse/gitbookcli.md) 17 | * [图书编辑](book/README.md) 18 | - [gitbook命令行&markdown编辑](book/gitbook-cli.md) 19 | - [gitbook editor编辑](book/editor.md) 20 | * [图书输出](output/README.md) 21 | - [输出为静态网站](output/outfile.md) 22 | - [输出PDF](output/pdfandebook.md) 23 | * [发布](publish/README.md) 24 | - [发布到gitbook.com](publish/gitbook.md) 25 | - [Github集成](publish/github.md) 26 | - [发布到Github Pages](publish/gitpages.md) 27 | * [结束](end/README.md) 28 | 29 | 30 | ``` 31 | 32 | 列表加链接,链接中可以使用目录,也可以不必使用。 33 | 34 | ##2. 书籍目录初始化&内容编写 35 | 36 | 当这个目录文件创建好之后,我们可以使用Gitbook的命令行工具将这个目录结构生成相应的目录及文件,步骤如下: 37 | 38 | 39 | - 打开cmd,cd命令进入创建的存书籍的目录,如:E:\gitbook\gitbook-studying; 40 | - 在这个目录下我们创建了上述的SUMMARY.md文件; 41 | - 然后使用命令gitbook init,则生成一系列目录文件,见下方; 42 | 43 | 44 | ``` 45 | $ gitbook init 46 | $ ls 47 | LICENSE SUMMARY.md book output 48 | README.md howtouse publish 49 | $ tree . 50 | . 51 | ├── LICENSE 52 | ├── README.md 53 | ├── SUMMARY.md 54 | ├── book 55 | │   ├── README.md 56 | │   ├── gitbook-cli.md 57 | │   └── editor.md 58 | ├── howtouse 59 | │   ├── Nodejsinstall.md 60 | │   ├── README.md 61 | │   ├── gitbookcli.md 62 | │   └── gitbookinstall.md 63 | ├── output 64 | │   ├── README.md 65 | │   ├── outfile.md 66 | │   └── pdfandebook.md 67 | └── publish 68 | ├── README.md 69 | ├── gitbook.md 70 | ├── github.md 71 | └── gitpages.md 72 | ``` 73 | 74 | 我们可以看到,gitbook给我们生成了与`SUMMARY.md`所对应的目录及文件。 75 | 76 | 每个目录中,都有一个`README.md`文件,相当于一章的说明。 77 | 78 | 最后,我们在对应目录中用markdown编辑器(这里推荐使用markdownpad)编辑自己想要的内容即可. 79 | -------------------------------------------------------------------------------- /end/README.md: -------------------------------------------------------------------------------- 1 | 结束 2 | ===== 3 | 4 | 以上这些是笔者在参考网上几个相关的教程,然后自己动手实践一步步写完的,gitbook使用简明的markdown语法,简洁漂亮。 5 | 6 | gitbook将这些独立的文件组合起来,做成一个静态站(可以作为网站教程之用)或是生成PDF,非常之便捷。 7 | 8 | 9 | 本书记录的内容是简单的,且某些细节没有指出,如果有出错的地方,请见谅,同时也欢迎Fork这个项目,改进该教程。 10 | 11 | **Ps:** 12 | 13 | Github项目地址: 14 | 15 | 在线阅读地址: 16 | 17 | 18 | -------------------------------------------------------------------------------- /gitbook入门教程.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/gitbook入门教程.pdf -------------------------------------------------------------------------------- /howtouse/Nodejsinstall.md: -------------------------------------------------------------------------------- 1 | Node.js安装 2 | === 3 | 4 | ![](../imgs/node.js.png) 5 | 6 | 7 | > Node.js 是一个基于Chrome JavaScript 运行时建立的一个平台, 用来方便地搭建快速的, 易于扩展的网络应用· Node.js 借助事件驱动, 非阻塞 I/O 模型变得轻量和高效, 非常适合 run across distributed devices 的 data-intensive 的实时应用· 8 | 9 | Node.js的安装,请移步这里: 10 | 11 | > [在 Windows、Mac OS X 與 Linux 中安裝 Node.js 網頁應用程式開發環境](http://www.gtwang.org/2013/12/install-node-js-in-windows-mac-os-x-linux.html) 12 | 13 | 安装完成这后,你可以在终端模式(win下打开cmd即可)下检验一下: 14 | 15 | ``` 16 | C:\Users\lenovo> node -v 17 | v0.10.28 18 | ``` 19 | 20 | 看到些提示,就表示你已成功安装上了`Node.js`。 21 | 22 | ###安装gitbook前必须先安装`node`. 23 | 24 | **Ps:本文中,运行命令几乎都在Windows cmd下,但是也有个比较好用的工具,[git bash,点击下载](http://git-scm.com/download/win)** 25 | -------------------------------------------------------------------------------- /howtouse/README.md: -------------------------------------------------------------------------------- 1 | 基本安装 2 | ==== 3 | 4 | 本章内容讲述Gitbook的安装及命令行的功能快速预览说明。 5 | -------------------------------------------------------------------------------- /howtouse/gitbookcli.md: -------------------------------------------------------------------------------- 1 | Gitbook命令行速览 2 | ==== 3 | 4 | Gitbook是一个命令行工具,使用方法(这里简单介绍): 5 | 6 | **本地预览** 7 | 8 | ``` 9 | C:\Users\lenovo> gitbook serve ./图书名称 10 | ``` 11 | 12 | **输出一个静态网站** 13 | 14 | ``` 15 | C:\Users\lenovo> gitbook build 图书目录 输出目录 16 | ``` 17 | 18 | *注意:上面win下命令运行所处在的目录必须是写好的gitbook书籍目录前一个, 19 | 可以使用cd..切换,否则建立时会出错,后面会详细讲解* 20 | 21 | **查看帮助** 22 | 23 | 24 | `C:\Users\lenovo> gitbook help` 25 | 26 | build [book] [output] build a book 27 | --format Format to build to (Default is website; Values are website, jso 28 | n, ebook) 29 | --log Minimum log level to display (Default is info; Values are debug 30 | , info, warn, error, disabled) 31 | 32 | pdf [book] [output] build a book to pdf 33 | --log Minimum log level to display (Default is info; Values are debug 34 | , info, warn, error, disabled) 35 | 36 | epub [book] [output] build a book to epub 37 | --log Minimum log level to display (Default is info; Values are debug 38 | , info, warn, error, disabled) 39 | 40 | mobi [book] [output] build a book to mobi 41 | --log Minimum log level to display (Default is info; Values are debug 42 | , info, warn, error, disabled) 43 | 44 | serve [book] Build then serve a gitbook from a directory 45 | --port Port for server to listen on (Default is 4000) 46 | --lrport Port for livereload server to listen on (Default is 35729) 47 | --watch Enable/disable file watcher (Default is true) 48 | --format Format to build to (Default is website; Values are website, jso 49 | n, ebook) 50 | --log Minimum log level to display (Default is info; Values are debug 51 | , info, warn, error, disabled) 52 | 53 | install [book] install plugins dependencies 54 | 55 | init [directory] create files and folders based on contents of SUMMARY.m 56 | d 57 | 58 | -------------------------------------------------------------------------------- /howtouse/gitbookinstall.md: -------------------------------------------------------------------------------- 1 | Gitbook安装 2 | ==== 3 | 4 | Gitbook是从NMP安装的,命令行(打开cmd,路径每个电脑不一): 5 | 6 | ``` 7 | C:\Users\lenovo> npm install gitbook-cli -g 8 | ``` 9 | 10 | 安装完之后,你可以检验下是否安装成功: 11 | 12 | ``` 13 | C:\Users\lenovo> gitbook -V 14 | 0.3.3 15 | ``` 16 | 17 | 如果你看到了与上面类似的版本信息,则表示你已成功完装上了Gitbook。 18 | 19 | ###需要注意的是:用户首先需要安装 nodejs,以便能够使用 npm 来安装 gitbook。 20 | -------------------------------------------------------------------------------- /imgs/create_gitbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/create_gitbook.png -------------------------------------------------------------------------------- /imgs/git_repository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/git_repository.png -------------------------------------------------------------------------------- /imgs/gitbook_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/gitbook_github.png -------------------------------------------------------------------------------- /imgs/github_integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/github_integration.png -------------------------------------------------------------------------------- /imgs/node.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/node.js.png -------------------------------------------------------------------------------- /imgs/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/settings.png -------------------------------------------------------------------------------- /imgs/yl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/imgs/yl.png -------------------------------------------------------------------------------- /outbook/book/editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | gitbook editor编辑 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

gitbook editor编辑

422 |

gitbook editor 实际上就是一个本地应用版的在线编辑器,使用方式和 gitbook在线编辑器类似,而这里的目录及章节是使用编辑器添加生成,同时也会存放到本地之前建立的目录.

423 | 424 | 425 |
426 | 427 | 428 |
429 |
430 |
431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 |
439 |
440 | 441 | 442 | 443 | 444 | 450 | 451 | 452 | 453 | 454 | 455 | -------------------------------------------------------------------------------- /outbook/book/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 图书编辑 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

书籍编辑

422 |

gitbook书籍编辑有两种方法:

423 |
    424 |
  • gitbook命令行&markdown编辑:README.mdSUMMARY.md是Gitbook项目必备的两个文件,也就是一本最简单的gitbook也必须含有这两个文件,它们在一本Gitbook中具有不同的用处;
  • 425 |
  • 使用gitbook官方编辑器编辑,下载到本地即可。
  • 426 |
427 | 428 | 429 |
430 | 431 | 432 |
433 |
434 |
435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 |
443 |
444 | 445 | 446 | 447 | 448 | 454 | 455 | 456 | 457 | 458 | 459 | -------------------------------------------------------------------------------- /outbook/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /outbook/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /outbook/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /outbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/250.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/250.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/250i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/250i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/400.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/400i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/400i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/700.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/700i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/700i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/900.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/merriweather/900i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/merriweather/900i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/300.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/300i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/300i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/400.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/400i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/400i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/600.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/600.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/600i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/600i.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/700.woff -------------------------------------------------------------------------------- /outbook/gitbook/fonts/opensans/700i.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/fonts/opensans/700i.woff -------------------------------------------------------------------------------- /outbook/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /outbook/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /outbook/gitbook/print.css: -------------------------------------------------------------------------------- 1 | .link-inherit{color:inherit}.link-inherit:hover,.link-inherit:focus{color:inherit}.hidden{display:none}.hljs-comment,.hljs-title{color:#8e908c}.hljs-variable,.hljs-attribute,.hljs-tag,.hljs-regexp,.ruby .hljs-constant,.xml .hljs-tag .hljs-title,.xml .hljs-pi,.xml .hljs-doctype,.html .hljs-doctype,.css .hljs-id,.css .hljs-class,.css .hljs-pseudo{color:#c82829}.hljs-number,.hljs-preprocessor,.hljs-pragma,.hljs-built_in,.hljs-literal,.hljs-params,.hljs-constant{color:#f5871f}.ruby .hljs-class .hljs-title,.css .hljs-rules .hljs-attribute{color:#eab700}.hljs-string,.hljs-value,.hljs-inheritance,.hljs-header,.ruby .hljs-symbol,.xml .hljs-cdata{color:#718c00}.css .hljs-hexcolor{color:#3e999f}.hljs-function,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword,.perl .hljs-sub,.javascript .hljs-title,.coffeescript .hljs-title{color:#4271ae}.hljs-keyword,.javascript .hljs-function{color:#8959a8}.hljs{display:block;background:white;color:#4d4d4c;padding:.5em}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:.5}.page.page-toc .glossary{margin-bottom:40px}.page.page-toc .glossary h2 a,.page.page-toc .glossary h2 a:hover{color:inherit;text-decoration:none}.page.page-toc .glossary .glossary-index{list-style:none;margin:0;padding:0}.page.page-toc .glossary .glossary-index li{display:inline;margin:0 8px;white-space:nowrap}.page .book-chapter{display:none}body .page{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;line-height:1.4;color:#333;overflow:hidden;line-height:1.6;word-wrap:break-word;display:block}body .page>*:first-child{margin-top:0!important}body .page>*:last-child{margin-bottom:0!important}body .page a{background:transparent}body .page a:active,body .page a:hover{outline:0}body .page strong{font-weight:bold}body .page h1{font-size:2em;margin:.67em 0}body .page img{border:0}body .page hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}body .page pre{overflow:auto}body .page code,body .page pre{font-family:monospace,monospace;font-size:1em}body .page table{border-collapse:collapse;border-spacing:0}body .page td,body .page th{padding:0}body .page *{-moz-box-sizing:border-box;box-sizing:border-box}body .page a{color:#4183c4;text-decoration:none}body .page a:hover,body .page a:focus,body .page a:active{text-decoration:underline}body .page hr{height:0;margin:15px 0;overflow:hidden;background:transparent;border:0;border-bottom:1px solid #ddd}body .page hr:before,body .page hr:after{display:table;content:" "}body .page hr:after{clear:both}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{margin-top:15px;margin-bottom:15px;line-height:1.1}body .page h1{font-size:30px}body .page h2{font-size:21px}body .page h3{font-size:16px}body .page h4{font-size:14px}body .page h5{font-size:12px}body .page h6{font-size:11px}body .page blockquote{margin:0}body .page ul,body .page ol{padding:0;margin-top:0;margin-bottom:0}body .page ol ol{list-style-type:lower-roman}body .page dd{margin-left:0}body .page code,body .page pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}body .page pre{margin-top:0;margin-bottom:0}body .page .markdown-body>*:first-child{margin-top:0!important}body .page .markdown-body>*:last-child{margin-bottom:0!important}body .page .anchor{position:absolute;top:0;bottom:0;left:0;display:block;padding-right:6px;padding-left:30px;margin-left:-30px}body .page .anchor:focus{outline:0}body .page h1,body .page h2,body .page h3,body .page h4,body .page h5,body .page h6{position:relative;margin-top:1em;margin-bottom:16px;font-weight:bold;line-height:1.4}body .page h1{padding-bottom:.3em;font-size:2.25em;line-height:1.2;border-bottom:1px solid #eee}body .page h2{padding-bottom:.3em;font-size:1.75em;line-height:1.225;border-bottom:1px solid #eee}body .page h3{font-size:1.5em;line-height:1.43}body .page h4{font-size:1.25em}body .page h5{font-size:1em}body .page h6{font-size:1em;color:#777}body .page p,body .page blockquote,body .page ul,body .page ol,body .page dl,body .page table,body .page pre{margin-top:0;margin-bottom:16px}body .page hr{height:4px;padding:0;margin:16px 0;background-color:#e7e7e7;border:0 none}body .page ul,body .page ol{padding-left:2em}body .page ol ol,body .page ol ul,body .page ul ul{margin-top:0;margin-bottom:0}body .page dl{padding:0}body .page dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}body .page dl dd{padding:0 16px;margin-bottom:16px}body .page blockquote{padding:0 15px;color:#777;border-left:4px solid #ddd}body .page blockquote>:first-child{margin-top:0}body .page blockquote>:last-child{margin-bottom:0}body .page table{display:block;width:100%;overflow:auto}body .page table th{font-weight:bold}body .page table th,body .page table td{padding:6px 13px;border:1px solid #ddd}body .page table tr{background-color:#fff;border-top:1px solid #ccc}body .page table tr:nth-child(2n){background-color:#f8f8f8}body .page img{max-width:100%;-moz-box-sizing:border-box;box-sizing:border-box;page-break-inside:avoid}body .page code{padding:0;padding-top:.2em;padding-bottom:.2em;margin:0;font-size:85%;background-color:#f7f7f7;border-radius:3px}body .page code:before,body .page code:after{letter-spacing:-0.2em;content:"\00a0"}body .page pre>code{padding:0;margin:0;font-size:100%;white-space:pre;background:transparent;border:0}body .page .highlight pre,body .page pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f7f7f7;border:0;border-radius:3px}body .page pre{word-wrap:normal}body .page pre code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}body .page pre code:before,body .page pre code:after{content:normal}body .page .highlight{background:#fff} -------------------------------------------------------------------------------- /outbook/howtouse/gitbookinstall.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Gitbook安装 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

Gitbook安装

422 |

Gitbook是从NMP安装的,命令行(打开cmd,路径每个电脑不一):

423 |
C:\Users\lenovo> npm install gitbook-cli -g
424 | 

安装完之后,你可以检验下是否安装成功:

425 |
C:\Users\lenovo> gitbook -V
426 | 0.3.3
427 | 

如果你看到了与上面类似的版本信息,则表示你已成功完装上了Gitbook。

428 |

需要注意的是:用户首先需要安装 nodejs,以便能够使用 npm 来安装 gitbook。

429 | 430 | 431 |
432 | 433 | 434 |
435 |
436 |
437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 |
445 |
446 | 447 | 448 | 449 | 450 | 456 | 457 | 458 | 459 | 460 | 461 | -------------------------------------------------------------------------------- /outbook/howtouse/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 基本安装 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

基本安装

422 |

本章内容讲述Gitbook的安装及命令行的功能快速预览说明。

423 | 424 | 425 |
426 | 427 | 428 |
429 |
430 |
431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 |
439 |
440 | 441 | 442 | 443 | 444 | 450 | 451 | 452 | 453 | 454 | 455 | -------------------------------------------------------------------------------- /outbook/imgs/create_gitbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/create_gitbook.png -------------------------------------------------------------------------------- /outbook/imgs/git_repository.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/git_repository.png -------------------------------------------------------------------------------- /outbook/imgs/gitbook_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/gitbook_github.png -------------------------------------------------------------------------------- /outbook/imgs/github_integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/github_integration.png -------------------------------------------------------------------------------- /outbook/imgs/node.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/node.js.png -------------------------------------------------------------------------------- /outbook/imgs/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/settings.png -------------------------------------------------------------------------------- /outbook/imgs/yl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuzeshan/gitbook-studying/acd9fdee2bbc16f420053cc56de07c3b83df0d7d/outbook/imgs/yl.png -------------------------------------------------------------------------------- /outbook/output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 图书输出 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

图书输出

422 |

本章内容讲述如何将编写好的图书输出为我们所需要的格式。目前为止,Gitbook支持如下格式输出:

423 |
    424 |
  • 静态HTML,可以看作一个静态网站
  • 425 |
  • PDF格式
  • 426 |
  • eBook格式
  • 427 |
  • 单个HTML文件
  • 428 |
  • JSON格式
  • 429 |
430 |

我们这里着重说下如何输出静态的HTML和PDF文件。

431 | 432 | 433 |
434 | 435 | 436 |
437 |
438 |
439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 |
447 |
448 | 449 | 450 | 451 | 452 | 458 | 459 | 460 | 461 | 462 | 463 | -------------------------------------------------------------------------------- /outbook/publish/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 发布 | Gitbook 入门教程 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 |
43 | 46 | 329 |
330 | 331 |
332 |
333 |
334 | 335 | 336 | 337 | 338 | 365 | 366 | 367 | 368 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 |

410 | 411 | Gitbook 入门教程 412 |

413 |
414 | 415 |
416 |
417 | 418 | 419 |
420 | 421 |

发布

422 |

本章内容讲述将之前编辑的gitbook书籍发布到线上,主要是:

423 |
    424 |
  • 将其发布到GitBook.com线上个人仓库
  • 425 |
  • 发布到github仓库,使用git管理,同时编辑时也可以同步到GitBook.com
  • 426 |
  • 发布到github pages上面
  • 427 |
428 | 429 | 430 |
431 | 432 | 433 |
434 |
435 |
436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 |
444 |
445 | 446 | 447 | 448 | 449 | 455 | 456 | 457 | 458 | 459 | 460 | -------------------------------------------------------------------------------- /output/README.md: -------------------------------------------------------------------------------- 1 | 图书输出 2 | ==== 3 | 4 | 本章内容讲述如何将编写好的图书输出为我们所需要的格式。目前为止,Gitbook支持如下格式输出: 5 | 6 | - 静态HTML,可以看作一个静态网站 7 | - PDF格式 8 | - eBook格式 9 | - 单个HTML文件 10 | - JSON格式 11 | 12 | 我们这里着重说下如何输出静态的HTML和PDF文件。 13 | -------------------------------------------------------------------------------- /output/outfile.md: -------------------------------------------------------------------------------- 1 | 输出为静态网站 2 | ==== 3 | 4 | 你有两种方式输出一个静态网站: 5 | 6 | **本地预览时自动生成** 7 | 8 | 当你在自己的电脑上编辑好图书之后,你可以使用Gitbook的命令行进行本地预览: 9 | 10 | ``` 11 | E:\gitbook\gitbook-studying>gitbook serve ./图书目录 12 | ``` 13 | 14 | 这里会启动一个端口为`4000`用于预览的服务器: 15 | 16 | ``` 17 | E:\gitbook\gitbook-studying> gitbook serve . 18 | Press CTRL+C to quit ... 19 | 20 | Starting build ... 21 | Successfuly built ! 22 | 23 | Starting server ... 24 | Serving book on http://localhost:4000 25 | ``` 26 | 27 | 你可以你的浏览器中打开这个网址:: 28 | 29 | ![](../imgs/yl.png) 30 | 31 | 这里你会发现,你在你的图书项目的目录中多了一个名为`_book`的文件目录,而这个目录中的文件,即是生成的静态网站内容。 32 | 33 | **使用build参数生成到指定目录** 34 | 35 | 与直接预览生成的静态网站文件不一样的是,使用这个命令,你可以将内容输入到你所想要的目录中去,步骤如下: 36 | 37 | 1. mkdir outbook 38 | 2. cd..,退到上一层目录,即E:\gitbook (如果不,会出错) 39 | 3. 然后,E:\gitbook>gitbook build gitbook-studying gitbook-studying/outbook 40 | 4. 则在 E:\gitbook\gitbook-studying\outbook下生成了同样的静态html文件 41 | 42 | 43 | 无论哪种方式,你都可以将这个文件打包,然后把你的书发给你的朋友们了! 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /output/pdfandebook.md: -------------------------------------------------------------------------------- 1 | 输出PDF 2 | ==== 3 | 输出pdf文件步骤如下: 4 | 5 | 1. 由于生成PDF文件依赖于`ebook-convert`,故首先在该处[ebook-convert下载链接](http://calibre-ebook.com/download)点击下载所需要的版本,安装即可; 6 | 2. 打开cmd,进入E:\gitbook目录; 7 | 3. E:\gitbook>gitbook pdf gitbook-studying gitbook-studying/gitbook入门教程.pdf 8 | 4. 则在目录E:\gitbook\gitbook-studying下生成了该pdf文件 9 | 10 | 11 | 12 | 然后,你会发现你的目录里多了一个名为`gitbook入门教程.pdf`的文件,就是它了! 13 | 14 | 但是,笔者在测试的时候发现,生成的PDF文件在排版上不是合理,如页面的边距明显过小,如果是图文混排的话,整个版面感觉有些零乱。 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /publish/README.md: -------------------------------------------------------------------------------- 1 | 发布 2 | ==== 3 | 4 | 本章内容讲述将之前编辑的gitbook书籍发布到线上,主要是: 5 | 6 | - 将其发布到[GitBook.com](gitbook.com)线上个人仓库 7 | - 发布到github仓库,使用git管理,同时编辑时也可以同步到[GitBook.com](gitbook.com)上 8 | - 发布到github pages上面 9 | -------------------------------------------------------------------------------- /publish/gitbook.md: -------------------------------------------------------------------------------- 1 | 发布到Gitbook.com 2 | == 3 | [GitBook.com](gitbook.com) 是一个围绕 gitbook 发行书籍的社区,于 2014 年初创,GitBook.com 提供免费和付费的服务,而且免费账户就可以享受诸多服务,这里,我们将编写的gitbook书籍发布到Gitbook个人账户里。 4 | 5 | 登陆 [GitBook.com](gitbook.com) 后,在用户页面,点击create a new book后,如下图所示: 6 | 7 | ![](../imgs/create_gitbook.png) 8 | 9 | 创建的书籍,title:`gitbook入门教程`,name为`gitbook-studying` 10 | 则创建后的Gitbook线上仓库地址为`https://git.gitbook.com/yuzeshan/gitbook-studying.git`(当然,也可以打开书籍settings查看) 11 | 12 | 这样,gitbook.com线上的仓库就建好了,由于GitBook.com 上的每本书都使用 Git 项目来管理,所以,事先写好的书籍就可以通过git提交上去,具体步骤如下: 13 | 14 | 1. 首先打开cmd,进入书籍目录,E:\gitbook\gitbook-studying; 15 | 2. 运行E:\gitbook\gitbook-studying>`git init`,这里如果git提示错误,则是没配置git的环境变量的path; 16 | 3. 将目录的章节文件夹一个个加进,git里,使用`git add 文件夹名`; 17 | 4. 接下来,`git commit -m "提交信息(必填,否则出错)"`; 18 | 5. 然后,将本地的git 仓库与gitbook.com上远程仓库连接,`git remote add gitbook https://git.gitbook.com/yuzeshan/gitbook-studying.git`(注意:不是github上的git remote add origin git@....); 19 | 6. 最后,将本地仓库全部push到远程,`git push -u gitbook maste`r,以后每次更改,然后add再commit,而第二次push时,直接`git push gitbook master`即可 20 | 21 | 22 | 提交到 GitBook.com 后,书籍就自动发布了,用户就可以通过书籍的地址访问了,例如: 23 | 24 | **ps:如果本地没有git初始化过得仓库,则可以将在线建立的仓库,克隆到本地,进行修改,提交,push,简洁步骤如下:** 25 | 26 | - 首先进入想要建立书籍的目录,这里是E:\gitbook\gitbook-studying; 27 | - 运行命令`git clone https://git.gitbook.com/yuzeshan/gitbook-studying.git`; 28 | - 然后,通过之前介绍的书籍编辑:gitbook init,gitbook serve 等方法,编辑好书籍后,再用git命令add commit添加提交书籍目录文件; 29 | - 最后,`git push gitbook master`即可。 30 | 31 | 32 | -------------------------------------------------------------------------------- /publish/github.md: -------------------------------------------------------------------------------- 1 | 发布到github仓库 2 | == 3 | [GitBook.com](gitbook.com) 为每本书籍都创建了一个 Git 项目,并且使用这个 Git 项目来管理书籍源码(注意:这里的源码是指所有用户提交的内容)。正如在 *编辑书籍* 中介绍的那样,我们可以通过向书籍的 Git 项目提交内容来更新书籍。 4 | 5 | 另外,GitBook.com 还可以集成 GitHub,所以用户可以将书籍的源码通过 GitHub 上的项目来管理(而且在github上编辑时也可以同步到GitBook.com上对应的仓库),这样可以使用 GitHub 带来的各种优点,例如: 6 | 7 | - 其它用户可以 fork 8 | - 用户可以点赞,获得更新提醒 9 | - 用户可以贡献自己的内容 10 | 11 | 等等 12 | 13 | 这里,接着之前的实例,将使用 GitHub 中的项目来替代 GitBook.com 上的项目:`https://git.gitbook.com/yuzeshan/gitbook-studying.git`.分为以下三大步骤: 14 | 15 | ##在Github上创建仓库,并设置 16 | - 登录Github账户,创建仓库`gitbook-studying`; 17 | - 显示如下:![](../imgs/git_repository.png) 18 | - 将建好的仓库克隆到本地,但是使用cmd的时候,发现clone被拒绝,未找到原因,于是换作[git bash](http://git-scm.com/download/win)同样使用cd进入书籍目录(E:\gitbook\gitbook-studying-github,此为新的空目录) 19 | - 运行命令:`$git clone git@github.com:yuzeshan/gitbook-studying.git`,在此目录生成了`gitbook-studying/.git`文件 20 | - `$cd gitbook-studying,此时git bash目录结构为**/e/gitbook/gitbook-studying-github/gitbook-studying** 21 | 22 | ##在Gitbook.com上为该项目设置Github集成 23 | 24 | 首先,到Gitbook.com页面,将书籍的 Git 项目设置为 GitHub 上的项目,进入书籍属性页面,找到 "GitHub" 图标,如下图: 25 | 26 | ![](../imgs/gitbook_github.png) 27 | 28 | 输入将要使用的 GitHub 上的项目,注意是公开的项目,如下图: 29 | 30 | ![](../imgs/github_integration.png) 31 | 32 | 保存后,可以看到之前不可点击的 "Add a deployment webhook" 按钮已经可以点击了,这个按钮表示:每当用户配置的 GitHub 上的项目更新时,自动更新Gitbook.com书籍! 33 | 34 | ##将本地书籍导入Github上对应仓库 35 | 36 | 现在,将书籍原来的 Git 项目内容导入到新建的 GitHub 中的项目中,步骤如下: 37 | 38 | 1. 将之前编辑的书籍目录为`E:\gitbook\gitbook-studying`中除.git文件,全部拷贝到克隆的目录中,即`E:\gitbook\gitbook-studying-github\gitbook-studyin`中; 39 | 2. 将已经编辑好的书籍文件,用git add/commit命令依次添加,提交后; 40 | 3. 接下来将书籍仓库与远程github连接到一起,运行命令:`git remote add github https://github.com//yuzeshan/gitbook-studying.git`(注意:并不是`git remote add origin https://github.com:yuzeshan/gitbook-studying.git`,也许不运行此命令也可,因为克隆的文件本身就关联了,未尝试。。。); 41 | 4. 最后,将书籍仓库push到github仓库上,运行命令:`git push -u github master`; 42 | 5. git push 命令中的 -u 表示将本地 master 分支的上游分支设置为 github/master,所以以后修改了本地 master 分支后,git push 将推送到 github 上,而非原来的 `git remote add gitbook https://git.gitbook.com/yuzeshan/gitbook-studying.git`。 43 | 44 | 经过以上步骤后,就可以在本地修改文件,直接add,commit,然后push上github仓库上即可,修改github仓库的同时,gitbook.com上对应的书籍也会同步更新. 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /publish/gitpages.md: -------------------------------------------------------------------------------- 1 | 发布到github pages 2 | ==== 3 | 4 | 将生编写好的格式为.md的文件通过Gitbook处理,然后再发布到Github Gages上去。我个人比较喜欢将源码,即`.md`文件与Github Pages静态文件存放在一个仓库中。`.md`文件为`master`分支,而hmtl文件为`gh-pages`分支。具体流程是这样的: 5 | 6 | ## 创建仓库与分支 7 | 8 | - 登录到Github,创建一个新的仓库,名称我们就命令为`book`,这样我就就得到了一个`book`的空仓库。 9 | - 克隆仓库到本地:`git clone git@github.com:USER_NAME/book.git`。 10 | - 创建一个新分支:`git checkout -b gh-pages`,注意,分支名必须为`gh-pages`。 11 | - 将分支push到仓库:`git push -u origin gh-pages`。 12 | - 切换到主分支: `git checkout master`。 13 | 14 | 经过这一步处理,我们已经创建好`gh-pages`分支了,有了这个分支,Github会自动为你分配一个访问网址: 15 | 16 | > http://USERNAME.github.io/book 17 | 18 | 你可以在项目页面右下`settings`中看到: 19 | 20 | ![](../imgs/settings.png) 21 | 22 | 当然,由于我们内容还没有上传所以你点开链接,也只是一个404页面。 23 | 24 | ## 同步静态网站代码到分支 25 | 26 | 下面我们就可以将build好的静态网站代码同步到`gh-pages`分支中去了: 27 | 28 | - 切换出master分支目录。我们需要将`gh-pages`分支内容存放到另一个目录中去。 29 | - 克隆`gh-pages`分支:`git clone -b gh-pages git@github.com:USERNAME/book.git book-end`。这步我们只克隆了`gh-pages`分支,并存放在一个新的目录`book-end`里面。 30 | - Copy静态多站代码到`book-end`目录中。 31 | - Push到仓库。 32 | 33 | 然后,等十来分钟的样子,你就可以访问到你的在线图书了。而后,每次修改之后,都可以将生成的代码Copy到`book-end`目录,再Push一下就OK了。 34 | 35 | 当然,对于`gh-pages`存放问题,你也可以直接在master分支目录中直接`git clone` gh-pages分支,假如名称为`book-end`,然后修改一下`.gitignore`文件,将`book-end/`添加进去,这样主分支就不会理会`book-end`内容的修改了。 36 | 37 | 笔者曾试过直接使用`gitbook build --output=/PATH/book-end`这个方式输出到`gh-pages`分支目录中,但发现gitbook在build的时候,相当于删除存在的这个目录,然后再新建目录,再写入内容,原来的git信息会完全删除掉,显示这不是我们想要看到的,所以只能Copy才行。 38 | --------------------------------------------------------------------------------