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

[rustdoc] Fix display of features #118677

Merged
merged 2 commits into from
Dec 8, 2023
Merged

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Dec 6, 2023

Fixes #118615.

It now looks like this:

image

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 6, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 6, 2023

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha

@notriddle
Copy link
Contributor

Would line-height: 36px fix the uneven height of these elements, or does it mess up something else?

@GuillaumeGomez
Copy link
Member Author

With line-height: 36px;:

image

@notriddle
Copy link
Contributor

notriddle commented Dec 6, 2023

Right, but the point of me asking is that the ones with the 👎 should be the same height as the ones without any emoji in them, as well as items like this:

image

@@ -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;
Copy link
Contributor

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.

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 wasn't in use said firefox, so I removed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Weird. I'm not seeing this when I try it.

image

Copy link
Member Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

No it's not.

Copy link
Member Author

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

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

@GuillaumeGomez
Copy link
Member Author

Right, but the point of me asking is that the ones with the 👎 should be the same height as the ones without any emoji in them, as well as items like this:

image

I explained my reasoning here:

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.

@GuillaumeGomez
Copy link
Member Author

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;
Copy link
Contributor

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.

Suggested change
padding: 3px;
padding: 0 3px;
line-height: 36px;

Copy link
Member Author

Choose a reason for hiding this comment

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

Still looks bad when there is more than one line:

image

Copy link
Contributor

@notriddle notriddle Dec 6, 2023

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;
}

image

Copy link
Member Author

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. :)

Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@GuillaumeGomez GuillaumeGomez force-pushed the doc_cfg-display branch 2 times, most recently from 28230fb to 5d689dc Compare December 6, 2023 23:22
Comment on lines 1119 to 1120

/* Black one-pixel outline around emoji shapes */
Copy link
Contributor

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.

Comment on lines 1110 to 1103
.stab.portability > code {
.stab.portability>code {
Copy link
Contributor

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.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 6, 2023
@GuillaumeGomez
Copy link
Member Author

Updated!

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 8, 2023

📌 Commit 9e1797b has been approved by notriddle

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 8, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2023
…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
@bors bors merged commit fa724cc into rust-lang:master Dec 8, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 8, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2023
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`
@GuillaumeGomez GuillaumeGomez deleted the doc_cfg-display branch August 19, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

doc_auto_cfg formatting is not that great
4 participants