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

【未解决】Gitbook中实现多章节中一级章节目录显示一级编号

gitbook crifan 2305浏览 0评论

之前折腾过:

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

但是没有解决:

第一级的章节的编号,是:

1,2,3

而不是

1.1,1.2,1.3

gitbook chapter number

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

Pages and Summary · GitBook Toolchain Documentation

gitbook-plugin-chapter-headings – npm

toc – Numbering table of contents for Gitbook – Stack Overflow

gitbook 一级章节 编号

Markdown | GitBook 中文解說 – 2.4

Gitbook 的使用和常用插件 | 赵达的个人网站 – Zhao Da’s Personal Website

GitBook 进阶 — notes 0.0.1 文档

再去看看:multipart

gitbook multipart

gitbook-plugin-multipart – npm

之前自己试过:

【已解决】gitbook中安装multipart插件 – 在路上

现在再去试试

book.json

<code>"plugins": [
  "multipart"
],
</code>

安装:

<code>gitbook install
info: installing 18 plugins using npm@3.9.2
info:
info: installing plugin "theme-comscore"
info: install plugin "theme-comscore" (*) from NPM with version 0.0.3
info: &gt;&gt; plugin "theme-comscore" installed with success
info:
info: installing plugin "anchors"
info: install plugin "anchors" (*) from NPM with version 0.7.1
info: &gt;&gt; plugin "anchors" installed with success
info:
info: installing plugin "search-plus"
info: install plugin "search-plus" (*) from NPM with version 1.0.3
info: &gt;&gt; plugin "search-plus" installed with success
info:
info: installing plugin "disqus"
info: install plugin "disqus" (*) from NPM with version 0.1.0
info: &gt;&gt; plugin "disqus" installed with success
info:
info: installing plugin "prism"
info: install plugin "prism" (*) from NPM with version 2.3.0
info: &gt;&gt; plugin "prism" installed with success
info:
info: installing plugin "prism-themes"
info: install plugin "prism-themes" (*) from NPM with version 0.0.2
info: &gt;&gt; plugin "prism-themes" installed with success
info:
info: installing plugin "github-buttons"
info: install plugin "github-buttons" (*) from NPM with version 3.0.0
info: &gt;&gt; plugin "github-buttons" installed with success
info:
info: installing plugin "splitter"
info: install plugin "splitter" (*) from NPM with version 0.0.8
info: &gt;&gt; plugin "splitter" installed with success
info:
info: installing plugin "sharing-plus"
info: install plugin "sharing-plus" (*) from NPM with version 0.0.2
info: &gt;&gt; plugin "sharing-plus" installed with success
info:
info: installing plugin "tbfed-pagefooter"
info: install plugin "tbfed-pagefooter" (*) from NPM with version 0.0.1
info: &gt;&gt; plugin "tbfed-pagefooter" installed with success
info:
info: installing plugin "expandable-chapters-small"
info: install plugin "expandable-chapters-small" (*) from NPM with version 0.1.7
info: &gt;&gt; plugin "expandable-chapters-small" installed with success
info:
info: installing plugin "ga"
info: install plugin "ga" (*) from NPM with version 1.0.1
info: &gt;&gt; plugin "ga" installed with success
info:
info: installing plugin "donate"
info: install plugin "donate" (*) from NPM with version 1.0.2
info: &gt;&gt; plugin "donate" installed with success
info:
info: installing plugin "sitemap-general"
info: install plugin "sitemap-general" (*) from NPM with version 0.1.1
info: &gt;&gt; plugin "sitemap-general" installed with success
info:
info: installing plugin "copy-code-button"
info: install plugin "copy-code-button" (*) from NPM with version 0.0.2
info: &gt;&gt; plugin "copy-code-button" installed with success
info:
info: installing plugin "callouts"
info: install plugin "callouts" (*) from NPM with version 0.1.1
info: &gt;&gt; plugin "callouts" installed with success
info:
info: installing plugin "toolbar-button"
info: install plugin "toolbar-button" (*) from NPM with version 0.0.1
info: &gt;&gt; plugin "toolbar-button" installed with success
info:
info: installing plugin "multipart"
info: install plugin "multipart" (*) from NPM with version 0.3.0
/Users/crifan/GitBook/Library/Import/http_restful_api
├── gitbook-plugin-alerts@0.2.0
├── gitbook-plugin-anchors@0.7.1
├── gitbook-plugin-callouts@0.1.1
├── gitbook-plugin-copy-code-button@0.0.2
├── gitbook-plugin-disqus@0.1.0
├── gitbook-plugin-donate@1.0.2
├── gitbook-plugin-expandable-chapters-small@0.1.7
├── gitbook-plugin-ga@1.0.1
├── gitbook-plugin-github-buttons@3.0.0
├─┬ gitbook-plugin-multipart@0.3.0
│ └─┬ cheerio@0.17.0
│   ├─┬ CSSselect@0.4.1
│   │ ├── CSSwhat@0.4.7
│   │ └── domutils@1.4.3
│   ├─┬ dom-serializer@0.0.1
│   │ └── domelementtype@1.1.3
│   ├─┬ htmlparser2@3.7.3
│   │ ├── domhandler@2.2.1
│   │ ├── entities@1.0.0
│   │ └─┬ readable-stream@1.1.14
│   │   ├── isarray@0.0.1
│   │   └── string_decoder@0.10.31
│   └── lodash@2.4.2
├── gitbook-plugin-prism@2.3.0
├── gitbook-plugin-prism-themes@0.0.2
├── gitbook-plugin-search-plus@1.0.3
├── gitbook-plugin-sharing-plus@0.0.2
├── gitbook-plugin-sitemap-general@0.1.1
├── gitbook-plugin-splitter@0.0.8
├── gitbook-plugin-tbfed-pagefooter@0.0.1
├── gitbook-plugin-theme-comscore@0.0.3
└── gitbook-plugin-toolbar-button@0.0.1

