diff --git a/src/engines/postsearch/docs_rs.rs b/src/engines/postsearch/docs_rs.rs index 1692933..b6c4924 100644 --- a/src/engines/postsearch/docs_rs.rs +++ b/src/engines/postsearch/docs_rs.rs @@ -48,14 +48,12 @@ pub fn parse_response(body: &str) -> Option { let doc_html = doc.inner_html(); let doc_html = ammonia::Builder::default() .link_rel(None) - .url_relative(ammonia::UrlRelative::RewriteWithBase( - Url::parse("https://docs.rs").unwrap(), - )) + .url_relative(ammonia::UrlRelative::RewriteWithBase(url.clone())) .clean(&doc_html) .to_string(); Some(format!( - r#"

Crate {title} {version}

+ r#"

Crate {title} {version}

{doc_html}
"#, url = html_escape::encode_quoted_attribute(&url.to_string()), title = html_escape::encode_text(&title), diff --git a/src/web/assets/style.css b/src/web/assets/style.css index 497f36d..b934fcf 100644 --- a/src/web/assets/style.css +++ b/src/web/assets/style.css @@ -222,18 +222,22 @@ h1 { .infobox p { margin: 0; } -.infobox-stackexchange-answer pre > code, -.infobox-github-readme pre { +.infobox pre { border: 1px solid #234; padding: 0.5rem; display: block; +} +.infobox pre > code { font-weight: normal; } -.infobox-stackexchange-answer code, -.infobox-github-readme code { +.infobox code { font-weight: bold; } +.infobox-docs_rs-version { + opacity: 0.5; + font-weight: normal; + font-size: 0.8em; +} .postsearch-infobox p { margin-bottom: 1em; - white-space: pre-wrap; }