Skip to content

Make rustdoc method HTML anchor IDs/links unique (#20700) #21967

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

Closed
wants to merge 3 commits into from

Conversation

hinsley
Copy link
Contributor

@hinsley hinsley commented Feb 5, 2015

This pull request makes rustdoc's rendered method anchor IDs and links unique, so clicking on a particular method link will take you to that specific method description, and not the first similarly-named method description on the page, as is the current behavior.

The link anchors should now have a contextual prefix added to them, so each anchor is unique and refers only to the corresponding method.

This build was tested working under the most recent rust 1.0.0-nightly as of today.

Solves issue #20700.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cmr (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.

@hinsley hinsley changed the title Solve rustdoc issue #20700 Make rustdoc method HTML anchor IDs/links unique (#20700) Feb 5, 2015
@alexcrichton
Copy link
Member

Right now it's pretty nice to have short anchors like #method.fmt because you can manually type it in sometimes if you like. Would it be possible just keep a thread-local cache per-page of IDs generated? The markdown ID generation does this and just appends 1, 2, 3, ... to the end (which keeps the memorable aspect mostly)

@emberian emberian assigned alexcrichton and unassigned emberian Feb 9, 2015
@Manishearth
Copy link
Member

(needs rebase)

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants