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

Link sidebar "location" heading to top of page #92795

Merged
merged 1 commit into from
Jan 17, 2022
Merged

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Jan 11, 2022

This makes it easy, when you are scrolled far down in a page, to jump back to the top.

Demo: https://rustdoc.crud.net/jsha/link-to-top/std/string/struct.String.html

r? @GuillaumeGomez

@jsha jsha added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Jan 11, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez,@Folyd

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 11, 2022
@rust-log-analyzer

This comment has been minimized.

@jsha jsha force-pushed the link-to-top branch 2 times, most recently from c01a36f to a75d0b2 Compare January 11, 2022 23:40
@@ -66,6 +66,7 @@
{{- layout.external_html.in_header | safe -}}
</head> {#- -#}
<body class="rustdoc {{page.css_class}}"> {#- -#}
<a id="top"></a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since #92043 hasn't been merged yet, please add this ID in the ID map. ;)

@GuillaumeGomez
Copy link
Member

I think adding a rustdoc test to ensure that the "location" element is a link would be a good idea too.

@bors
Copy link
Contributor

bors commented Jan 13, 2022

☔ The latest upstream changes (presumably #92526) made this pull request unmergeable. Please resolve the merge conflicts.

This makes it easy, when you are scrolled far down in a page, to jump
back to the top.
@jsha
Copy link
Contributor Author

jsha commented Jan 14, 2022

It turns out # or #top are defined to link to the top of the page, even without an id! Simplified the PR.

@GuillaumeGomez
Copy link
Member

It turns out # or #top are defined to link to the top of the page, even without an id! Simplified the PR.

I didn't know that, thanks for the new knowledge! :)

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jan 15, 2022

📌 Commit 7781636 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 17, 2022
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#92795 (Link sidebar "location" heading to top of page)
 - rust-lang#92799 (Remove some unnecessary uses of `FieldDef::ident`)
 - rust-lang#92808 (Fix `try wrapping expression in variant` suggestion with struct field shorthand)
 - rust-lang#92819 (rustdoc: remove hand-rolled isatty)
 - rust-lang#92876 (Fix suggesting turbofish with lifetime arguments)
 - rust-lang#92921 (Rename Printer constructor from mk_printer() to Printer::new())
 - rust-lang#92937 (rustdoc: Add missing dot separator)
 - rust-lang#92953 (Copy an example to PartialOrd as well)
 - rust-lang#92977 (Docs: recommend VecDeque instead of Vec::remove(0))
 - rust-lang#92981 (fix const_ptr_offset_from tracking issue)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 869b7bc into rust-lang:master Jan 17, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants