-
Notifications
You must be signed in to change notification settings - Fork 12.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
Support links in headings #94360
Support links in headings #94360
Conversation
… putting an anchor to their left side
Some changes occurred in HTML/CSS/JS. |
5f3f36f
to
3ee093f
Compare
This comment has been minimized.
This comment has been minimized.
3ee093f
to
038c3f8
Compare
This would be a new, stable feature, and honestly, I don't think we should support this. It's a niche feature and adds unnecessary UI complexity. |
Niche I don't know. However it's definitely part of the markdown spec which we're supposed to follow. The problem here is that we disregarded it. Since the anchor is now displayed all the time, the UI is actually simpler in my opinion (compared to before). |
I like the idea of supporting links in headers. It's good for interoperability, so you can use But I don't like a persistent, always-visible section link. #59840 is all about getting rid of this kind of clutter. In rough order of my own preferences:
|
The click target is then very small though.
Hmm, but then it's in a different position depending on how long the header is. |
I'd prefer to keep the anchor on the left too (because it's where it is for all other headings). A middle-ground could be to turn the |
I'm inclined to close this PR since it seems like more discussion is needed. What do you think? |
We don't have a tracking issue. Let's open one to continue the discussion there and then close this PR. |
Ok, I opened a tracking issue and summarized my understanding of the current state of this issue: #100254 |
Thanks! |
…r=notriddle [rustdoc] Allows links in headings Reopening of rust-lang#94360. # Explanations Rustdoc currently doesn't follow the markdown spec on headings: we don't allow links in them. So instead of having headings linking to themselves, this PR generates an anchor on the left side like this: ![image](https://github.com/rust-lang/rust/assets/3050060/a118a7e9-5ef8-4d07-914f-46defc3245c3) <details> <summary>previous version</summary> ![image](https://github.com/rust-lang/rust/assets/3050060/c34fa844-9cd4-47dc-bb51-b37f5f66afee) </details> Having the anchor always displayed allows for mobile devices users to be able to have a link to the anchor. The different color used for the anchor itself is the same as links so people notice when looking at it that they can click on it. You can test it [here](https://rustdoc.crud.net/imperio/links-in-headings/std/index.html). cc `@camelid` r? `@notriddle`
Rollup merge of rust-lang#117662 - GuillaumeGomez:links-in-headings, r=notriddle [rustdoc] Allows links in headings Reopening of rust-lang#94360. # Explanations Rustdoc currently doesn't follow the markdown spec on headings: we don't allow links in them. So instead of having headings linking to themselves, this PR generates an anchor on the left side like this: ![image](https://github.com/rust-lang/rust/assets/3050060/a118a7e9-5ef8-4d07-914f-46defc3245c3) <details> <summary>previous version</summary> ![image](https://github.com/rust-lang/rust/assets/3050060/c34fa844-9cd4-47dc-bb51-b37f5f66afee) </details> Having the anchor always displayed allows for mobile devices users to be able to have a link to the anchor. The different color used for the anchor itself is the same as links so people notice when looking at it that they can click on it. You can test it [here](https://rustdoc.crud.net/imperio/links-in-headings/std/index.html). cc `@camelid` r? `@notriddle`
[rustdoc] Allows links in headings Reopening of rust-lang/rust#94360. # Explanations Rustdoc currently doesn't follow the markdown spec on headings: we don't allow links in them. So instead of having headings linking to themselves, this PR generates an anchor on the left side like this: ![image](https://github.com/rust-lang/rust/assets/3050060/a118a7e9-5ef8-4d07-914f-46defc3245c3) <details> <summary>previous version</summary> ![image](https://github.com/rust-lang/rust/assets/3050060/c34fa844-9cd4-47dc-bb51-b37f5f66afee) </details> Having the anchor always displayed allows for mobile devices users to be able to have a link to the anchor. The different color used for the anchor itself is the same as links so people notice when looking at it that they can click on it. You can test it [here](https://rustdoc.crud.net/imperio/links-in-headings/std/index.html). cc `@camelid` r? `@notriddle`
Follow-up of #93808.
Thanks to @notriddle, I was reminded that you could have links in markdown headings, meaning that this change was very bad. So instead, I now show the anchor all the time (up to debate) and allow links in headings:
You can test it here.
r? @jsha