├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── assets
├── lib
│ ├── config.js
│ ├── log.js
│ └── plugin.js
└── style
│ └── plugin.css
├── doc
├── README_EN.md
├── config-en.md
├── config.md
├── effectScreenshot.md
├── images
│ ├── night默认参数效果.png
│ ├── pageTop展示.png
│ ├── printlog.png
│ ├── sepia默认参数效果.png
│ ├── toc标题icon展示.jpg
│ ├── toc标题icon展示2.jpg
│ ├── white默认参数效果.png
│ ├── 层级关联显示.png
│ ├── 标题重新与默认主题层级相关联.jpg
│ └── 锚点效果和top展示.jpg
├── updateRecord-en.md
└── updateRecord.md
├── index.js
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Node rules:
2 | ## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
3 | .grunt
4 |
5 | ## Dependency directory
6 | ## Commenting this out is preferred by some people, see
7 | ## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git
8 | node_modules
9 |
10 | # Book build output
11 | _book
12 |
13 | # eBook build output
14 | *.epub
15 | *.mobi
16 | *.pdf
17 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .git*
2 | .DS_Store
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # gitbook-plugin-anchor-navigation-ex
2 |
3 | [](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues) [](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues?q=is%3Aissue+is%3Aclosed) [](https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/master/LICENSE) [](https://www.npmjs.com/package/gitbook-plugin-anchor-navigation-ex) [](https://www.npmjs.com/package/gitbook-plugin-anchor-navigation-ex)
4 |
5 |
6 |
7 | =============== 【DOC:中文,[English](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/README_EN.md) 】================
8 |
9 | =============== 【UpdateRecord:[中文](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/updateRecord.md),[English](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/updateRecord-en.md)】================
10 |
11 | -----
12 |
13 | :exclamation: 该项目停更,转向使用 vuepress 构建笔记了
14 |
15 | -----
16 |
17 | :exclamation: 插件配置不兼容V1.x 以下版本
18 |
19 | # 插件功能
20 | - [x] 给页面H1-H6标题增加锚点效果
21 | - [x] 浮动导航模式
22 | - [x] 页面内顶部导航模式
23 | - [x] 导航标题前的层级图标是否显示,自定义H1-H3的层级图标
24 | - [x] plugins["theme-default"],页面标题层级与官方默认主题的`showLevel`层级关联
25 | - [x] plugins["theme-default"],插件样式支持官网默认主题的三种样式:White、Sepia、Night
26 | - [x] 在页面中增加``标签,会在此处生成TOC目录
27 | - [x] 在页面中增加``标签,不会在该页面生成悬浮导航
28 | - [x] config.printLog=true,打印当前的处理进度,排错很有用
29 | - [x] config.multipleH1=false,去掉丑陋的多余的1. 序号(如过您的书籍遵循一个MD文件只有一个H1标签的话)
30 | - [x] config.showGoTop=true,显示返回顶部按钮 V1.0.11+
31 | - [x] config.float.floatIcon 可以配置浮动导航的悬浮图标样式 V1.0.12+
32 | - [x] 在页面中增加``不会在该页面生成层级序号 V1.0.12+
33 |
34 | # 插件效果
35 | * 风格:极简
36 | * [点击查看效果图](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/effectScreenshot.md)
37 |
38 |
39 | # 怎么使用插件?
40 |
41 | 在你的 `book.json` 中增加插件:
42 |
43 | ```
44 | {
45 | "plugins": [
46 | "anchor-navigation-ex"
47 | ]
48 | }
49 | ```
50 | 然后安装插件:
51 |
52 | ```
53 | $ gitbook install ./
54 | ```
55 |
56 | 就可以使用了,插件详细配置,[请点击这里查看](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/config.md)
57 |
58 |
59 | 或则单独安装插件
60 |
61 | ```
62 | $ npm install gitbook-plugin-anchor-navigation-ex --save
63 | ```
64 |
65 | >open npm : https://www.npmjs.com/package/gitbook-plugin-anchor-navigation-ex
66 |
67 |
68 | # 致敬
69 | 本插件集合以下插件的功能,并重写。
70 |
71 | 1. https://github.com/zhangzq/gitbook-plugin-navigator
72 | 2. https://github.com/yaneryou/gitbook-plugin-anchor-navigation
73 |
74 |
--------------------------------------------------------------------------------
/assets/lib/config.js:
--------------------------------------------------------------------------------
1 | require('./log');
2 |
3 | const defaultConfig = {
4 | // 标题是否显示层级序号
5 | showLevel: true,
6 | // 页面内的序号是否与 summary.md 中官方默认主题生成的序号相关联
7 | associatedWithSummary: true,
8 | printLog: false, // 是否打印日志,就如同自己使用了prism,但是很容易写错他的定义,比如css写成了csss,文章太多的话,生成出错,但是找不到是那篇文章,打开该选项就能定位了
9 | multipleH1: true, // 多H1模式么?一般正常的文章一个md文件只有一个H1标题,这个时候就适合关闭该选项,生成的标题不会多一个 1. 出来
10 | // 模式:分为三种:float:浮动导航、pageTop:页面内部顶部导航、null:不显示导航
11 | mode: "float",
12 | showGoTop: true, //是否显示返回顶部摁扭
13 | float: { //浮动导航设置
14 | floatIcon: "fa fa-navicon",
15 | showLevelIcon: false, //是否显示层级图标
16 | level1Icon: "fa fa-hand-o-right",
17 | level2Icon: "fa fa-hand-o-right",
18 | level3Icon: "fa fa-hand-o-right"
19 | },
20 | pageTop: {
21 | showLevelIcon: false, //是否显示层级图标
22 | level1Icon: "fa fa-hand-o-right",
23 | level2Icon: "fa fa-hand-o-right",
24 | level3Icon: "fa fa-hand-o-right"
25 | },
26 | // 官方默认主题 层级开关
27 | themeDefault: {
28 | showLevel: false
29 | }
30 | }
31 |
32 | /**
33 | * 处理默认参数
34 | * @param defaultConfig
35 | * @param config
36 | */
37 | function handler(defaultConfig, config) {
38 | if (config) {
39 | for (var item in defaultConfig) {
40 | if (item in config) {
41 | defaultConfig[item] = config[item];
42 | }
43 | }
44 | }
45 | }
46 | /**
47 | * 处理所有的配置参数
48 | * @param bookIns
49 | */
50 | function handlerAll(bookIns) {
51 | var config = bookIns.config.get('pluginsConfig')['anchor-navigation-ex'];
52 | var themeDefaultConfig = bookIns.config.get('pluginsConfig')['theme-default'];
53 | handler(defaultConfig, config);
54 | handler(defaultConfig.themeDefault, themeDefaultConfig);
55 |
56 | if (config.isRewritePageTitle) {
57 | console.error("error:".error +
58 | "plugins[anchor-navigation-ex]:isRewritePageTitle 配置只支持0.3.x 版本," +
59 | "请到https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex查看最新版本的配置项");
60 | console.log("");
61 | console.error("error:".error +
62 | "plugins[anchor-navigation-ex]:isRewritePageTitle Configuration only supports 0.3.x version," +
63 | "Please check here https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex for the latest version of the configuration item");
64 | }
65 | }
66 | /**
67 | * 本类中 config 单例共享
68 | * @type {{config: {showLevel: boolean, associatedWithSummary: boolean, mode: string, float: {showLevelIcon: boolean, level1Icon: string, level2Icon: string, level3Icon: string}, top: {showLevelIcon: boolean, level1Icon: string, level2Icon: string, level3Icon: string}, themeDefault: {showLevel: boolean}}, handler: handler, handlerAll: handlerAll}}
69 | */
70 | module.exports = {
71 | config: defaultConfig,
72 | handler: handler,
73 | handlerAll: handlerAll
74 | }
75 |
--------------------------------------------------------------------------------
/assets/lib/log.js:
--------------------------------------------------------------------------------
1 | var colors = require('colors');
2 | colors.setTheme({
3 | silly: 'rainbow',
4 | input: 'grey',
5 | verbose: 'cyan',
6 | prompt: 'grey',
7 | info: 'green',
8 | data: 'grey',
9 | help: 'cyan',
10 | warn: 'yellow',
11 | debug: 'blue',
12 | error: 'red'
13 | });
14 |
15 | module.exports = colors;
16 |
17 |
--------------------------------------------------------------------------------
/assets/lib/plugin.js:
--------------------------------------------------------------------------------
1 | var cheerio = require('cheerio');
2 | var slug = require('github-slugid');
3 | var Config = require('./config.js');
4 |
5 |
6 | /**
7 | * 处理toc相关,同时处理标题和id
8 | * @param $
9 | * @param option
10 | * @param page
11 | * @returns {Array} 返回处理好的tocs合集
12 | */
13 | function handlerTocs($, page, modifyHeader) {
14 | var config = Config.config;
15 | var tocs = [];
16 |
17 | var count = {
18 | h1: 0,
19 | h2: 0,
20 | h3: 0
21 | };
22 | var titleCountMap = {}; // 用来记录标题出现的次数
23 | var h1 = 0, h2 = 0, h3 = 0;
24 | $(':header').each(function (i, elem) {
25 | var header = $(elem);
26 | var id = addId(header, titleCountMap);
27 |
28 | if (id) {
29 | switch (elem.tagName) {
30 | case "h1":
31 | handlerH1Toc(config, count, header, tocs, page.level, modifyHeader);
32 | break;
33 | case "h2":
34 | handlerH2Toc(config, count, header, tocs, page.level, modifyHeader);
35 | break;
36 | case "h3":
37 | handlerH3Toc(config, count, header, tocs, page.level, modifyHeader);
38 | break;
39 | default:
40 | titleAddAnchor(header, id);
41 | break;
42 | }
43 | }
44 | });
45 | // 不然标题重写就没有效果,如果在外面不调用这句话的话
46 | page.content = $.html();
47 | return tocs;
48 | }
49 |
50 | /**
51 | * 处理锚点
52 | * @param header
53 | * @param titleCountMap 用来记录标题出现的次数
54 | * @returns {string}
55 | */
56 | function addId(header, titleCountMap) {
57 | var id = header.attr('id') || slug(header.text());
58 | var titleCount = titleCountMap[id] || 0;
59 | titleCountMap[id] = titleCount + 1;
60 | // console.log('id:', id, 'n:', titleCount, 'hashmap:', titleCountMap)
61 | if (titleCount) {//此标题已经存在 null/undefined/0/NaN/ 表达式时,统统被解释为false
62 | id = id + '_' + titleCount;
63 | }
64 | header.attr("id", id);
65 | return id;
66 | }
67 |
68 | /**
69 | * 标题增加锚点效果
70 | * @param header
71 | * @param id
72 | */
73 | function titleAddAnchor(header, id) {
74 | header.prepend(''
76 | + ''
77 | + '');
78 | }
79 |
80 | /**
81 | * 处理h1
82 | * @param count 计数器
83 | * @param header
84 | * @param tocs 根节点
85 | */
86 | function handlerH1Toc(config, count, header, tocs, pageLevel, modifyHeader) {
87 | var title = header.text();
88 | var id = header.attr('id');
89 | var level = ''; //层级
90 |
91 | if (config.showLevel) {
92 | //层级显示仅在需要的时候处理
93 | count.h1 += 1;
94 | count.h2 = 0;
95 | count.h3 = 0;
96 | if (config.multipleH1) {
97 | level = count.h1 + '. ';
98 | } else {
99 | level = ' ';
100 | }
101 | // 是否与官网默认主题层级序号相关联
102 | if (config.associatedWithSummary && config.themeDefault.showLevel) {
103 | level = pageLevel + '.' + level;
104 | }
105 | if (!modifyHeader) {
106 | level = '';
107 | }
108 | header.text(level + title); //重写标题
109 | }
110 | titleAddAnchor(header, id);
111 | tocs.push({
112 | name: title,
113 | level: level,
114 | url: id,
115 | children: []
116 | });
117 | }
118 |
119 | /**
120 | * 处理h2
121 | * @param count 计数器
122 | * @param header
123 | */
124 | function handlerH2Toc(config, count, header, tocs, pageLevel, modifyHeader) {
125 | var title = header.text();
126 | var id = header.attr('id');
127 | var level = ''; //层级
128 |
129 | if (tocs.length <= 0) {
130 | //一级节点为空时,生成一个空的一级节点,让二级节点附带在这个上面
131 | // 在显示层级的时候不乱
132 | if (config.showLevel) {
133 | count.h1 += 1;
134 | }
135 | tocs.push({
136 | name: "",
137 | level: "",
138 | url: "",
139 | children: []
140 | });
141 | }
142 |
143 | var h1Index = tocs.length - 1;
144 | var h1Toc = tocs[h1Index];
145 | if (config.showLevel) {
146 | count.h2 += 1;
147 | count.h3 = 0;
148 | if (config.multipleH1) {
149 | level = (count.h1 + '.' + count.h2 + '. ');
150 | } else {
151 | level = (count.h2 + '. ');
152 | }
153 | if (config.associatedWithSummary && config.themeDefault.showLevel) {
154 | level = pageLevel + '.' + level;
155 | }
156 | if (!modifyHeader) {
157 | level = '';
158 | }
159 | header.text(level + title); //重写标题
160 | }
161 | titleAddAnchor(header, id);
162 | h1Toc.children.push({
163 | name: title,
164 | level: level,
165 | url: id,
166 | children: []
167 | });
168 | }
169 |
170 | /**
171 | * 处理h3
172 | * @param count 计数器
173 | * @param header
174 | */
175 | function handlerH3Toc(config, count, header, tocs, pageLevel, modifyHeader) {
176 | var title = header.text();
177 | var id = header.attr('id');
178 | var level = ''; //层级
179 |
180 | if (tocs.length <= 0) {
181 | //一级节点为空时,生成一个空的一级节点,让二级节点附带在这个上面
182 | if (config.showLevel) {
183 | count.h1 += 1;
184 | }
185 | tocs.push({
186 | name: "",
187 | level: "",
188 | url: "",
189 | children: []
190 | });
191 | }
192 | var h1Index = tocs.length - 1;
193 | var h1Toc = tocs[h1Index];
194 | var h2Tocs = h1Toc.children;
195 | if (h2Tocs.length <= 0) {
196 | //二级节点为空时,生成一个空的二级节点,让三级节点附带在这个上面
197 | if (config.showLevel) {
198 | count.h2 += 1;
199 | }
200 | h2Tocs.push({
201 | name: "",
202 | level: "",
203 | url: "",
204 | children: []
205 | });
206 | }
207 | var h2Toc = h1Toc.children[h2Tocs.length - 1];
208 |
209 | if (config.showLevel) {
210 | count.h3 += 1;
211 | if (config.multipleH1) {
212 | level = (count.h1 + '.' + count.h2 + '.' + count.h3 + '. ');
213 | } else {
214 | level = (count.h2 + '.' + count.h3 + '. ');
215 | }
216 | if (config.associatedWithSummary && config.themeDefault.showLevel) {
217 | level = pageLevel + "." + level;
218 | }
219 | if (!modifyHeader) {
220 | level = '';
221 | }
222 | header.text(level + title); //重写标题
223 | }
224 | titleAddAnchor(header, id);
225 | h2Toc.children.push({
226 | name: title,
227 | level: level,
228 | url: id,
229 | children: []
230 | });
231 | }
232 |
233 | /**
234 | * 处理浮动导航:拼接锚点导航html,并添加到html末尾,利用css 悬浮
235 | * @param tocs
236 | * @returns {string}
237 | */
238 | function handlerFloatNavbar($, tocs) {
239 | var config = Config.config;
240 | var float = config.float;
241 | var floatIcon = float.floatIcon;
242 | var level1Icon = '';
243 | var level2Icon = '';
244 | var level3Icon = '';
245 | if (float.showLevelIcon) {
246 | level1Icon = float.level1Icon;
247 | level2Icon = float.level2Icon;
248 | level3Icon = float.level3Icon;
249 | }
250 |
251 | var html = "
";
252 | for (var i = 0; i < tocs.length; i++) {
253 | var h1Toc = tocs[i];
254 | if (h1Toc.name){
255 | html += "- " + h1Toc.level + "" + h1Toc.name + "
";
256 | }
257 | if (h1Toc.children.length > 0) {
258 | html += ""
259 | for (var j = 0; j < h1Toc.children.length; j++) {
260 | var h2Toc = h1Toc.children[j];
261 | if(h2Toc.name){
262 | html += "- " + h2Toc.level + "" + h2Toc.name + "
";
263 | }
264 | if (h2Toc.children.length > 0) {
265 | html += "";
271 | }
272 | }
273 | html += "
"
274 | }
275 | }
276 | html += "
";
277 | return html;
278 | }
279 |
280 | function handlerPageTopNavbar($, tocs) {
281 | return buildTopNavbar($, tocs)
282 | }
283 |
284 | function buildTopNavbar($, tocs) {
285 | var config = Config.config;
286 | var pageTop = config.pageTop;
287 | var level1Icon = '';
288 | var level2Icon = '';
289 | var level3Icon = '';
290 | if (pageTop.showLevelIcon) {
291 | level1Icon = pageTop.level1Icon;
292 | level2Icon = pageTop.level2Icon;
293 | level3Icon = pageTop.level3Icon;
294 | }
295 |
296 | var html = "";
297 | for (var i = 0; i < tocs.length; i++) {
298 | var h1Toc = tocs[i];
299 | if(h1Toc.name){
300 | html += "- " + h1Toc.level + "" + h1Toc.name + "
";
301 | }
302 | if (h1Toc.children.length > 0) {
303 | html += ""
304 | for (var j = 0; j < h1Toc.children.length; j++) {
305 | var h2Toc = h1Toc.children[j];
306 | if(h2Toc.name){
307 | html += "- " + h2Toc.level + "" + h2Toc.name + "
";
308 | }
309 | if (h2Toc.children.length > 0) {
310 | html += "";
316 | }
317 | }
318 | html += "
"
319 | }
320 | }
321 |
322 | html += "
";
323 |
324 | return html;
325 | }
326 |
327 | /**
328 | * 添加返回顶部按钮
329 | * @param tocs
330 | * @returns {string}
331 | */
332 | function buildGoTop(tocs) {
333 | var config = Config.config;
334 | var html = "";
335 | if (config.showGoTop && tocs && tocs.length > 0) {
336 | html = "";
337 | }
338 | return html;
339 | }
340 |
341 | function start(bookIns, page) {
342 | var $ = cheerio.load(page.content);
343 | var modifyHeader = !//.test(page.content)
344 |
345 | // 处理toc相关,同时处理标题和id
346 | var tocs = handlerTocs($, page, modifyHeader);
347 |
348 | // 设置处理之后的内容
349 | if (tocs.length == 0) {
350 | page.content = $.html();
351 | return;
352 | }
353 | var html = "";
354 | if (!//.test(page.content)) {
355 | var config = Config.config;
356 | var mode = config.mode;
357 | if (mode == 'float') {
358 | html = handlerFloatNavbar($, tocs);
359 | } else if (mode == 'pageTop') {
360 | html = handlerPageTopNavbar($, tocs);
361 | }
362 | }
363 | html += buildGoTop(tocs);
364 | page.content = html + $.html();
365 | var $x = cheerio.load(page.content);
366 | $x('extoc').replaceWith($x(buildTopNavbar($, tocs, page)));
367 | page.content = $x.html();
368 | }
369 |
370 | module.exports = start;
371 |
--------------------------------------------------------------------------------
/assets/style/plugin.css:
--------------------------------------------------------------------------------
1 | /** 浮动导航 */
2 | #anchor-navigation-ex-navbar {
3 | background-color: #fafafa;
4 | border: 1px solid rgba(0, 0, 0, .07);
5 | border-radius: 1px;
6 | -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
7 | box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
8 | background-clip: padding-box;
9 | padding: 5px 10px;
10 | position: fixed;
11 | /*background-color: rgba(255,255,255,0.98);*/
12 | right: 50px;
13 | top: 68px;
14 | font-size: 12px;
15 | white-space: nowrap;
16 | z-index: 999;
17 | cursor: pointer;
18 | text-align: right;
19 | max-height: 70%;
20 | overflow-y: auto;
21 | overflow-x: hidden;
22 | }
23 |
24 | #anchor-navigation-ex-navbar ul {
25 | display: none;
26 | text-align: left;
27 | padding-right: 10px;
28 | padding-left: 10px;
29 | list-style-type: none;
30 | }
31 |
32 | #anchor-navigation-ex-navbar:hover ul {
33 | display: block;
34 | }
35 |
36 | #anchor-navigation-ex-navbar ul li a {
37 | text-decoration: none;
38 | border-bottom: none;
39 | font-size: 14px;
40 | color: #364149;
41 | background: 0 0;
42 | text-overflow: ellipsis;
43 | overflow: hidden;
44 | white-space: nowrap;
45 | position: relative;
46 | }
47 |
48 | #anchor-navigation-ex-navbar ul li a:hover {
49 | text-decoration: underline;
50 | }
51 |
52 | #anchor-navigation-ex-navbar ul li .title-icon {
53 | padding-right: 4px;
54 | }
55 |
56 | /*对应官网皮肤主题颜色*/
57 | .book.color-theme-1 #anchor-navigation-ex-navbar {
58 | background-color: #111111;
59 | border-color: #7e888b;
60 | color: #afa790;
61 | }
62 |
63 | .book.color-theme-1 #anchor-navigation-ex-navbar ul li a {
64 | color: #877f6a;
65 | }
66 |
67 | .book.color-theme-2 #anchor-navigation-ex-navbar {
68 | background-color: #2d3143;
69 | border-color: #272a3a;
70 | color: #bcc1d2;
71 | }
72 |
73 | .book.color-theme-2 #anchor-navigation-ex-navbar ul li a {
74 | color: #c1c6d7;
75 | }
76 |
77 | /* 返回顶部 */
78 | #anchorNavigationExGoTop {
79 | position: fixed;
80 | right: 50px;
81 | bottom: 68px;
82 | background-color: #fafafa;
83 | border: 1px solid rgba(0, 0, 0, .07);
84 | border-radius: 1px;
85 | -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
86 | box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
87 | background-clip: padding-box;
88 | z-index: 999;
89 | cursor: pointer;
90 | font-size: 12px;
91 | padding: 5px 10px;
92 | color: #364149;
93 | }
94 | /*对应官网皮肤主题颜色*/
95 | .book.color-theme-1 #anchorNavigationExGoTop {
96 | background-color: #111111;
97 | border-color: #7e888b;
98 | color: #afa790;
99 | }
100 |
101 | .book.color-theme-2 #anchorNavigationExGoTop {
102 | background-color: #2d3143;
103 | border-color: #272a3a;
104 | color: #bcc1d2;
105 | }
106 |
107 | a.anchor-navigation-ex-anchor {
108 | color: inherit !important;
109 | display: none;
110 | margin-left: -30px;
111 | padding-left: 40px;
112 | cursor: pointer;
113 | position: absolute;
114 | top: 0;
115 | left: 0;
116 | bottom: 0;
117 | }
118 |
119 | a.anchor-navigation-ex-anchor i {
120 | margin-left: -30px;
121 | /*color: #000;*/
122 | vertical-align: middle;
123 | font-size: 16px !important;
124 | }
125 |
126 | h1, h2, h3, h4, h5, h6 {
127 | position: relative;
128 | }
129 |
130 | h1:hover a.anchor-navigation-ex-anchor, h2:hover a.anchor-navigation-ex-anchor, h3:hover a.anchor-navigation-ex-anchor,
131 | h4:hover a.anchor-navigation-ex-anchor, h5:hover a.anchor-navigation-ex-anchor, h6:hover a.anchor-navigation-ex-anchor {
132 | display: inline-block;
133 | }
134 |
135 | .book .book-body .page-wrapper .page-inner section.normal {
136 | overflow: visible;
137 | }
138 |
139 | /* 页面内顶部固定导航 */
140 | #anchor-navigation-ex-pagetop-navbar{
141 | border: 1px solid rgba(0, 0, 0, .07);
142 | border-radius: 1px;
143 | background-clip: padding-box;
144 | padding: 5px 10px;
145 | background-color: #fafafa;
146 | font-size: 12px;
147 | }
148 |
149 | #anchor-navigation-ex-pagetop-navbar ul {
150 | text-align: left;
151 | padding-right: 10px;
152 | padding-left: 10px;
153 | list-style-type: none;
154 | }
155 |
156 | #anchor-navigation-ex-pagetop-navbar:hover ul {
157 | display: block;
158 | }
159 |
160 | #anchor-navigation-ex-pagetop-navbar ul li a {
161 | text-decoration: none;
162 | border-bottom: none;
163 | font-size: 14px;
164 | color: #364149;
165 | background: 0 0;
166 | text-overflow: ellipsis;
167 | overflow: hidden;
168 | white-space: nowrap;
169 | position: relative;
170 | }
171 |
172 | #anchor-navigation-ex-pagetop-navbar ul li a:hover {
173 | text-decoration: underline;
174 | }
175 |
176 | #anchor-navigation-ex-pagetop-navbar ul li .title-icon {
177 | padding-right: 4px;
178 | }
179 |
180 | /*对应官网皮肤主题颜色*/
181 | .book.color-theme-1 #anchor-navigation-ex-pagetop-navbar {
182 | background-color: #111111;
183 | border-color: #7e888b;
184 | color: #afa790;
185 | }
186 |
187 | .book.color-theme-1 #anchor-navigation-ex-pagetop-navbar ul li a {
188 | color: #877f6a;
189 | }
190 |
191 | .book.color-theme-2 #anchor-navigation-ex-pagetop-navbar {
192 | background-color: #2d3143;
193 | border-color: #272a3a;
194 | color: #bcc1d2;
195 | }
196 |
197 | .book.color-theme-2 #anchor-navigation-ex-pagetop-navbar ul li a {
198 | color: #c1c6d7;
199 | }
200 |
201 |
202 |
203 |
204 |
205 |
206 |
--------------------------------------------------------------------------------
/doc/README_EN.md:
--------------------------------------------------------------------------------
1 | # gitbook-plugin-anchor-navigation-ex
2 |
3 | [](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues) [](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues?q=is%3Aissue+is%3Aclosed) [](https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/master/LICENSE) [](https://www.npmjs.com/package/gitbook-plugin-anchor-navigation-ex) [](https://www.npmjs.com/package/gitbook-plugin-anchor-navigation-ex)
4 |
5 |
6 |
7 | =============== 【DOC:[中文](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/README.md),English 】================
8 |
9 | =============== 【UpdateRecord:[中文](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/updateRecord.md),[English](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/updateRecord-en.md)】================
10 |
11 |
12 |
13 | -----
14 |
15 | :exclamation: The plug-in configuration incompatible V1. X version below
16 |
17 | :kissing_heart: My English is not good, this document is through the machine translation, if you don't understand, please read the document in Chinese, the translation itself
18 |
19 | # plug-in function
20 | - [x] H1 - H6 to page title increase anchor effect
21 | - [x] floating navigation mode
22 | - [x] page at the top of the navigation mode
23 | - [x] navigation title before the hierarchy of the icon is displayed, the custom of H1, H3 level icon
24 | - [x] plugins["theme-default"],The page title level with the default theme official ` showLevel ` hierarchy correlation
25 | - [x] plugins["theme-default"],Plug-in style website three kinds of style of the default theme:White、Sepia、Night
26 | - [x] Adding `` tags to a page generates the TOC directory here
27 | - [x] Add the `` tag to the page without generating a floating navigation on that page
28 | - [x] config.printLog=true, the current progress of the printing process, debugging is very useful
29 | - [x] config.multipleH1=false, remove ugly redundant 1. serial numbers (such as after your books follow a MD file with only one H1 tag)
30 | - [x] config.showGoTop=true,Displays the back top button V1.0.11+
31 | - [x] config.float.floatIcon ,You can configure the float navigation float icon style V1.0.12+
32 | - [x] Add the `` tag to the page,No hierarchical Numbers are generated on this page V1.0.12+
33 |
34 | # plug-in effect
35 | * style: a minimalist
36 | * [Click to view rendering](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/effectScreenshot.md)
37 |
38 |
39 | # how to use the plugin?
40 | In your ` book. Json ` add plugins:
41 |
42 | ```
43 | {
44 | "plugins": [
45 | "anchor-navigation-ex"
46 | ]
47 | }
48 | ```
49 | Then install the plugin:
50 |
51 | ```
52 | $ gitbook install ./
53 | ```
54 |
55 | Can use the plug-in configuration in detail, [please click here to view](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/config-en.md)
56 |
57 |
58 | Or a separate plugin is installed
59 |
60 | ```
61 | $ npm install gitbook-plugin-anchor-navigation-ex --save
62 | ```
63 |
64 | >open npm : https://www.npmjs.com/package/gitbook-plugin-anchor-navigation-ex
65 |
66 |
67 | # salute
68 | This sets the following plugin functions, and rewrite.
69 |
70 | 1. https://github.com/zhangzq/gitbook-plugin-navigator
71 | 2. https://github.com/yaneryou/gitbook-plugin-anchor-navigation
72 |
73 |
--------------------------------------------------------------------------------
/doc/config-en.md:
--------------------------------------------------------------------------------
1 | # plug-in custom functions, parameters, rounding
2 | Configuration of this plug-in supports the following parameters:The configuration shown here is the default configuration
3 | ```json
4 | {
5 | "showLevel": true,
6 | "associatedWithSummary": true,
7 | "printLog": false,
8 | "multipleH1": true,
9 | "mode": "float",
10 | "showGoTop":true,
11 | "float": {
12 | "floatIcon": "fa fa-navicon",
13 | "showLevelIcon": false,
14 | "level1Icon": "fa fa-hand-o-right",
15 | "level2Icon": "fa fa-hand-o-right",
16 | "level3Icon": "fa fa-hand-o-right"
17 | },
18 | "pageTop": {
19 | "showLevelIcon": false,
20 | "level1Icon": "fa fa-hand-o-right",
21 | "level2Icon": "fa fa-hand-o-right",
22 | "level3Icon": "fa fa-hand-o-right"
23 | }
24 | }
25 | ```
26 |
27 | ## showLevel : TYPE:boolean。
28 | Whether the title display hierarchy serial number. The page title and title in the navigation will add level display.(controls whether the title of the page is overwritten)
29 |
30 | ```
31 | ---- xx.md ---
32 | # h1
33 | ## h2
34 | ### h3
35 |
36 | Page effect of the display hierarchy is as follows:
37 | 1. h1
38 | 1.1. h2
39 | 1.1.1 h3
40 | ```
41 | ## associatedWithSummary : TYPE:boolean
42 | The serial number of the page within the summary.md. The md official default theme generated serial number associated with it.
43 | ```
44 | If you open the level display in the default theme website:
45 | "pluginsConfig": {
46 | "anchor-navigation-ex": {
47 | "associatedWithSummary":true
48 | },
49 | "theme-default": {
50 | "showLevel": true
51 | }
52 | }
53 | So write like this:
54 |
55 | ----- SUMMARY.md ------
56 | # Summary
57 |
58 | * [安装](chapter/install.md)
59 | * [命令](chapter/command.md)
60 | * [配置](chapter/bookjson.md)
61 | * [插件](chapter/plugin.md)
62 | * [prismjs 代码高亮](chapter/plugin/prismjs.md)
63 | * [ace 代码高亮编辑](chapter/plugin/ace.md)
64 | * [navigator 页面导航](chapter/plugin/navigator.md)
65 |
66 | ----- chapter/redis/cluster.md ------
67 | # redis集群的准备
68 | ## zlib
69 | 1. 安装redis-cluster依赖:redis-cluster的依赖库在使用时有兼容问题,在reshard时会遇到各种错误,请按指定版本安装.
70 | 2. 确保系统安装zlib,否则gem install会报(no such file to load -- zlib)
71 |
72 | ...
73 | ```
74 | So the result is as follows:
75 | 
76 |
77 | ## printLog : TYPE:boolean(V1.0.6+)
78 | Whether to print the processing log is useful in troubleshooting the failure to generate book, and to know which file is wrong
79 | As shown below, other plug-ins are used, but only the error messages are printed, and which file is not known. Open this option and you'll see
80 | 
81 |
82 | ## multipleH1 : TYPE:boolean(V1.0.6+)
83 | Is it a multi H1 mode? A normal book. One chapter has only one H1 tag, that is, a MD file and a label. If your books are in this normal mode, close this option, =false
84 | The biggest difference is as follows
85 | ```
86 | ---- multipleH1=true----
87 | # 多H1标题1
88 | ## 子标题
89 | # 多H1标题2
90 | ## 子标题
91 | ## 子标题
92 |
93 | 生成的标题如下:
94 | 1. 多H1标题1
95 | 1.1. 子标题
96 | 2. 多H1标题2
97 | 2.1. 子标题
98 | 2.2. 子标题
99 |
100 | ---- multipleH1=false----
101 | # 多H1标题1
102 | ## 子标题
103 | # 多H1标题2
104 | ## 子标题
105 | ## 子标题
106 |
107 | 生成的标题如下:
108 | 多H1标题1
109 | 1. 子标题
110 | 多H1标题2
111 | 1. 子标题
112 | 2. 子标题
113 |
114 | See the difference? Normal book mode, that is, only one H1 case, the display of the sort number more in line with our needs.
115 | ```
116 |
117 | ## mode
118 | There are three kinds of navigation mode:
119 |
120 | 1. float :floating navigation
121 | 2. pageTop : internal at the top of the page navigation
122 | 3. '' : don't show navigation
123 |
124 | ## float
125 | mode = float The following configuration to take effect
126 | ```
127 | float: { //浮动导航设置
128 | "floatIcon": "fa fa-navicon", // 配置导航图标,如果你喜欢原先的 锚 图标可以配置为 fa-anchor
129 | "showLevelIcon": false, //是否显示层级图标
130 | "level1Icon": "fa fa-hand-o-right", //层级的图标css
131 | "level2Icon": "fa fa-hand-o-right",
132 | "level3Icon": "fa fa-hand-o-right"
133 | }
134 | ```
135 | Icon to use the default theme website to introduce the CSS `http://fontawesome.dashgame.com/`
136 |
137 | ## pageTop
138 | mode = pageTop The following configuration to take effect
139 | ```
140 | pageTop: {
141 | showLevelIcon: false,
142 | level1Icon: "fa fa-hand-o-right",
143 | level2Icon: "fa fa-hand-o-right",
144 | level3Icon: "fa fa-hand-o-right"
145 | }
146 | ```
147 | ## showGoTop : TYPE:boolean (V1.0.11+)
148 |
149 | The return top button is separated, and the return top button is displayed for true
150 |
151 | # additional support function
152 | - Adding `` tags to a page generates the TOC directory here.
153 | - in the page to add `` logo, will make this page does not generate suspended navigation
154 |
155 | In the home page, the introduction page and other places can use this function, can block some code, because these places can not load css
156 |
--------------------------------------------------------------------------------
/doc/config.md:
--------------------------------------------------------------------------------
1 | # 插件功能定制,参数详解
2 | 本插件支持以下参数的配置:这里展示的配置都是默认配置
3 | ```json
4 | {
5 | "showLevel": true,
6 | "associatedWithSummary": true,
7 | "printLog": false,
8 | "multipleH1": true,
9 | "mode": "float",
10 | "showGoTop":true,
11 | "float": {
12 | "floatIcon": "fa fa-navicon",
13 | "showLevelIcon": false,
14 | "level1Icon": "fa fa-hand-o-right",
15 | "level2Icon": "fa fa-hand-o-right",
16 | "level3Icon": "fa fa-hand-o-right"
17 | },
18 | "pageTop": {
19 | "showLevelIcon": false,
20 | "level1Icon": "fa fa-hand-o-right",
21 | "level2Icon": "fa fa-hand-o-right",
22 | "level3Icon": "fa fa-hand-o-right"
23 | }
24 | }
25 | ```
26 | ## showLevel : TYPE:boolean。
27 | 标题是否显示层级序号.页面标题和导航中的标题都会加上层级显示。(控制页面标题是否被重写)
28 |
29 | ```
30 | ---- xx.md ---
31 | # h1
32 | ## h2
33 | ### h3
34 |
35 | 显示层级后的页面效果如下:
36 | 1. h1
37 | 1.1. h2
38 | 1.1.1 h3
39 | ```
40 | ## associatedWithSummary : TYPE:boolean
41 | 页面内的序号是否与 summary.md 中官方默认主题生成的序号相关联。
42 | ```
43 | 如果你打开了官网默认主题中的层级显示:
44 | "pluginsConfig": {
45 | "anchor-navigation-ex": {
46 | "associatedWithSummary":true
47 | },
48 | "theme-default": {
49 | "showLevel": true
50 | }
51 | }
52 | 那么这样写:
53 |
54 | ----- SUMMARY.md ------
55 | # Summary
56 |
57 | * [安装](chapter/install.md)
58 | * [命令](chapter/command.md)
59 | * [配置](chapter/bookjson.md)
60 | * [插件](chapter/plugin.md)
61 | * [prismjs 代码高亮](chapter/plugin/prismjs.md)
62 | * [ace 代码高亮编辑](chapter/plugin/ace.md)
63 | * [navigator 页面导航](chapter/plugin/navigator.md)
64 |
65 | ----- chapter/redis/cluster.md ------
66 | # redis集群的准备
67 | ## zlib
68 | 1. 安装redis-cluster依赖:redis-cluster的依赖库在使用时有兼容问题,在reshard时会遇到各种错误,请按指定版本安装.
69 | 2. 确保系统安装zlib,否则gem install会报(no such file to load -- zlib)
70 |
71 | ...
72 | ```
73 | 那么最终效果如下:
74 | 
75 |
76 | ## printLog : TYPE:boolean (V1.0.6+)
77 | 是否打印处理日志,在排查生成book失败的时候很有用,能知道是哪一个文件出的错
78 | 如下图:使用了别的插件,但是只打印了出错的信息,不知道是哪一个文件。开启该选项,就能知道了
79 | 
80 |
81 | ## multipleH1 : TYPE:boolean (V1.0.6+)
82 | 是否是多h1模式?一般正常的书籍一个章节只有一个h1标签,也就是一个md文件一个标签。如果您的书籍是这种正常模式,请关闭该选项=false
83 | 最大的区别如下
84 | ```
85 | ---- multipleH1=true----
86 | # 多H1标题1
87 | ## 子标题
88 | # 多H1标题2
89 | ## 子标题
90 | ## 子标题
91 |
92 | 生成的标题如下:
93 | 1. 多H1标题1
94 | 1.1. 子标题
95 | 2. 多H1标题2
96 | 2.1. 子标题
97 | 2.2. 子标题
98 |
99 | ---- multipleH1=false----
100 | # 多H1标题1
101 | ## 子标题
102 | # 多H1标题2
103 | ## 子标题
104 | ## 子标题
105 |
106 | 生成的标题如下:
107 | 多H1标题1
108 | 1. 子标题
109 | 多H1标题2
110 | 1. 子标题
111 | 2. 子标题
112 |
113 | 看出区别了么?正常书籍模式,也就是只有一个h1的情况下,这个展示的排序序号更符合我们的需求。
114 | ```
115 |
116 | ## mode
117 | 导航模式:分为三种
118 |
119 | 1. float :浮动导航
120 | 2. pageTop :页面内部顶部导航
121 | 3. '' : 不显示导航
122 |
123 | ## float
124 | mode = float的时候以下配置生效
125 | ```
126 | float: { //浮动导航设置
127 | "floatIcon": "fa fa-navicon", // 配置导航图标,如果你喜欢原先的 锚 图标可以配置为 fa-anchor
128 | "showLevelIcon": false, //是否显示层级图标
129 | "level1Icon": "fa fa-hand-o-right", //层级的图标css
130 | "level2Icon": "fa fa-hand-o-right",
131 | "level3Icon": "fa fa-hand-o-right"
132 | }
133 | ```
134 | 图标使用官网默认主题引入的css `http://fontawesome.dashgame.com/`
135 |
136 | ## pageTop
137 | mode = pageTop的时候以下配置生效
138 | ```
139 | pageTop: {
140 | showLevelIcon: false,
141 | level1Icon: "fa fa-hand-o-right",
142 | level2Icon: "fa fa-hand-o-right",
143 | level3Icon: "fa fa-hand-o-right"
144 | }
145 | ```
146 | ## showGoTop : TYPE:boolean (V1.0.11+)
147 |
148 | 把返回顶部按钮独立出来了,为true的时候显示返回顶部按钮
149 |
150 | # 额外功能支持
151 |
152 | - 在页面中增加``标签,会在此处生成TOC目录。
153 | - 在页面中增加``标识,会让此页面不生成悬浮导航
154 |
155 | 在首页、介绍页等地方可以使用该功能,能屏蔽一些代码,因为这些地方不能加载css
156 |
--------------------------------------------------------------------------------
/doc/effectScreenshot.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # 默认参数截图展示(mode: "float" 浮动导航)
4 | - white主题展示
5 | 
6 | - sepia主题展示
7 | 
8 | - night主题展示
9 | 
10 | - 锚点效果和TOP按钮展示
11 | 
12 |
13 |
14 |
15 | - Sample: https://zq99299.gitbooks.io/gitbook-guide/content/chapter/plugin.html
16 |
17 |
18 | # 层级图标展示
19 | 这里的icon样式与图片中的不是一个,这里只是示意效果
20 | ```
21 | "pluginsConfig": {
22 | "anchor-navigation-ex": {
23 | float: {
24 | showLevelIcon: true,
25 | level1Icon: "fa fa-hand-o-right",
26 | level2Icon: "fa fa-hand-o-right",
27 | level3Icon: "fa fa-hand-o-right"
28 | }
29 | }
30 | }
31 | ```
32 | 
33 | 
34 |
35 |
36 | # 页内顶部截图展示(mode: "pageTop")
37 | 
38 |
39 |
40 | -----------------
41 |
42 |
43 | 其他参数组合的效果未截图,请自行尝试
--------------------------------------------------------------------------------
/doc/images/night默认参数效果.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/night默认参数效果.png
--------------------------------------------------------------------------------
/doc/images/pageTop展示.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/pageTop展示.png
--------------------------------------------------------------------------------
/doc/images/printlog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/printlog.png
--------------------------------------------------------------------------------
/doc/images/sepia默认参数效果.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/sepia默认参数效果.png
--------------------------------------------------------------------------------
/doc/images/toc标题icon展示.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/toc标题icon展示.jpg
--------------------------------------------------------------------------------
/doc/images/toc标题icon展示2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/toc标题icon展示2.jpg
--------------------------------------------------------------------------------
/doc/images/white默认参数效果.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/white默认参数效果.png
--------------------------------------------------------------------------------
/doc/images/层级关联显示.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/层级关联显示.png
--------------------------------------------------------------------------------
/doc/images/标题重新与默认主题层级相关联.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/标题重新与默认主题层级相关联.jpg
--------------------------------------------------------------------------------
/doc/images/锚点效果和top展示.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zq99299/gitbook-plugin-anchor-navigation-ex/aa1aff6afc4b0c75e6fa09a4ea1be6ce5e3c64cb/doc/images/锚点效果和top展示.jpg
--------------------------------------------------------------------------------
/doc/updateRecord-en.md:
--------------------------------------------------------------------------------
1 | # Update record
2 | ## v 1.0.14 - 2019-01-16
3 | - [#38](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/38) Merge this pr to add the following functions
4 | - fix bug : When the h1, h2, and h3 in md are in an abnormal order, the toc is missing. After the repair, the toc display will not be missed. It can be seen that the title is abnormal. V1.0.14+
5 | - fix bug : In the previous fix bug, the serial number display in the case of showLevel was not taken into account.
6 |
7 | ## v 1.0.12 - 2018-09-17
8 | - [#36](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/36) Merge this pr to add the following functions
9 | - config.float.floatIcon ,You can configure the float navigation float icon style V1.0.12+
10 | - Add the `` tag to the page,No hierarchical Numbers are generated on this page V1.0.12+
11 |
12 | ## v 1.0.11 - 2018-08-22
13 | - [#33](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/33) The return top button is separated, and the return top button is displayed for true
14 |
15 | ## v1.0.9 - 2017-08-03
16 | - fix bug: [#26](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/26) When configuring mode:, the title of the page is not rewritten
17 |
18 | ## v1.0.8 - 2017-08-03
19 | - fix bug: [#26](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/26) mode:""
20 | The configuration is invalid and the navigation is generated at the top of the page
21 |
22 | ## v1.0.5 - 2017-07-14
23 | - New: the printLog configuration option, if it is true, compiles the printed MD file path at compile time. If the process fails, it is good to know which file it is
24 | - New: multipleH1 configuration options, if true, according to a MD file with multiple H1 title, false, according to a MD file only contains a H1 title, the biggest difference is to remove the ugly 1.xxx in 1.
25 |
26 | ## v1.0.4 - 2017-06-02
27 | This update is mainly to fix the title after the repeated strategy, and fix the previous version only dealt with the h1-h3 title duplicate bug[#19](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/19)
28 | - Modify
29 | - Modify ID generation method
30 | - simplify the Toc function, optimize the code to speed up the running speed
31 | - remember
32 | - Priority use of title content as ID
33 | - Keep custom ID [#18](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/18)
34 | - repeat ID auto-increment suffix [#6](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/6)
35 | - Use the `` annotation to let the page do not display navigation [#15](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/15)
36 | ## v1.0.2 - 2017-05-15
37 | - Adding an `` tag to the page generates the TOC directory here (which is consistent with the mode: pageTop pattern for the moment)[#17](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/17)
38 |
39 | ## v1.0.0 - 2017-03-09
40 | - [#7](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/7)
41 | - [#8](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/8)
42 | - [#9](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/9)
43 | - [#10](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/10)
44 | - [#11](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/11)
45 | - [#12](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/12)
46 | - [#13](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/13)
47 | - [#14](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/14)
48 |
49 | #### v0.3.2 - 2017-03-08
50 | - New configuration options - whether the page number is associated with the serial number generated in the official SUMMARY
51 |
52 | #### v0.3.0 - 2017-03-06
53 | - According to official level is associated with a page display [#4](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/4)
54 |
55 | #### v0.2.7 - 2017-03-01
56 | - fix bug: Anchor link index unique [#6](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/6)
57 |
58 | #### v0.2.6 - 2017-03-01
59 | - fix bug: [#5](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/5)
60 |
61 | #### v0.2.5 - 2017-02-17
62 | * to further optimize the suspension navigation style, and the official theme of the default to maintain the same, more beautiful, and unified style
63 | * increase the suspension navigation TOC icon icon before the custom
64 |
65 | #### v0.1.9 - 2017-02-17
66 | Optimized navigation style
67 |
68 | * reduce the shadow, slightly transparent panel background
69 | * text display is 14 PX
70 | * title number in bold
71 | * adapt to the official default theme of the 3 sets. The navigation style will change with the style of the theme of the skin
72 |
73 | #### v0.1.8 - 2017-02-09
74 | * change the anchor icon display, the replacement for the CSS style. Otherwise, the PDF will fail to generate
75 |
76 | #### v0.1.7 - 2017-02-09
77 | * CSS named refactoring
78 | * change the anchor icon display, the replacement for the GitHub consistent SVG Icon
79 | * the generated directory is added to the top of the page and, in some cases, a navigation at the bottom of the page. Very unsightly, such as:
80 | When the gitbook home page because it will not load the plug-in CSS effect
81 | - CSS cannot be loaded while generating pdf
82 |
83 | #### 2017-02-08
84 | * rebuild project structure
85 |
86 | #### 2017-02-07
87 | * in the source code using the let and ES6 syntax, the use of OK in local, reported in gitbook: PluginError: Error with plugin "anchor-navigation-ex": Block-scoped declarations (let, const, function, class) not yet supported outside strict mode. Do not know why, or to VaR to declare it
88 |
89 | #### 2017-02-06
90 | * completely rewriting code
91 | * with anchor and suspended navigation effect, now only need to introduce a plug-in gitbook-plugin-anchor-navigation-ex
92 |
93 | #### 2017-01-18
94 | * page without h[1-3] tag generation failed
95 |
96 | #### 2017-01-22
97 | * 2017-01-18 submitted a problem. Re repair
98 |
--------------------------------------------------------------------------------
/doc/updateRecord.md:
--------------------------------------------------------------------------------
1 | # Update record
2 | ## v 1.0.13 - 2019-01-16
3 | - [#38](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/38) 合并该 pr,增加以下功能
4 | - fix bug : 当 md 中 h1,h2,h3 非正常顺序的时候导致 toc 缺失,修复后 toc 展示不会漏掉,可以看出来该标题是不正常的 V1.0.14+
5 | - fix bug : 在上一条 fix bug 中,没有考虑到 showLevel 情况下的序号显示
6 |
7 | ## v 1.0.12 - 2018-09-17
8 | - [#36](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/36) 合并该 pr,增加以下功能
9 | - config.float.floatIcon 可以配置浮动导航的悬浮图标样式 V1.0.12+
10 | - 在页面中增加``不会在该页面生成层级序号 V1.0.12+
11 |
12 | ## v 1.0.11 - 2018-08-22
13 | - [#33](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/33) 把返回顶部按钮独立出来了,为true的时候显示返回顶部按钮
14 |
15 | ## v1.0.9 - 2017-08-03
16 | - fix bug: [#26](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/26) 当配置mode:""时,页面标题没有重写
17 |
18 | ## v1.0.8 - 2017-08-03
19 | - fix bug: [#26](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/26) mode:"" 配置无效,还会在页面顶部生成导航
20 |
21 | ## v1.0.5 - 2017-07-14
22 | - 新增:printLog 配置选项,如果为true的话,则编译的时候打印当前正在处理的md文件路径,如果处理失败,也好知道是哪一个文件
23 | - 新增:multipleH1 配置选项,如果为true的话,将按照一个md文件有多个H1标题处理,为false的话,则按照一个md文件只包含一个h1标题处理,最大的区别就是去掉了丑陋的1.xxx 中的1.
24 |
25 | ## v1.0.4 - 2017-06-02
26 | 此更新主要是修复标题重复后的策略,和修复上一个版本只处理了h1-h3标题重复的bug [#19](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/19)
27 | - 修改
28 | - 修改ID生成方式
29 | - 简化Toc函数,优化代码加快运行速度
30 | - 记过
31 | - 优先使用标题内容作为ID
32 | - 保留自定义ID [#18](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/18)
33 | - 重复ID自动递增后缀 [#6](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/6)
34 |
35 | 其他代码性能稍微优化
36 | - 使用``注释让页面不显示导航[#15](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/15)
37 |
38 | ## v1.0.2 - 2017-05-15
39 | - 在页面中增加``标签,会在此处生成TOC目录(该目录暂时与mode: "pageTop"模式生成的一致)[#17](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/17)
40 |
41 |
42 | ## v1.0.0 - 2017-03-09
43 | - [#7](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/7)
44 | - [#8](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/8)
45 | - [#9](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/9)
46 | - [#10](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/10)
47 | - [#11](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/11)
48 | - [#12](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/12)
49 | - [#13](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/13)
50 | - [#14](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/14)
51 |
52 | ## v0.3.2 - 2017-03-08
53 | - 新增配置选项-页面序号是否与官方SUMMARY中生成的序号相关联
54 |
55 | ## v0.3.0 - 2017-03-06
56 | - 官方层级显示功能 与 每页 相关联显示功能[#4](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/4)
57 |
58 |
59 | ## v0.2.7 - 2017-03-01
60 | - fix bug: 锚链接索引唯一 [#6](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/6)
61 |
62 | ## v0.2.6 - 2017-03-01
63 | - fix bug: [#5](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/pull/5)
64 |
65 | ## v0.2.5 - 2017-02-17
66 |
67 | 1. 进一步优化悬浮导航的样式,和官方默认主题保持一致,更加美观,和格调统一
68 | 2. 增加 悬浮导航toc标题前的图标定制 [#2](https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues/2)
69 |
70 | ## v0.1.9 - 2017-02-17
71 | 优化悬浮导航的样式
72 |
73 | 1. 将阴影缩小,面板背景略微透明
74 | 2. 文字显示为 14 px
75 | 3. 标题编号 加粗显示
76 | 4. 适配 官方默认3套主题样式。导航样式将随着皮肤主题的样式变换而变换
77 |
78 | ## v0.1.8 - 2017-02-09
79 | * 更换锚点图标显示,更换为css样式。不然 pdf生成的时候会失败
80 |
81 | ## v0.1.7 - 2017-02-09
82 | * css 命名重构
83 | * 更换锚点图标显示,更换为github一致的svg图标
84 | * 生成的目录增加到页面顶端,在某些情况下,会在页面底部来一个导航。很不美观,如:
85 | - 在gitbook首页的时候因为不会加载插件的css效果
86 | - 在生成pdf的时候,css没法被加载
87 |
88 | ## 2017-02-08
89 | * 重构项目结构
90 |
91 | ## 2017-02-07
92 | * 在源码中使用了 let 等es6的语法,在本地使用ok,在gitbook上报错:PluginError: Error with plugin "anchor-navigation-ex": Block-scoped declarations (let, const, function, class) not yet supported outside strict mode。不知道是为何,还是改成 var 来声明吧
93 |
94 | ## 2017-02-06
95 | * 完全重写代码
96 | * 合并锚点和悬浮导航效果,现在只需要引入一个插件了 gitbook-plugin-anchor-navigation-ex
97 |
98 | ## 2017-01-18
99 | * 页面没有h[1-3] 标签生成失败
100 |
101 | ## 2017-01-22
102 | * 2017-01-18 提交的有问题。重新修复
103 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | var _start = require('./assets/lib/plugin');
2 | var Config = require('./assets/lib/config');
3 | require('./assets/lib/log');
4 | module.exports = {
5 | book: {
6 | assets: "./assets",
7 | css: ["style/plugin.css"]
8 | },
9 | hooks: {
10 | "init": function () {
11 | Config.handlerAll(this);
12 | },
13 | "page": function (page) {
14 | if (Config.config.printLog) {
15 | console.info("INFO:".info + "当前正在处理:" + page.path)
16 | }
17 | var bookIns = this;
18 | _start(bookIns, page);
19 | return page;
20 | }
21 | }
22 | };
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gitbook-plugin-anchor-navigation-ex",
3 | "version": "1.0.14",
4 | "description": "Supports two navigation mode, title, anchor effect is the default theme, style, follow the website",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex.git"
12 | },
13 | "keywords": [
14 | "gitbook",
15 | "plugin",
16 | "anchor-navigation-ex",
17 | "ex"
18 | ],
19 | "author": "zhuqiang,yuan1994",
20 | "license": "Apache-2.0",
21 | "bugs": {
22 | "url": "https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues"
23 | },
24 | "homepage": "https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex#readme",
25 | "dependencies": {
26 | "cheerio": "*",
27 | "github-slugid": "1.0.1",
28 | "colors": "^1.1.2"
29 | },
30 | "engines": {
31 | "gitbook": ">=3.0.0"
32 | },
33 | "gitbook": {
34 | "properties": {
35 | "showLevel": {
36 | "type": "boolean",
37 | "default": true,
38 | "title": "是否为标题增加锚点效果并显示序号"
39 | },
40 | "associatedWithSummary": {
41 | "type": "boolean",
42 | "default": true,
43 | "title": "是否与官方默认主题summary目录生成的序号相关联"
44 | },
45 | "mode": {
46 | "type": "string",
47 | "default": "float",
48 | "title": "导航模式"
49 | },
50 | "showGoTop": {
51 | "type": "boolean",
52 | "default": true,
53 | "title": "是否显示返回顶部按钮"
54 | },
55 | "printLog":{
56 | "type": "boolean",
57 | "default": false,
58 | "title": "是否打印处理进度日志,方便排错"
59 | },
60 | "multipleH1":{
61 | "type": "boolean",
62 | "default": true,
63 | "title": "false:去掉每页开头H1标题被重写成1. xxx(如果您的md文档遵循一个md文件只有一个H1标题的话)"
64 | },
65 | "float": {
66 | "type": "object",
67 | "default": {
68 | "floatIcon": "fa fa-navicon",
69 | "showLevelIcon": false,
70 | "level1Icon": "",
71 | "level2Icon": "",
72 | "level3Icon": ""
73 | },
74 | "title": "浮动右侧导航模式"
75 | },
76 | "pageTop": {
77 | "type": "object",
78 | "default": {
79 | "showLevelIcon": false,
80 | "level1Icon": "",
81 | "level2Icon": "",
82 | "level3Icon": ""
83 | },
84 | "title": "页内顶部导航模式"
85 | }
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------