Skip to content

Commit

Permalink
Rollup merge of #117662 - GuillaumeGomez:links-in-headings, r=notriddle
Browse files Browse the repository at this point in the history
[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`
  • Loading branch information
matthiaskrgr authored Jan 19, 2024
2 parents 17abaea + 09f3868 commit d642021
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit d642021

Please sign in to comment.