Gitbook安装配置

 

安装和配置Gitbook

安装node.js

省略…

安装Gitbook

安装

npm install -g gitbook-cli

检验

gitbook -V

使用Gitbook

配置

创建book.js文件

{
  "plugins": [
    "intopic-toc",
    "prism",
    "-highlight",
    "copy-code-button",
    "latex-codecogs"
  ],
  "pluginsConfig": {
    "tbfed-pagefooter": {
      "copyright": "...",
      "modify_label": "该文件修订时间:",
      "modify_format": "YYYY-MM-DD HH:mm:ss"
    },
    "prism": {
      "css": [
        "prismjs/themes/prism-solarizedlight.css"
      ],
      "lang": {
        "flow": [
          "go",
          "c",
          "html",
          "css",
          "java",
          "javascript"
        ]
      }
    },
    "sectionx": {
      "tag": [
        "b",
        "h1",
        "h2",
        "h3",
        "h4",
        "h5",
        "h6"
      ]
    },
    "intopic-toc": {
      "selector": ".markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6",
      "mode": "nested",
      "maxDepth": 2,
      "isCollapsed": false,
      "isScrollspyActive": true,
      "visible": true,
      "label": {
        "de": "In diesem Artikel",
        "en": "In this article"
      }
    }
  },
  "description": "...",
  "author": "...",
  "language": "zh-hans"
}

初始化文件

gitbook init

README.md(书籍的介绍在这个文件里)

SUMMARY.md(书籍的目录结构在这里配置)

编写

……开始记录

安装

gitbook install

构建

gitbook build

启动

gitbook serve

查看

http://localhost:4000

目录结构

一个基本的 GitBook 电子书结构通常如下:

.
├── book.json
├── README.md
├── SUMMARY.md
├── chapter-1/
|   ├── README.md
|   └── something.md
└── chapter-2/
    ├── README.md
    └── something.md

参考文章

GitBook相关配置及优化

使用 Gitbook 打造你的电子书