core icon indicating copy to clipboard operation
core copied to clipboard

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

Open KnorpelSenf opened this issue 3 years ago • 4 comments

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 #1 SMP Debian 5.10.136-1 (2022-08-13) x86_64
v17.3.0
8.12.1

KnorpelSenf avatar Sep 12 '22 08:09 KnorpelSenf

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.

Mister-Hope avatar Sep 12 '22 16:09 Mister-Hope

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

KnorpelSenf avatar Sep 12 '22 20:09 KnorpelSenf

Yes image

Mister-Hope avatar Sep 23 '22 07:09 Mister-Hope

@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

Mister-Hope avatar Sep 23 '22 07:09 Mister-Hope