Closed DrWeiZhou closed 7 years ago
好的,你这么晚还不睡觉啊,吧你的gitbook的书籍地址发给我下,明天上班,我确认下这个配置,今天太晚了
感谢你的回复,你也睡很晚啊 我把代码放在
此外,那个mode属性也似乎不起作用啊,属性说明上很模糊,如果想不生成悬浮目录,是这样写么
"mode":""
但是似乎也不起作用,生成的pdf中总是会有目录,使用<!-- ex_nonav -->
也没有效果
我的编译环境是自己做了一个docker映像,基于ubuntu的,gitbook
CLI version: 2.3.0
GitBook version: 3.2.2
是不是我的anchor-navigation-ex版本问题呢,这是其中的package.json,我对js不熟,还请见谅,谢谢回复~~
root@ba5ec2dba7ed:~/weizhougitbooks/gitbook/node_modules/gitbook-plugin-anchor-navigation-ex# cat package.json
{
"_args": [
[
{
"name": "gitbook-plugin-anchor-navigation-ex",
"raw": "gitbook-plugin-anchor-navigation-ex@1.0.7",
"rawSpec": "1.0.7",
"scope": null,
"spec": "1.0.7",
"type": "version"
},
"/root/weizhougitbooks/gitbook"
]
],
"_from": "gitbook-plugin-anchor-navigation-ex@1.0.7",
"_id": "gitbook-plugin-anchor-navigation-ex@1.0.7",
"_inCache": true,
"_installable": true,
"_location": "/gitbook-plugin-anchor-navigation-ex",
"_nodeVersion": "8.1.3",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/gitbook-plugin-anchor-navigation-ex-1.0.7.tgz_1500017002338_0.49168834718875587"
},
"_npmUser": {
"email": "99299684@qq.com",
"name": "zhuqiang"
},
"_npmVersion": "5.0.3",
"_phantomChildren": {},
"_requested": {
"name": "gitbook-plugin-anchor-navigation-ex",
"raw": "gitbook-plugin-anchor-navigation-ex@1.0.7",
"rawSpec": "1.0.7",
"scope": null,
"spec": "1.0.7",
"type": "version"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/gitbook-plugin-anchor-navigation-ex/-/gitbook-plugin-anchor-navigation-ex-1.0.7.tgz",
"_shasum": "b807b7a572ffbf23235c0ebb557f7f236b1e304e",
"_shrinkwrap": null,
"_spec": "gitbook-plugin-anchor-navigation-ex@1.0.7",
"_where": "/root/weizhougitbooks/gitbook",
"author": {
"name": "zhuqiang,yuan1994"
},
"bugs": {
"url": "https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/issues"
},
"dependencies": {
"cheerio": "*",
"colors": "^1.1.2",
"github-slugid": "1.0.1"
},
"description": "Supports two navigation mode, title, anchor effect is the default theme, style, follow the website",
"devDependencies": {},
"directories": {},
"dist": {
"integrity": "sha512-QaeLgEG3ANKSpKuD/J4DkbNC70qPcM/L4oCnn/v6r7Qb/Tj2TRbaLypPEcF3Xo8u1WCxfAIodidzkahWe3Rsvg==",
"shasum": "b807b7a572ffbf23235c0ebb557f7f236b1e304e",
"tarball": "https://registry.npmjs.org/gitbook-plugin-anchor-navigation-ex/-/gitbook-plugin-anchor-navigation-ex-1.0.7.tgz"
},
"engines": {
"gitbook": ">=3.0.0"
},
"gitHead": "1350b4c8ca5846eea5d9b4fc325dd8c2ab183bb4",
"gitbook": {
"properties": {
"associatedWithSummary": {
"default": true,
"title": "associatedWithSummary",
"type": "boolean"
},
"float": {
"default": {
"level1Icon": "",
"level2Icon": "",
"level3Icon": "",
"showLevelIcon": false
},
"title": "float navigation",
"type": "object"
},
"mode": {
"default": "float",
"title": "Navigation mode",
"type": "string"
},
"multipleH1": {
"default": true,
"title": "multipleH1",
"type": "boolean"
},
"pageTop": {
"default": {
"level1Icon": "",
"level2Icon": "",
"level3Icon": "",
"showLevelIcon": false
},
"title": "pageTop navigation",
"type": "object"
},
"printLog": {
"default": false,
"title": "printLog",
"type": "boolean"
},
"showLevel": {
"default": true,
"title": "Show title level",
"type": "boolean"
}
}
},
"homepage": "https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex#readme",
"keywords": [
"gitbook",
"plugin",
"anchor-navigation-ex",
"ex"
],
"license": "GPL-3.0",
"main": "index.js",
"maintainers": [
{
"email": "99299684@qq.com",
"name": "zhuqiang"
}
],
"name": "gitbook-plugin-anchor-navigation-ex",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.7"
}
Error: nodejieba@2.2.5 install: node-gyp rebuild
下载你的代码 插件安装阶段出错。上面的错误信息;
嗯。我测试过了,这个mode:“”的配置无效在网页顶部生成了目录,这个是一个bug;我已经修复并重新发布版本了V1.0.8;
"anchor-navigation-ex": {
"mode": "",
},
"associatedWithSummary": true 这个右边的书籍标题和官方侧边目录生成的序号(theme-default:"showLevel": true) 是没有问题的。 而且 "associatedWithSummary": true 这个是默认值,只要配置 theme-default:"showLevel": true
左右的序号就能关联起来了
"anchor-navigation-ex": {
"associatedWithSummary": true
},
"theme-default": {
"showLevel": true
}
详细的配置在这里查看:https://github.com/zq99299/gitbook-plugin-anchor-navigation-ex/blob/master/doc/config.md
谢谢改正,不过现在还有个问题, 我把项目传到gitbook上进行了测试 发现这样时还是不行,似乎mode不生成目录时,就无法将自动生成的序号关联N级标题了,只有默认使用float(top没试)时可以关联 好像生成目录、关联序号两个功能耦合了
"anchor-navigation-ex":{
"associatedWithSummary": true
"mode": ""
},
"theme-default": {
"showLevel": true
}
测试代码:https://github.com/DrWeiZhou/gitbook 测试结果:https://www.gitbook.com/book/weizhou/gitbook/details
发现这样时还是不行,似乎mode不生成目录时,就无法将自动生成的序号关联N级标题了,只有默认使用float(top没试)时可以关联
v1.0.10 bug已修复
非常感谢解决了这个问题 不过看了一下gitbook生成的目录,发现按照中国论文的标法,其实前面的1.都是多余的,第一章就是1 如果作者以后有时间能实现下类似这个(https://plugins.gitbook.com/plugin/parts-autoindex,不能用!)的截断或者偏移之类的就amazing啦~ anyway,感谢作者的帮助~ 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.6 1.6.1 1.6.2 1.6.3 1.6.4 目录
multipleH1: false, 能解决页面内的1.x,但是左侧的序号是gitbook 生成的。只有期待gitbook能提供去掉这个1. 的序号
喔,好的,看来实现的思路不一样,我还以为是从gitbook生成的序号里面提取出序号然后加到H1-h6的呢,我看那个插件号称可以哈
是这样的,左侧的序号是从gitbook中生成的序号中提取出来的; 一个md页面内也是有一个序号生成的。 multipleH1: false, 能解决页面内1.x 的问题。但是和默认主题生成的序号相关联的时候,这gitbook生成的序号里面 有多余的1.x
好的,我以为是简单的字符串处理哈,谢谢啦
嗯。 不想处理这个问题。 处理后,页面内和左边的序号就对不上了。这个不是想要的。只有期待以后gitbook能提供配置去掉这个1.x的问题。
txs
使用版本显示1.0.7,无论是生成网页还是pdf,一级标题用于是1.开始而没有加入默认样式生成的编号。 奇怪的是官方默认样式为theme-fs(生效),配置说明上说为theme-default(不生效) book.json如下: