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

[Bug report] The header anchor should stay outside of the heading tag #1363

Closed
Vasile-Peste opened this issue Jun 14, 2023 · 2 comments · Fixed by #1452
Closed

[Bug report] The header anchor should stay outside of the heading tag #1363

Vasile-Peste opened this issue Jun 14, 2023 · 2 comments · Fixed by #1452
Labels

Comments

@Vasile-Peste
Copy link

Vasile-Peste commented Jun 14, 2023

Description

The header anchors # are placed inside the heading tags (h1, h2, h3...).
This behaviour is not actually correct, since the heading tag should explicitly indicate the nature of the content as a title, and # shouldn't be part of it.

Screenshot 2023-06-15 at 00 29 02

Apart from the semantic issue, there is also a more problematic issue: crawlers, some social media crawlers may take the title from the h1 heading tag to create a post preview. This means that the preview title of the post will contain the "#" character.

This is an example of a VuePress post preview on LinkedIn

Screenshot 2023-06-15 at 00 34 02

To reproduce I have a live link
https://www.mida.org/posts/reactive-programming-in-financial-markets/

The website above is built with VuePress 1 but the issue persists also on VuePress 2.

Thank you,
Vasile

Reproduction

https://www.mida.org/posts/reactive-programming-in-financial-markets/

Used Package Manager

npm

System Info

Not relevant
@github-actions github-actions bot added the stale label Jun 30, 2023
@github-actions
Copy link

This issue is marked as stale because it has not had recent activity. Issues marked with stale will be closed if they have no activity within 7 days.

@meteorlxy
Copy link
Member

Yep, markdown-it-anchor has provided multiple solutions for that since v8.0.

We didn't update to use other methods to get better a11y yet. Contribution welcome

@meteorlxy meteorlxy added contribution welcome enhancement New feature or request and removed stale labels Jun 30, 2023
meteorlxy added a commit that referenced this issue Dec 12, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
#1452)

 BREAKING CHANGE: the default permalink function of markdown-it-anchor has been changed from `ariaHidden` to `headerLink` for better accessibility, which would be a potential breaking change for theme authors

---------

Co-authored-by: Xinyu Liu <meteor.lxy@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants