-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix(v2): unify anchor behavior #2162
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 6bd6d35 |
@yangshun friendly ping |
Anybody here? 😃 |
@lex111 I just tried deeplinking against the preview using https://deploy-preview-2162--docusaurus-2.netlify.com/docs/cli/#docusaurus-swizzle and must say that I would prefer to see the anchor text/title, looking only at the text below it makes me (always) scroll up a little to see if things went well. I also noticed that the Header component does not add anchors which is probably a separate request but very useful for autogenerated pages that ref the H1 anchor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this preserve functionality for sites without the hideable navbar?
It is strange, there shouldn’t be one, header should be hidden when following the link with anchor. I changed something, so try again.
Ah, yeah, did it. ✔️ |
@lex111 thanks for the quick action. The deeplink now opens as expected 💃 |
Can you confirm that the H1 element on the docs pages are indeed missing anchors? I understand that this is probably a separate issue but I would like confirmation before I create a ticket. |
@bravo-kernel h1 elements do not contain an anchor, and why is it needed? These headers are at the very top of the page, so there is no point in the anchors, right? |
If we use This is useful/required for e.g. pages that autogenerate documentation like jsdoc. They create references/links to the main class and that link points to the H1 anchor (liike it would also do in e.g. github md view). I think it would be best if markdown H1 and Heading would produce the same consistent and predictable behavior. |
No big thing btw, just wanted to share the finding, I can work around it for jsdoc |
@lex111 I read more about the H1 anchor and agree with your statement; the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👏 |
Motivation
First of all, remove large margin on all screens (see test plan) when following a link from anchor. Further, when you open the referenced link in the browser, the header is automatically hidden, similarly when switching to another anchor on this page.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Prerequisite: open link with anchor, eg https://v2.docusaurus.io/docs/installation#project-structure