Menu links not displaying router-link-active
See original GitHub issue- I confirm that this is an issue rather than a question.
Bug report
When using letters like Æ, Ø, Å in the menu text and menu links, the header active bottom border will not display. When using normal english characters in the text and links it works how it’s supposed to.
Steps to reproduce
Use letters like Æ, Ø or Å in the nav menu text.
What is expected?
The border-bottom router-link-active should display normally with the Æ, Ø, Å letters just like it does with normal text characters.
What is actually happening?
The router-link-active (bottom border) isn’t displaying when using weird characters.
Other relevant information
- Output of
npx vuepress info
in my VuePress project:
Environment Info:
System: OS: Linux 5.2 Arch Linux undefined CPU: (8) x64 Intel® Core™ i7-4770K CPU @ 3.50GHz Binaries: Node: 11.15.0 - /usr/bin/node Yarn: 1.17.3 - /usr/bin/yarn npm: 6.10.2 - /usr/bin/npm Browsers: Chrome: Not Found Firefox: 68.0.1 npmPackages: @vuepress/core: Not Found @vuepress/theme-default: Not Found vuepress: Not Found npmGlobalPackages: vuepress: 1.0.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
Found a nice workaround for now @Mbensler .
You can use permalinks in your frontmatter. For example in your README.md:
This would put the permalink as the matcher for the url and it will become active. Unfortunatly only for exact matches so you will need to add it to every sub readme file:
I’ve found the issue and the fix. The issue is related to
./package/@vuepress/core/lib/node/Page.js
. All scanned filepaths are ‘fixed’ withencodeURI
meaning the special chars get converted to their encoded form. This doesnt happen with the link’s uri, that’s why it does show the correct file, but its not matching it for the link to make it an active state.Here’s a snippet of that code:
It could ofcourse be fixed by removing the encodeURI. However, there is a test explicitly checking if the paths are properly encoded, meaning that this might break existing dependants.
@ulivz To you have an idea of the impact that this change would bring? If it does have a breaking impact, I might add a PR with some config approach to make exceptions.