zq99299 / gitbook-plugin-anchor-navigation-ex

Supports two navigation mode, title, anchor effect is the default theme, style, follow the website
https://zq99299.gitbooks.io/gitbook-guide/content/chapter/plugin.html
Other
127 stars 39 forks source link

associatedWithSummary: true属性无效 #26

Closed DrWeiZhou closed 7 years ago

DrWeiZhou commented 7 years ago

使用版本显示1.0.7,无论是生成网页还是pdf,一级标题用于是1.开始而没有加入默认样式生成的编号。 奇怪的是官方默认样式为theme-fs(生效),配置说明上说为theme-default(不生效) book.json如下:

{
    "title" : "RPMManual",
    "description" : "RPM MANUAL",
    "author" : "Zhou Wei",
    "generator": "site",
    "language" : "zh-hans",
    "gitbook" : "3.2.2",
    "links" : {
        "sidebar" : {
            "说明书主页" : "/gitbook/intro"
        }
    },
   "plugins": [
    "anchor-navigation-ex",
      "-lunr",
        "search-jieba",
    "-highlight",
    "prism",
        "advanced-emoji@0.1.5",
        "emphasize",
        "katex",
        "anchors",
        "include-codeblock",
    "ace",
        "mermaid",

        "sectionx",
        "expandable-chapters",
        "codeblock-filename",
        "local-video",
    "splitter",
    "duoshuo",
    "baidu",
    "donate",
    "anchors",

    "image-captions"
    ],
    "pluginsConfig": {
        "duoshuo": {
            "short_name": "weigitbooktest",
            "theme": "default"
        },
        "github": {
            "url": "https://github.com/zhangjikai/gitbook-use"
        },
        "sharing": {
            "weibo": true,
            "facebook": true,
            "twitter": true,
            "google": false,
            "instapaper": false,
             "vk": false,
            "all": [
                "facebook", "google", "twitter",
                "weibo", "instapaper"
            ]
        },
        "tbfed-pagefooter": {
            "copyright":"Copyright &copy 周炜 2016-2017",
            "modify_label": "该文件修订时间:",
            "modify_format": "YYYY-MM-DD HH:mm:ss"
        },
        "sitemap": {
            "hostname": "http://www.baidu.com"
        },
    "baidu": {
            "token" : "a3f08983487a96aa9943fa1394254a16"
        },
    "donate": {
          "wechat": "http://weizhou.coding.me/git/images/ZhouWeiWechatPay.png",
          "alipay": "http://weizhou.coding.me/git/images/ZhouWeiAlipay.png",
          "title": "",
          "button": "赏",
          "alipayText": "支付宝打赏",
          "wechatText": "微信打赏"
        },

    "anchor-navigation-ex":{
            "associatedWithSummary":true,
           "showLevel":true
        },
        "theme-fs": {
                        "showLevel": true
                    },
        "theme-default": {
                          "showLevel": true
                      },
    "image-captions": {
          "caption": "Image _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_"
        },
    "prism": {
            "css": [
            "prismjs/themes/prism-coy.css"
        ]
  }
    }
}
zq99299 commented 7 years ago

好的,你这么晚还不睡觉啊,吧你的gitbook的书籍地址发给我下,明天上班,我确认下这个配置,今天太晚了

DrWeiZhou commented 7 years ago

感谢你的回复,你也睡很晚啊 我把代码放在

https://github.com/DrWeiZhou/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"
}
zq99299 commented 7 years ago

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

DrWeiZhou commented 7 years ago

谢谢改正,不过现在还有个问题, 我把项目传到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

zq99299 commented 7 years ago

发现这样时还是不行,似乎mode不生成目录时,就无法将自动生成的序号关联N级标题了,只有默认使用float(top没试)时可以关联

v1.0.10 bug已修复

DrWeiZhou commented 7 years ago

非常感谢解决了这个问题 不过看了一下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 目录

zq99299 commented 7 years ago

multipleH1: false, 能解决页面内的1.x,但是左侧的序号是gitbook 生成的。只有期待gitbook能提供去掉这个1. 的序号

DrWeiZhou commented 7 years ago

喔,好的,看来实现的思路不一样,我还以为是从gitbook生成的序号里面提取出序号然后加到H1-h6的呢,我看那个插件号称可以哈

zq99299 commented 7 years ago

是这样的,左侧的序号是从gitbook中生成的序号中提取出来的; 一个md页面内也是有一个序号生成的。 multipleH1: false, 能解决页面内1.x 的问题。但是和默认主题生成的序号相关联的时候,这gitbook生成的序号里面 有多余的1.x

DrWeiZhou commented 7 years ago

好的,我以为是简单的字符串处理哈,谢谢啦

zq99299 commented 7 years ago

嗯。 不想处理这个问题。 处理后,页面内和左边的序号就对不上了。这个不是想要的。只有期待以后gitbook能提供配置去掉这个1.x的问题。

DrWeiZhou commented 7 years ago

txs