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

【部分解决】Gitbook中添加多章节且希望一级章节也显示编号

gitbook crifan 4336浏览 0评论

折腾:

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

奇迹,已经新建了book.json,也已经:

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

现在希望:

添加多章节,把之前的内容,整理成多个章节的内容。

最好每个章节,最顶级,一级,也带编号

看到别人提到,好像是需要:

book拆分为多个部分part

参考:

目录结构 · GitBook 使用教程

试试多个PART的做法。

后记:

可以参考:

Pages and Summary · GitBook Toolchain Documentation

如何制作多级目录 · GitBook学习笔记

# Summary

### Part I

* [Introduction](README.md)

* [Writing is nice](part1/writing.md)

* [GitBook is nice](part1/gitbook.md)

### Part II

* [We love feedback](part2/feedback_please.md)

* [Better tools for authors](part2/better_tools.md)

<span style="font-size: 12px; background-color: rgb(251, 250, 248); color: rgb(51, 51, 51); font-family: Monaco;"–<–

* [Last part without title](part3/title.md)

gitbook multiple chapter

citizenmatt/gitbook-plugin-multipart: GitBook plugin to split book into multple parts instead of huge list of chapters

貌似起到我要的反的效果了?

Directory structure · GitBook Toolchain Documentation

Pages and Summary · GitBook Toolchain Documentation

Chapters and Subchapters | GitBook.com Documentation

【总结】

然后用如下代码,实现了分多个章节,且第一级章节都可以显示章节编号:

# HTTP知识总结

* [前言](README.md)

<!– ### HTTP简介 –>

* [HTTP简介](http_intro/README.md)

  * [HTTP学习目的](http_intro/ch1_http_learn_purpose.md)

  * [HTTP简介](http_intro/ch2_http_intro.md)

  * [HTTP内部流程](http_intro/ch3_http_internal_process.md)

  * [HTTP基本逻辑总结](http_intro/ch4_http_basic_logic.md)

<!– ### HTTP详解 –>

* [HTTP详解](http_detail/README.md)

  * [HTTP的典型结构](http_detail/ch1_http_structure.md)

  * [HTTP的Header头](http_detail/ch2_http_header.md)

  * [HTTP的请求参数和编码](http_detail/ch3_http_req_param_encode.md)

  * [HTTP的响应的状态码](http_detail/ch4_http_resp_status_code.md)

  * [HTTP的响应数据格式JSON](http_detail/ch5_http_resp_data_format_json.md)

<!– ### HTTP相关 –>

* [HTTP相关](http_related/README.md)

  * [HTTP的工具和库](http_related/ch1_http_tool_lib.md)

  * [HTTP的后台API设计](http_related/ch2_http_api_design.md)

  * [HTTP相关心得](http_related/ch3_http_note_summary.md)

<!– ### 附录 –>

* [参考资料](reference.md)

效果是:

然后再去换用:

# HTTP知识总结

### 前言

* [前言](README.md)

### HTTP简介

* [HTTP简介](http_intro/README.md)

* [HTTP学习目的](http_intro/ch1_http_learn_purpose.md)

* [HTTP简介](http_intro/ch2_http_intro.md)

* [HTTP内部流程](http_intro/ch3_http_internal_process.md)

* [HTTP基本逻辑总结](http_intro/ch4_http_basic_logic.md)

### HTTP详解

* [HTTP详解](http_detail/README.md)

* [HTTP的典型结构](http_detail/ch1_http_structure.md)

* [HTTP的Header头](http_detail/ch2_http_header.md)

* [HTTP的请求参数和编码](http_detail/ch3_http_req_param_encode.md)

* [HTTP的响应的状态码](http_detail/ch4_http_resp_status_code.md)

* [HTTP的响应数据格式JSON](http_detail/ch5_http_resp_data_format_json.md)

### HTTP相关

* [HTTP相关](http_related/README.md)

* [HTTP的工具和库](http_related/ch1_http_tool_lib.md)

* [HTTP的后台API设计](http_related/ch2_http_api_design.md)

* [HTTP相关心得](http_related/ch3_http_note_summary.md)

### 附录

* [参考资料](reference.md)

效果是:

但是发现个问题:

比如2.1的HTTP简介,其实是希望是

2 HTTP简介,作为第二章的介绍的

但是用,看起来和别人一样的配置:

# Summary

<!– ## 前言 –>

* [前言](README.md)

<!– ## HTTP简介 –>

* [HTTP简介](http_intro/README.md)

  * [HTTP学习目的](http_intro/ch1_http_learn_purpose.md)

  * [HTTP简介](http_intro/ch2_http_intro.md)

  * [HTTP内部流程](http_intro/ch3_http_internal_process.md)

  * [HTTP基本逻辑总结](http_intro/ch4_http_basic_logic.md)

<!– ## HTTP详解 –>

* [HTTP详解](http_detail/README.md)

  * [HTTP的典型结构](http_detail/ch1_http_structure.md)

  * [HTTP的Header头](http_detail/ch2_http_header.md)

  * [HTTP的请求参数和编码](http_detail/ch3_http_req_param_encode.md)

  * [HTTP的响应的状态码](http_detail/ch4_http_resp_status_code.md)

  * [HTTP的响应数据格式JSON](http_detail/ch5_http_resp_data_format_json.md)

<!– ## HTTP相关 –>

* [HTTP相关](http_related/README.md)

  * [HTTP的工具和库](http_related/ch1_http_tool_lib.md)

  * [HTTP的后台API设计](http_related/ch2_http_api_design.md)

  * [HTTP相关心得](http_related/ch3_http_note_summary.md)

