-
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
[rustdoc] Fix display of features #118677
Conversation
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
Would |
@@ -1100,11 +1094,9 @@ so that we can apply CSS-filters to change the arrow color in themes */ | |||
font-weight: normal; | |||
color: var(--main-color); | |||
background-color: var(--stab-background-color); | |||
width: fit-content; |
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.
Why? This seems to still work, even when it's display: block
.
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 wasn't in use said firefox, so I removed it.
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.
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.
Ah? Is the badge still taking the full width then?
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.
No it's not.
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.
Ah then we know why I changed it. :D
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.
Do you want the badge to take up the full width even when it isn't full?
Currently, it only takes up the width that it actually needs, which is what width: fit-content
is for. That's intentional, so that these badges are less prominent. Did you mean to change it?
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.
Oh you're right. No I didn't meant to change it. Might be worth doing it though but I'll open another PR for that. Let me revert this change.
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.
Thanks!
I don’t mean to be a pain, but can you also add in the line-height: 36px
? With that, the changes should be very minimal other than fixing the bug.
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.
No don't worry. Just curious about the why. It looks very bad with it. Even more when there are no emoji.
I explained my reasoning here:
|
42989b7
to
075fbae
Compare
I reverted the unwanted width change. I think it's worth considering it but let's do that in another PR. |
*/ | ||
min-height: 36px; | ||
display: flex; | ||
display: block; | ||
padding: 3px; |
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.
Oh, I see why it looks different. Try this.
padding: 3px; | |
padding: 0 3px; | |
line-height: 36px; |
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.
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.
Yeah, that is more line spacing than I'd like. Here's one more attempt to get a decent rendering (where ones with both emoji and non-emoji have the same height, but there's not excessive line spacing).
.item-info .stab {
display:block;
padding:3px;
margin-bottom:5px;
}
.item-name .stab {
margin-left:0.3125em;
}
.stab {
padding:0 2px;
font-size:0.875rem;
font-weight:normal;
color:var(--main-color);
background-color:var(--stab-background-color);
width:fit-content;
white-space:pre-wrap;
border-radius:3px;
display:inline;
vertical-align:baseline;
}
.stab.portability>code {
background:none;
color:var(--stab-code-color);
}
.stab .emoji, .item-info .stab::before {
font-size:1.25rem;
}
.stab .emoji {
margin-right:0.3rem;
}
.item-info .stab::before {
/* ensure badges with emoji and without it have same height */
content: "\0";
width: 0;
display: inline-block;
color: transparent;
}
.emoji {
text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;
}
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.
Wow. That's quite impressive, congrats! I updated as suggested. :)
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.
Can you update the big screenshot at the top, too?
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.
Done!
28230fb
to
5d689dc
Compare
|
||
/* Black one-pixel outline around emoji shapes */ |
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.
Probably shouldn't remove this comment.
.stab.portability > code { | ||
.stab.portability>code { |
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.
Probably shouldn't change the formatting here.
5d689dc
to
535d7d7
Compare
535d7d7
to
9e1797b
Compare
Updated! |
@bors r+ rollup |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#118505 (Elaborate on ip_addr bit conversion endianness) - rust-lang#118581 (OnceLock: Add note about drop and statics) - rust-lang#118677 ([rustdoc] Fix display of features) - rust-lang#118690 (coverage: Avoid unnecessary macros in unit tests) - rust-lang#118693 (Tell MirUsedCollector that the pointer alignment checks calls its panic symbol) - rust-lang#118695 (coverage: Merge refined spans in a separate final pass) - rust-lang#118709 (fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before use) - rust-lang#118722 (rustdoc: remove unused parameter `reversed` from onEach(Lazy)) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#118677 - GuillaumeGomez:doc_cfg-display, r=notriddle [rustdoc] Fix display of features Fixes rust-lang#118615. It now looks like this: ![image](https://github.com/rust-lang/rust/assets/3050060/6e77204e-0706-44a3-89ae-2dbd1934ebbc) We can't use flex without breaking the flow, meaning we can't vertically align items as we want. Because of that, the `min-height` was problematic as it rendered weirdly and therefore needed to be removed. r? `@notriddle`
Fixes #118615.
It now looks like this:
We can't use flex without breaking the flow, meaning we can't vertically align items as we want. Because of that, the
min-height
was problematic as it rendered weirdly and therefore needed to be removed.r? @notriddle