Skip to content

Commit aad68b7

Browse files
committed
Raise heading levels.
1 parent 850504b commit aad68b7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/librustdoc/html/static/js/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,8 @@ function preLoadCss(cssUrl) {
10041004
return;
10051005
}
10061006

1007-
const allCratesHeading = document.createElement("h3");
1007+
// h2 puts this on the same level as the current crate name heading at the top
1008+
const allCratesHeading = document.createElement("h2");
10081009
allCratesHeading.textContent = "Crates";
10091010

10101011
const allCratesSection = document.createElement("section");
@@ -1029,7 +1030,7 @@ function preLoadCss(cssUrl) {
10291030
for (const headingText of headings) {
10301031
// Empty string denotes a group with no named heading.
10311032
if (headingText !== "") {
1032-
const crateCategoryHeading = document.createElement("h4");
1033+
const crateCategoryHeading = document.createElement("h3");
10331034
crateCategoryHeading.textContent = headingText;
10341035
allCratesSection.appendChild(crateCategoryHeading);
10351036
}

tests/rustdoc-gui/sidebar.goml

+3-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ call-function: ("switch-theme", {"theme": "light"})
4848
assert-text: (".sidebar > .sidebar-crate > h2 > a", "test_docs")
4949
// Crate root has no "location" element
5050
assert-count: (".sidebar .location", 0)
51-
assert-count: (".sidebar h2", 1)
51+
// Crate root has two h2s, the second of which is the the crate list
52+
assert-count: (".sidebar h2", 2)
53+
assert-text: (".sidebar #rustdoc-modnav h2", "Crates")
5254
assert-text: ("#all-types", "All Items")
5355
assert-css: ("#all-types", {"color": "#356da4"})
5456
// We check that we have the crates list and that the "current" on is "test_docs".

0 commit comments

Comments
 (0)