Skip to content

Commit 1fb61ec

Browse files
jyn514Joshua Nelson
authored and
Joshua Nelson
committed
Fix rustdoc styles for very old docs
Previously this used the selector link[type='text/css'][href*='normalize'] to inject the vendored HTML. Unfortunately, this selector did not exist in very old versions of rustdoc. Instead, this now adds the vendored.css stylesheet just before rustdoc.css.
1 parent 03e9ae9 commit 1fb61ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils/html.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ pub(crate) fn rewrite_lol(
6464
Ok(())
6565
};
6666

67-
// Append `vendored.css` before the first stylesheet (rustdoc's first stylesheet is `normalize.css`).
67+
// Append `vendored.css` before `rustdoc.css`, so that the duplicate copy of
68+
// `normalize.css` will be overridden by the later version.
6869
let first_stylesheet_handler = |head: &mut Element| {
6970
head.before(&tera_vendored_css, ContentType::Html);
7071

@@ -74,7 +75,7 @@ pub(crate) fn rewrite_lol(
7475
let (head_selector, body_selector, first_stylesheet_selector) = (
7576
"head".parse().unwrap(),
7677
"body".parse().unwrap(),
77-
"link[type='text/css'][href*='normalize']".parse().unwrap(),
78+
"link[type='text/css'][href*='rustdoc']".parse().unwrap(),
7879
);
7980
let element_content_handlers = vec![
8081
(

0 commit comments

Comments
 (0)