<!– ## 附录 –>

* [参考资料](reference.md)

结果却还是带1.1 2.1之类的编号:

而不是别人的 1 2 3 4

配置改为:

  “pluginsConfig”: {

    “theme-default”: {

        “showLevel”: false

    }

  }

结果:

又没有编号了:

gitbook summary index number

Don’t set main README.md file as ‘introduction’ on the index · Issue #476 · GitbookIO/gitbook

Set starting number on Summary · Issue #915 · GitbookIO/gitbook

GitBook使用 – Wiki | Tsong khapa

用:

# HTTP知识总结

* [前言](README.md)

* [HTTP简介](http_intro/README.md)

  * [HTTP学习目的](http_intro/ch1_http_learn_purpose.md)

  * [HTTP简介](http_intro/ch2_http_intro.md)

  * [HTTP内部流程](http_intro/ch3_http_internal_process.md)

  * [HTTP基本逻辑总结](http_intro/ch4_http_basic_logic.md)

* [HTTP详解](http_detail/README.md)

  * [HTTP的典型结构](http_detail/ch1_http_structure.md)

  * [HTTP的Header头](http_detail/ch2_http_header.md)

  * [HTTP的请求参数和编码](http_detail/ch3_http_req_param_encode.md)

  * [HTTP的响应的状态码](http_detail/ch4_http_resp_status_code.md)

  * [HTTP的响应数据格式JSON](http_detail/ch5_http_resp_data_format_json.md)

* [HTTP相关](http_related/README.md)

  * [HTTP的工具和库](http_related/ch1_http_tool_lib.md)

  * [HTTP的后台API设计](http_related/ch2_http_api_design.md)

  * [HTTP相关心得](http_related/ch3_http_note_summary.md)

* [参考资料](reference.md)

效果是:

都是1开始的。

gitbook 章节编号

在gitbook中实现多级导航栏的支持 | Sky’s Blog

编辑书籍 | GitBook 简明教程

multipart | GitBook 简明教程

-》

gitbook-plugin-multipart

好像是插件实现这个效果的。

【已解决】gitbook中安装multipart插件

gitbook 章节编号 取消 1.1 2.1

gitbook 多级目录编号

如何制作多级目录 · GitBook学习笔记

(1)gitbook如何可以创建多级目录? – techstay的回答 – SegmentFault

GitBook寫作 · GIT教學

章節 | GitBook 中文解說 – 2.4

总之:

我这里是设置了希望的格式,但是编号还是不正常,还是:

1.1

1.2

1.3

而不是

1

2

3

gitbook article index number

gitbook chapter number

Please offer an option to disable chapter auto-numbering in summary pane · Issue #1210 · GitbookIO/gitbook

unnumbered items in the table of contents? · Issue #810 · GitbookIO/gitbook

Group chapters into “parts” or “books” · Issue #306 · GitbookIO/gitbook

numbered-headings | GitBook Plugins

去试试numbered-headings

book.json中配置:

  “plugins”: [

    “-search”,

    “multipart”,

    “numbered-headings”

  ],

安装:

Error: Couldn’t locate plugins “numbered-headings”, Run ‘gitbook install’ to install plugins from registry.

➜  htttp_summary git:(master) ✗ gitbook install

info: installing 2 plugins using npm@3.9.2

info:

info: installing plugin “multipart”

info: install plugin “multipart” (*) from NPM with version 0.3.0

info: >> plugin “multipart” installed with success

info:

info: installing plugin “numbered-headings”

info: install plugin “numbered-headings” (*) from NPM with version 1.1.1

/Users/crifan/GitBook/Library/Import/htttp_summary

├── gitbook-plugin-multipart@0.3.0

└── gitbook-plugin-numbered-headings@1.1.1

info: >> plugin “numbered-headings” installed with success

Gitbook TOC Numbering discrepancy – Stack Overflow

【总结】

最终,目前还是没办法去掉最开始的1.的章节的编号的前缀,只能是:

1.1

1.2

1.3

去用了

代码:

# HTTP知识总结

<!– ## 前言 –>

* [前言](README.md)

<!– ## PART I –>

* [HTTP简介](http_intro/README.md)

  * [HTTP学习目的](http_intro/ch1_http_learn_purpose.md)

  * [HTTP简介](http_intro/ch2_http_intro.md)

  * [HTTP内部流程](http_intro/ch3_http_internal_process.md)

  * [HTTP基本逻辑总结](http_intro/ch4_http_basic_logic.md)

<!– ## PART II –>

* [HTTP详解](http_detail/README.md)

  * [HTTP的典型结构](http_detail/ch1_http_structure.md)

  * [HTTP的Header头](http_detail/ch2_http_header.md)

  * [HTTP的请求参数和编码](http_detail/ch3_http_req_param_encode.md)

  * [HTTP的响应的状态码](http_detail/ch4_http_resp_status_code.md)

  * [HTTP的响应数据格式JSON](http_detail/ch5_http_resp_data_format_json.md)

<!– ## HTTP相关 –>

* [HTTP相关](http_related/README.md)

  * [HTTP的工具和库](http_related/ch1_http_tool_lib.md)

  * [HTTP的后台API设计](http_related/ch2_http_api_design.md)

  * [HTTP相关心得](http_related/ch3_http_note_summary.md)

<!– ## 附录 –>

* [参考资料](reference.md)

效果:

转载请注明:在路上 » 【部分解决】Gitbook中添加多章节且希望一级章节也显示编号

发表我的评论
取消评论

表情

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
99 queries in 0.183 seconds, using 23.37MB memory