Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dangling anchor links with German Umlauts when used with vuepress #27

Closed
about-code opened this issue Sep 20, 2019 · 2 comments · Fixed by #31
Closed

Dangling anchor links with German Umlauts when used with vuepress #27

about-code opened this issue Sep 20, 2019 · 2 comments · Fixed by #31
Labels
enhancement New feature or request vuepress vuepress integration issues

Comments

@about-code
Copy link
Owner

about-code commented Sep 20, 2019

Reproduction

When using glossarify-md with vuepress a glossary term

## Der Tod und das Mädchen
Classic composition by Franz Schubert (The Death and the Maiden).

will be correctly found in text but the link in the text doesn't link to the glossary term.

@about-code about-code added the bug Something isn't working label Sep 20, 2019
@about-code about-code changed the title Dangling anchor links with German Umlauts Dangling anchor links with German Umlauts when used with vuepress Sep 21, 2019
@about-code
Copy link
Owner Author

about-code commented Sep 22, 2019

This is an issue with the Markdown-To-HTML translation of vuepress, or to be more precise with the slugify algorithm it uses. It will replace characters äöü with aou in HTML anchor names. So instead of

<a name="der-tod-und-das-mädchen">...</a>

it generates

<a name="der-tod-und-das-madchen">...</a>

This isn't really a bug with glossarify-md but affects any anchor names with unicode characters, no matter whether glossarify-md is used or not.

Solution: using the same slugifier with glossarify-md and vuepress

Vuepress allows to pass an external slugify function via option markdown.slugify. glossarify-md >=v1.1.2 will export a getSlugger() method. vuepress users can pass its return value to that option in their.vuepress/config.js.

This will affect how anchor names and URLs are constructed in general and will also modify vuepress' default behavior with regards to unicode characters in URLs or URL fragments (#fragment). Be aware of this if you have links in your documents where you previously "slugified" manually, e.g. by translating ä to a by hand when linking to a section header for example.

Also when removing glossarify-md any time later you may face some fragment refs no longer working. glossarify-md internally uses github-slugger. When removing glossarify-md you might want to use github-slugger directly to keep your links working. For more information on this issue and vuepress integration see https://github.com/about-code/glossarify-md/blob/master/doc/vuepress.md#configure-vuepress.

@about-code about-code added enhancement New feature or request and removed bug Something isn't working labels Sep 25, 2019
about-code added a commit that referenced this issue Sep 25, 2019
about-code added a commit that referenced this issue Sep 25, 2019
@about-code
Copy link
Owner Author

vuejs/vuepress#1815

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vuepress vuepress integration issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant