Skip to content

Commit d20c74a

Browse files
Rollup merge of rust-lang#84283 - jsha:de-emphasize-attributes, r=GuillaumeGomez
rustdoc: Reduce visual weight of attributes. Followup from rust-lang#83337. As part of that PR, we stopped hiding attributes behind a toggle, because most things have just zero or one attributes. However, this made clear that the current rendering of attributes emphasizes them a lot, which distracts from function signatures. This PR changes their color of attributes to be the same as the toggles, and reduces their font weight. This also removes `#[lang]` from the list of ALLOWED_ATTRIBUTES. This attribute is an implementation detail rather than part of the public-facing documentation. ![image](https://user-images.githubusercontent.com/220205/115131061-cc407d80-9fa9-11eb-9a77-ad3f3217f391.png) Demo at https://hoffman-andrews.com/rust/de-emph-attr/std/string/struct.String.html#method.trim
2 parents 40ccb63 + e23b035 commit d20c74a

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,6 @@ fn render_assoc_item(
989989

990990
const ALLOWED_ATTRIBUTES: &[Symbol] = &[
991991
sym::export_name,
992-
sym::lang,
993992
sym::link_section,
994993
sym::must_use,
995994
sym::no_mangle,

src/librustdoc/html/static/rustdoc.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,10 @@ a.test-arrow:hover{
969969
color: inherit;
970970
}
971971

972+
.code-attribute {
973+
font-weight: 300;
974+
}
975+
972976
.collapse-toggle {
973977
font-weight: 300;
974978
position: absolute;

src/librustdoc/html/static/themes/ayu.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ a.test-arrow:hover {
330330
color: #c5c5c5;
331331
}
332332

333-
.toggle-label {
333+
.toggle-label,
334+
.code-attribute {
334335
color: #999;
335336
}
336337

src/librustdoc/html/static/themes/dark.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ a.test-arrow:hover{
275275
background-color: #4e8bca;
276276
}
277277

278-
.toggle-label {
278+
.toggle-label,
279+
.code-attribute {
279280
color: #999;
280281
}
281282

src/librustdoc/html/static/themes/light.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ a.test-arrow:hover{
268268
background-color: #4e8bca;
269269
}
270270

271-
.toggle-label {
271+
.toggle-label,
272+
.code-attribute {
272273
color: #999;
273274
}
274275

0 commit comments

Comments
 (0)