-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
…tation page * Rename "type-decl" into "item-decl" to reflect the change of usage
Some changes occurred in HTML/CSS/JS. |
@@ -549,6 +552,7 @@ nav.sub { | |||
flex-grow: 1; | |||
margin: 0px; | |||
padding: 0px; | |||
overflow-wrap: anywhere; |
There was a problem hiding this comment.
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.
overflow-wrap: anywhere; | |
overflow-wrap: break-word; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. ;)
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. :)
This looks good to me. I think we should change the styles so 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. |
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 |
📌 Commit 77c2929 has been approved by |
… 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`
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
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 intoitem-decl
(because this PR also generates it for more than type declarations).So here are the before/after screenshots:
r? @jsha