Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 76a3b60

Browse files
committedJul 25, 2021
Rustdoc accessibility: use real headers for doc items
Part of rust-lang#87059 Partially reverts rust-lang#84703 Preview at: https://notriddle.com/notriddle-rustdoc-test/real-headers/std/index.html
1 parent e742158 commit 76a3b60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+231
-218
lines changed
 

‎src/librustdoc/html/render/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ fn notable_traits_decl(decl: &clean::FnDecl, cx: &Context<'_>) -> String {
11941194
if out.is_empty() {
11951195
write!(
11961196
&mut out,
1197-
"<h3 class=\"notable\">Notable traits for {}</h3>\
1197+
"<div class=\"notable\">Notable traits for {}</div>\
11981198
<code class=\"content\">",
11991199
impl_.for_.print(cx)
12001200
);
@@ -1350,15 +1350,15 @@ fn render_impl(
13501350
);
13511351
render_rightside(w, cx, item, containing_item);
13521352
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
1353-
w.write_str("<code>");
1353+
w.write_str("<h4 class=\"code-header\">");
13541354
render_assoc_item(
13551355
w,
13561356
item,
13571357
link.anchor(source_id.as_ref().unwrap_or(&id)),
13581358
ItemType::Impl,
13591359
cx,
13601360
);
1361-
w.write_str("</code>");
1361+
w.write_str("</h4>");
13621362
w.write_str("</div>");
13631363
}
13641364
}
@@ -1371,7 +1371,7 @@ fn render_impl(
13711371
id, item_type, in_trait_class
13721372
);
13731373
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
1374-
w.write_str("<code>");
1374+
w.write_str("<h4 class=\"code-header\">");
13751375
assoc_type(
13761376
w,
13771377
item,
@@ -1381,7 +1381,7 @@ fn render_impl(
13811381
"",
13821382
cx,
13831383
);
1384-
w.write_str("</code>");
1384+
w.write_str("</h4>");
13851385
w.write_str("</div>");
13861386
}
13871387
clean::AssocConstItem(ref ty, ref default) => {
@@ -1394,7 +1394,7 @@ fn render_impl(
13941394
);
13951395
render_rightside(w, cx, item, containing_item);
13961396
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
1397-
w.write_str("<code>");
1397+
w.write_str("<h4 class=\"code-header\">");
13981398
assoc_const(
13991399
w,
14001400
item,
@@ -1404,15 +1404,15 @@ fn render_impl(
14041404
"",
14051405
cx,
14061406
);
1407-
w.write_str("</code>");
1407+
w.write_str("</h4>");
14081408
w.write_str("</div>");
14091409
}
14101410
clean::AssocTypeItem(ref bounds, ref default) => {
14111411
let source_id = format!("{}.{}", item_type, name);
14121412
let id = cx.derive_id(source_id.clone());
14131413
write!(w, "<div id=\"{}\" class=\"{}{}\">", id, item_type, in_trait_class,);
14141414
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
1415-
w.write_str("<code>");
1415+
w.write_str("<h4 class=\"code-header\">");
14161416
assoc_type(
14171417
w,
14181418
item,
@@ -1422,7 +1422,7 @@ fn render_impl(
14221422
"",
14231423
cx,
14241424
);
1425-
w.write_str("</code>");
1425+
w.write_str("</h4>");
14261426
w.write_str("</div>");
14271427
}
14281428
clean::StrippedItem(..) => return,
@@ -1613,7 +1613,7 @@ pub(crate) fn render_impl_summary(
16131613
write!(w, "<div id=\"{}\" class=\"impl has-srclink\"{}>", id, aliases);
16141614
render_rightside(w, cx, &i.impl_item, containing_item);
16151615
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
1616-
write!(w, "<code class=\"in-band\">");
1616+
write!(w, "<h3 class=\"code-header in-band\">");
16171617

16181618
if let Some(use_absolute) = use_absolute {
16191619
write!(w, "{}", i.inner_impl().print(use_absolute, cx));
@@ -1629,7 +1629,7 @@ pub(crate) fn render_impl_summary(
16291629
} else {
16301630
write!(w, "{}", i.inner_impl().print(false, cx));
16311631
}
1632-
write!(w, "</code>");
1632+
write!(w, "</h3>");
16331633

16341634
let is_trait = i.inner_impl().trait_.is_some();
16351635
if is_trait {

‎src/librustdoc/html/render/print_item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,9 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
621621
render_stability_since(w, m, t, cx.tcx());
622622
write_srclink(cx, m, w);
623623
write!(w, "</div>");
624-
write!(w, "<code>");
624+
write!(w, "<h4 class=\"code-header\">");
625625
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
626-
w.write_str("</code>");
626+
w.write_str("</h4>");
627627
w.write_str("</div>");
628628
if toggled {
629629
write!(w, "</summary>");

0 commit comments

Comments
 (0)
Please sign in to comment.