Docs.rs: Monospace fonts are broken again

Created on 22 Aug 2020  路  12Comments  路  Source: rust-lang/docs.rs

Mostly likely by #981.

https://docs.rs/pulldown-cmark/0.7.2/pulldown_cmark/struct.Parser.html#method.new_with_broken_link_callback
Before: image
Currently (but system-dependent): image

The culprit is style.css, which, now that all CSS is in one file, is not particularly helpful.

code, kbd, pre, samp {
    font-family: monospace,monospace;
    font-size: 1em;
}

cc @Kixiron

A-frontend C-bug P-medium

All 12 comments

According to https://github.com/rust-lang/docs.rs/pull/981#issuecomment-678305912, that PR should've been reverted, no? (I can't find the revert actually.)

It was reverted in prod but not in the code. The PR was redeployed after #987.

Well something is very broken currently. It seems that style.css contains a redundant copy of normalize.css which is overwriting the custom styles.

image

image

EDIT: Apparently https://github.com/rust-lang/docs.rs/blob/master/vendor/pure-css/css/pure-min.css ships their own normalize.css which is the problem. These vendored css should get included first, followed by rustdoc.css, and finally style.css.

I really wish we hadn't combined our own styles into the rest of the vendored styles 馃う

Possible solution approach: Extract vendored css (purecss and fontawesome) into a separate file and use the following css order:

  • normalize.css (from rustdoc)
  • vendored.css (purecss and fontawesome)
  • rustdoc.css
  • light.css + dark.css
  • style.css

EDIT: I could try implementing this, if it's something we'd like to try.

@cynecx are you interested in making a PR for that? The relevant code is https://github.com/rust-lang/docs.rs/blob/master/templates/base.html

@jyn514 Sure. I'll try.

Oh, one question tho. It seems that purecss already contains a version of normalize.css. Should we just keep that with the one from rustdoc? Or remove the normalize.css from rustdoc?

We can't change rustdoc styles. Ideally we would get rid of the one in purecss, but I don't know how to do that cleanly.

Hmm ... I guess that would work, but then our styles are out of sync with rustdoc if it changes the version of normalize. But if it fixes the issue I'm willing to try it.

@jyn514 Well we could just keep both for now and do the removal in a future PR. Does that sound okay?

Was this page helpful?
0 / 5 - 0 ratings