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

Fix rustdoc UI for very long type names #90018

Merged
merged 4 commits into from
Oct 20, 2021

Conversation

GuillaumeGomez
Copy link
Member

Fixes #89972.

While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page.

To make things right, I also renamed the type-decl CSS class into item-decl (because this PR also generates it for more than type declarations).

So here are the before/after screenshots:

Screenshot from 2021-10-18 16-58-03
Screenshot from 2021-10-18 16-58-26

Screenshot from 2021-10-18 16-58-07
Screenshot from 2021-10-18 16-58-28

r? @jsha

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2021
@@ -549,6 +552,7 @@ nav.sub {
flex-grow: 1;
margin: 0px;
padding: 0px;
overflow-wrap: anywhere;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want this to break at natural word breaks when possible.

Suggested change
overflow-wrap: anywhere;
overflow-wrap: break-word;

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this can be used to avoid adding more elements?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unless I'm missing something, idents are not composed of words. ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you put this property around foo::ReallyLongName?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or the entire line Constant foo::Name?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mentioned in #89618 (comment) that break-word doesn't actually change the behavior of preferring to break at word boundaries. Instead, "this means that the content will take all soft-wrapping opportunities, becoming as small as the longest word." In that PR we concluded anywhere was better, and I think that's true here too.

The added elements you're talking about - is the issue that we're things in a docblock that we weren't previously?

Also, does using the term "docblock" here really fit? I thought a docblock was for a chunk of rendered markdown supplied by the doc author.

Copy link
Member Author

Choose a reason for hiding this comment

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

It includes doc provided by the author too. :)

@camelid camelid changed the title Too long item names Fix rustdoc UI for very long type names Oct 18, 2021
@camelid camelid added A-rustdoc-ui Area: rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 18, 2021
@jsha
Copy link
Contributor

jsha commented Oct 19, 2021

This looks good to me. I think we should change the styles so docblock only means "words written by doc author," but that doesn't need to be in this PR.

Do you want to squash or edit any of these commits? I notice one has a wrapped line and an asterisk. r=me once that's done.

@GuillaumeGomez
Copy link
Member Author

I kept the commits separated on purpose because they are each doing different things. So if you don't mind, I'd prefer to keep them as is. :)

@bors: r=jsha rollup

@bors
Copy link
Contributor

bors commented Oct 19, 2021

📌 Commit 77c2929 has been approved by jsha

@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 Oct 19, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 19, 2021
… r=jsha

Fix rustdoc UI for very long type names

Fixes rust-lang#89972.

While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page.

To make things right, I also renamed the `type-decl` CSS class into `item-decl` (because this PR also generates it for more than type declarations).

So here are the before/after screenshots:

![Screenshot from 2021-10-18 16-58-03](https://user-images.githubusercontent.com/3050060/137757247-637fcf04-4406-49c6-8a8a-18c2074aacd9.png)
![Screenshot from 2021-10-18 16-58-26](https://user-images.githubusercontent.com/3050060/137757252-17935e63-53b3-449f-a535-7be91ff0e257.png)

![Screenshot from 2021-10-18 16-58-07](https://user-images.githubusercontent.com/3050060/137757278-8b12e348-2980-4fc4-8853-bef99d58981f.png)
![Screenshot from 2021-10-18 16-58-28](https://user-images.githubusercontent.com/3050060/137757282-534a0e1b-3016-49ba-b3ac-e45bdb9035cb.png)

r? `@jsha`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 19, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#86479 (Automatic exponential formatting in Debug)
 - rust-lang#87404 (Add support for artifact size profiling)
 - rust-lang#87769 (Alloc features cleanup)
 - rust-lang#88789 (remove unnecessary bound on Zip specialization impl)
 - rust-lang#88860 (Deduplicate panic_fmt)
 - rust-lang#90009 (Make more `From` impls `const` (libcore))
 - rust-lang#90018 (Fix rustdoc UI for very long type names)
 - rust-lang#90025 (Revert rust-lang#86011 to fix an incorrect bound check)
 - rust-lang#90036 (Remove border-bottom from most docblocks.)
 - rust-lang#90060 (Update RELEASES.md)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ceab9e into rust-lang:master Oct 20, 2021
@rustbot rustbot added this to the 1.58.0 milestone Oct 20, 2021
@GuillaumeGomez GuillaumeGomez deleted the too-long-item-names branch October 20, 2021 08:05
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.

rustdoc: long type aliases overflow grey box at top of screen
7 participants