折腾:
期间,需要先去给Gitbook创建合适的book.json,加上必要的基本的配置。
然后再去添加其他配置参数。
关于book.json的配置,可以参考别人的:
同时再去找找官网的介绍
gitbook book.json
Configuration · GitBook Toolchain Documentation
Configuration · GitBook Toolchain Documentation
Configuration | GitBook.com Documentation
再去看看自己当前的gitbook的版本号:
➜ htttp_summary git:(master) gitbook –version
CLI version: 2.3.2
GitBook version: 3.2.3
关于语言language,参考:
List of ISO 639-1 codes – Wikipedia
应该是zh表示中文
然后去创建一个基本的book.json:
{
“title”: “HTTP知识总结”,
“description”: “总结HTTP方面的技术供参考和学习”,
“author”: “Crifan Li <admin@crifan.org>”,
“language”: “zh”,
“gitbook”: “3.2.3”,
“root”: “.”,
“links”: {
“sidebar”: {
“主页”: “https://www.crifan.org”;
}
},
“plugins”: [
“-search”
]
}
效果是:

去掉了search
添加了主页
zh的language,使得github的文字变成繁体了。
所以参考:
https://gitbook.zhangjikai.com/bookjson.html
去改为:
“language”: “zh-hans”,
结果就变成简体中文了:

【总结】
参考官网和其他资料,目前添加了book.json:
{
“title”: “HTTP知识总结”,
“description”: “总结HTTP方面的技术供参考和学习”,
“author”: “Crifan Li <admin@crifan.org>”,
“language”: “zh-hans”,
“gitbook”: “3.2.3”,
“root”: “.”,
“links”: {
“sidebar”: {
“主页”: “https://www.crifan.org”;,
“Github源码”: “https://github.com/crifan/http_summary”;
}
},
“plugins”: [
“-search”
]
}
然后去:
gitbook serve
后的本地效果是:

注:
后续供参考的book.json中的配置有:
官网的:
Configuration | GitBook.com Documentation
Configuration · GitBook Toolchain Documentation
【后记】
后来折腾后,一个比较完整的book.json的内容为:
<code>{
  "title": "HTTP知识总结",
  "description": "总结HTTP方面的技术供参考和学习",
  "author": "Crifan Li <admin@crifan.org>",
  "language": "zh-hans",
  "gitbook": "3.2.3",
  "root": "./src",
  "links": {
    "sidebar": {
      "主页": "https://www.crifan.org"
    }
  },
  "plugins": [
    "theme-comscore",
    "-lunr",
    "-search",
    "search-plus",
    "disqus",
    "-highlight",
    "prism",
    "prism-themes",
    "github-buttons",
    "splitter",
    "-sharing",
    "sharing-plus",
    "tbfed-pagefooter",
    "expandable-chapters-small",
    "ga",
    "donate",
    "sitemap-general",
    "copy-code-button",
    "alerts",
    "toolbar-button"
  ],
  "pluginsConfig": {
    "theme-default": {
        "showLevel": true
    },
    "disqus": {
      "shortName": "crifan"
    },
    "prism": {
      "css": [
        "prism-themes/themes/prism-atom-dark.css"
      ]
    },
    "github-buttons": {
      "buttons": [
        {
          "user": "crifan",
          "repo": "http_summary",
          "type": "star",
          "count": true,
          "size": "small"
        }, {
          "user": "crifan",
          "type": "follow",
          "width": "120",
          "count": false,
          "size": "small"
        }
      ]
    },
    "sharing": {
      "douban": false,
      "facebook": true,
      "google": false,
      "hatenaBookmark": false,
      "instapaper": false,
      "line": false,
      "linkedin": false,
      "messenger": false,
      "pocket": false,
      "qq": true,
      "qzone": false,
      "stumbleupon": false,
      "twitter": true,
      "viber": false,
      "vk": false,
      "weibo": true,
      "whatsapp": false,
      "all": [
        "douban",
        "facebook",
        "google",
        "instapaper",
        "line",
        "linkedin",
        "messenger",
        "pocket",
        "qq",
        "qzone",
        "stumbleupon",
        "twitter",
        "viber",
        "vk",
        "weibo",
        "whatsapp"
      ]
    },
    "tbfed-pagefooter": {
      "copyright": "crifan.org,使用<a href='https://creativecommons.org/licenses/by-sa/4.0/deed.zh'>知识署名-相同方式共享4.0协议</a>发布",
      "modify_label": "该文件修订时间:",
      "modify_format": "YYYY-MM-DD HH:mm:ss"
    },
    "ga": {
      "token": "UA-28297199-1"
    },
    "donate": {
      "wechat": "https://www.crifan.org/files/res/crifan_com/crifan_wechat_pay.jpg",
      "alipay": "https://www.crifan.org/files/res/crifan_com/crifan_alipay_pay.jpg",
      "title": "",
      "button": "打赏",
      "alipayText": "支付宝打赏给Crifan",
      "wechatText": "微信打赏给Crifan"
    },
    "sitemap-general": {
      "prefix": "https://book.crifan.org/gitbook/http_summary/website/"
    },
    "toolbar-button": {
      "icon": "fa-file-pdf-o",
      "label": "下载PDF",
      "url": "http://book.crifan.org/books/http_summary/pdf/http_summary.pdf"
    }
  }
}
</code>更新更完整的代码可参考:
https://github.com/crifan/http_summary/blob/master/book.json
转载请注明:在路上 » 【整理】Gitbook中的book.json参数配置