Skip to content

Commit 302f3dc

Browse files
authored
Rollup merge of #85972 - GuillaumeGomez:rustdoc-html-fixes, r=jsha
Rustdoc html fixes #84480 latest update allowed me to fix the remaining issues. The last one is coming from `pulldown-cmark` so I'll send them a fix soon. r? ``@jsha``
2 parents f923f73 + e078e56 commit 302f3dc

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/librustdoc/html/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ crate fn render<T: Print, S: Print>(
105105
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
106106
type=\"search\">\
107107
</div>\
108-
<button type=\"button\" id=\"help-button\" title=\"help\">?</button>
108+
<button type=\"button\" id=\"help-button\" title=\"help\">?</button>\
109109
<a id=\"settings-menu\" href=\"{root_path}settings.html\" title=\"settings\">\
110110
<img src=\"{static_root_path}wheel{suffix}.svg\" \
111111
width=\"18\" height=\"18\" \
@@ -161,7 +161,7 @@ crate fn render<T: Print, S: Print>(
161161
}
162162
},
163163
title = page.title,
164-
description = page.description,
164+
description = Escape(page.description),
165165
keywords = page.keywords,
166166
favicon = if layout.favicon.is_empty() {
167167
format!(

src/librustdoc/html/render/mod.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,13 @@ impl AllTypes {
322322
if !e.is_empty() {
323323
let mut e: Vec<&ItemEntry> = e.iter().collect();
324324
e.sort();
325-
write!(f, "<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">", title, title, class);
325+
write!(
326+
f,
327+
"<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">",
328+
title.replace(' ', "-"), // IDs cannot contain whitespaces.
329+
title,
330+
class
331+
);
326332

327333
for s in e.iter() {
328334
write!(f, "<li>{}</li>", s.print());
@@ -346,7 +352,7 @@ impl AllTypes {
346352
</h1>",
347353
);
348354
// Note: print_entries does not escape the title, because we know the current set of titles
349-
// don't require escaping.
355+
// doesn't require escaping.
350356
print_entries(f, &self.structs, "Structs", "structs");
351357
print_entries(f, &self.enums, "Enums", "enums");
352358
print_entries(f, &self.unions, "Unions", "unions");

0 commit comments

Comments
 (0)