gitbook的book.json配置示例

作者: xahy 分类: 笔记 发布时间: 2019-08-05 17:10

个人感觉自己的配置还是蛮清爽的,

没有很多无太多用途的插件。

关于更加详细的book.json 文件配置可参考 思伟博客 的配置示例:https://zhousiwei.gitee.io/mybook/notes/gitbook_config.html,

而且他的博客中给出的示例解释非常全面。

新增 or 修改了 gitbook 插件,

记得运行 gitbook install 重新安装插件。

 

简单说下我文档中用到的插件:

  • -lunr、-search 、-sharing 是屏蔽的官方默认的加载的插件;
  • pageview-count 是页面访问量统计插件
  • baidu 是百度统计插件,插件有bug需要调整,后面会给出调整方案,以及如何添加友盟统计
  • highlight 语法高亮插件
  • favicon 自定义 favicon logo 插件
  • search-plus 支持中文搜索的gitbook插件,默认搜索插件不支持中文搜索
  • splitter gitbook调整左侧目录宽度的插件
  • sharing-plus gitbook分享插件,默认的分享插件不包含qq、qq空间、新浪微博等分享功能
  • expandable-chapters 收起或展开章节目录中的父节点
  • back-to-top-button gitbook返回顶部插件,兼容性比较好的一个插件,比主题自带的返回顶部要好很多
  • book-summary-scroll-position-saver 自动保存左侧目录区域导航条的位置
  • donate gitbook打赏插件,能不能喝杯咖啡就看ta了
  • anchors 就是美观点,没有实际用途;标题带有 github 样式的锚点
  • anchor-navigation-ex 锚点插件导航
  • sitemap-general 生成 sitemap 文件
  • multipart 将书籍分成几个部分

 

下面贴出代码:

{
  "title": "xahy的个人学习笔记",
  "author": "xahy",
  "description": "本手册记录学习 Nginx、Swoole、Redis 和 MySQL 等相关知识的记录;将会根据学习进度不定时更新!",
  "language": "zh-hans",
  "gitbook": "3.2.3",
  "root": ".",
  "links": {
    "sidebar": {
      "优质IT学习资源分享平台": "https://798ziyuan.com"
    }
  },
  "plugins": [
    "-lunr",
    "-search",
    "-sharing",

    "pageview-count",
    "baidu",
    "highlight",
    "favicon",
    "search-plus",
    "splitter",
    "sharing-plus",
    "expandable-chapters",
    "back-to-top-button",
    "book-summary-scroll-position-saver",
    "donate",
    "anchors",
    "anchor-navigation-ex",
    "sitemap-general",
    "multipart"
  ],
  "pluginsConfig": {
    "expandable-chapters":{},
    "baidu": {
      "token": "9cbe03c0c014a4e621e9f74e3ab9823e"
    },
    "sitemap-general": {
      "prefix": "https://doc.798ziyuan.com/"
    },
    "theme-default": {
      "showLevel": true
    },
    "search-pro": {
      "cutWordLib": "nodejieba",
      "defineWord" : ["Gitbook Use"]
    },
    "fontSettings": {
      "family": "serif",
      "size": 2
    },
    "sharing": {
      "qq": true,
      "qzone": true,
      "weibo": true,
      "all": [
        "qq", "qzone", "weibo",
        "google", "facebook", "douban",
        "whatsapp"
      ]
    },
    "donate": {
      "wechat": "/assets/weixin.png",
      "alipay": "/assets/alipay.png",
      "title": "能喝咖啡吗?",
      "button": "赞助"
    },
    "anchor-navigation-ex": {
      "showLevel": true,
      "associatedWithSummary": false,
      "printLog": false,
      "multipleH1": true,
      "mode": "float",
      "showGoTop": false,
      "float": {
        "floatIcon": "fa fa-navicon",
        "showLevelIcon": false,
        "level1Icon": "fa fa-hand-o-right",
        "level2Icon": "fa fa-hand-o-right",
        "level3Icon": "fa fa-hand-o-right"
      },
      "pageTop": {
        "showLevelIcon": false,
        "level1Icon": "fa fa-hand-o-right",
        "level2Icon": "fa fa-hand-o-right",
        "level3Icon": "fa fa-hand-o-right"
      }
    },
    "favicon": {
      "shortcut": "assets/images/favicon/favicon.ico",
      "bookmark": "assets/images/favicon/favicon.ico",
      "appleTouch": "assets/images/favicon/apple-touch-icon.png",
      "appleTouchMore": {
        "120x120": "assets/images/favicon/apple-touch-icon-120x120.png",
        "180x180": "assets/images/favicon/apple-touch-icon-180x180.png"
      }
    }
  }
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注