info: &gt;&gt; plugin "multipart" installed with success
Has installed all gitbook plugins
</code>

还是旧的编号:

换成:

https://www.npmjs.com/package/gitbook-plugin-multipart

https://github.com/citizenmatt/gitbook-plugin-multipart

中的其他写法试试

还是不行。

gitbook chapter first level numbering

Every chapter starts with 1 · Issue #1853 · GitbookIO/gitbook

遇到和我一样的问题,但是官网没人修复。

3 pre.14: All items start with level 1.x · Issue #1301 · GitbookIO/gitbook

从2016年就有这个问题了。

结果最新情况是:

Gitbook出了新版,没这个问题了,但是新版只有在线,没有离线的。

而旧版本这个问题,没人去理会了。

Number Single Level books as multiple levels. · cycomachead/gitbook@a536473

Number Single Level books as multiple levels. by cycomachead · Pull Request #1302 · GitbookIO/gitbook

Number Single Level books as multiple levels. · cycomachead/gitbook@d669453

Chapter enumeration broken (showLevel in theme-default) · Issue #1370 · GitbookIO/gitbook

去想办法看看能不能手动修改gitbook的js源码,去修复这个问题。

先要去找到gitbook的js源码在哪里,再去改:

lib/models/summary.js

lib/models/summaryArticle.js

lib/models/summaryPart.js

<code>➜  backup_restore which gitbook
/Users/crifan/.nvm/versions/node/v10.4.0/bin/gitbook
</code>

然后去看gitbook,发现是替身,估计是软链接:

所以再去看看:

<code>➜  backup_restore ll -lha /Users/crifan/.nvm/versions/node/v10.4.0/bin/gitbook
lrwxr-xr-x  1 crifan  staff    46B  6 12 09:19 /Users/crifan/.nvm/versions/node/v10.4.0/bin/gitbook -&gt; ../lib/node_modules/gitbook-cli/bin/gitbook.js
</code>

-》

-〉然后就知道:

lib/models/summary.js

lib/models/summaryArticle.js

lib/models/summaryPart.js

是:以为能找到,实际上找不到。

-》

去用VSCode去搜看看

summaryPart

也没搜到。

还是放弃,不继续深究了。有空再说。

转载请注明:在路上 » 【未解决】Gitbook中实现多章节中一级章节目录显示一级编号

发表我的评论
取消评论

表情

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

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