vuepress / docs

VuePress Documentation
https://vuepress.vuejs.org
MIT License
23 stars 89 forks source link

[Bug report] Anchors for #### cannot be linked to #1

Open KnorpelSenf opened 2 years ago

KnorpelSenf commented 2 years ago

Description

Headers with 4 indents (#### Name) cannot be linked to by clicking the header anchor. This will scroll to the right position on mobile, but the URL will be set to the parent anchor. Links to the sections work, but once they're opened, they will be rewritten to the parent anchor.

Reproduction

https://grammy.dev/plugins/keyboard.html#example-1

Used Package Manager

npm

System Info

# This command fails
$ npx vuepress info
⠋ Collecting Environment InfoTypeError: envinfo.run is not a function
    at info (file:///home/steffen/git/grammy-website/site/node_modules/@vuepress/cli/dist/index.js:525:32)
    at CAC.wrappedCommand (file:///home/steffen/git/grammy-website/site/node_modules/@vuepress/cli/dist/index.js:584:39)
    at CAC.runMatchedCommand (file:///home/steffen/git/grammy-website/site/node_modules/cac/dist/index.mjs:610:34)
    at CAC.parse (file:///home/steffen/git/grammy-website/site/node_modules/cac/dist/index.mjs:537:12)
    at cli (file:///home/steffen/git/grammy-website/site/node_modules/@vuepress/cli/dist/index.js:602:11)
    at file:///home/steffen/git/grammy-website/site/node_modules/vuepress-vite/bin/vuepress.js:8:1
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)

# so here are my deps
$ cat package.json | jq '.devDependencies'
{
  "@vuepress/plugin-docsearch": "^2.0.0-beta.51",
  "deno-bin": ">=1.25.2",
  "static-sitemap-cli": "^2.1.2",
  "vuepress-vite": "^2.0.0-beta.51"
}

# and here is my system info:
$ uname -smv && node -v && npm -v
Linux vuepress/vuepress-next#1 SMP Debian 5.10.136-1 (2022-08-13) x86_64
v17.3.0
8.12.1
Mister-Hope commented 2 years ago

I do think that's expected, because they are not in header list.

By default vuepress only extract level 2 and level 3 headers, but we give you ability to extract more level. If you extract level 4, then you will get the result which you are expecting.

KnorpelSenf commented 2 years ago

Is there a configuration option about that which I'm not aware of?

Mister-Hope commented 1 year ago

Yes image

Mister-Hope commented 1 year ago

@meteorlxy cc, I do think that adding a note here is pretty bad, we'd better make some descriptions in markdown.headers and markdown.toc