最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Gitbook中添加章节的编号

gitbook crifan 4812浏览 0评论

折腾:

【记录】给Gitbook添加更多配置和功能

期间,想要给Gitbook中的章节添加编号

之前通过

  • Gitbook Editor的右下角问号-》Settings

  • 菜单栏:GitBook Editor-》Preferences

打开settings,可以去设置

Show Section Number in the Table of Contents

显示章节中的编号:

但是为何章节编号之前都加了个1,是1.1,1.2,而不是1,2?

后来才知道,这个只是Editor中的显示问题,生成的html页面中并没有。

后来看到:

https://gitbook.zhangjikai.com/plugins.html#local-video

大概明白了:

默认只有一个Section=一章=1开头

如果后续加了多个section,则后续section才是2.x,3.x

但是其实自己希望是:

每个一级的章节,也想要添加编号的的,比如上面的:

1.基本使用

2.扩展

后记2:

其实是:

如何为目录添加序号 · GitBook学习笔记

添加参数配置:

<code>"theme-default": {
    "showLevel": true
},
</code>

【整理】Gitbook中的book.json参数配置

【总结】

去给book.json中的pluginsConfig字段添加theme-default的配置,设置showLevel为true即可:

<code>  "pluginsConfig": {
    "theme-default": {
        "showLevel": true
    }
  }
</code>

效果:

转载请注明:在路上 » 【已解决】Gitbook中添加章节的编号

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.182 seconds, using 23.41MB memory