fixes for docs.rs engine
This commit is contained in:
parent
540d01981c
commit
e35a840a5c
@ -48,14 +48,12 @@ pub fn parse_response(body: &str) -> Option<String> {
|
||||
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#"<h2>Crate <a href="{url}">{title} {version}</a></h2>
|
||||
r#"<h2>Crate <a href="{url}">{title}</a> <span class="infobox-docs_rs-version">{version}</span></h2>
|
||||
<div class="infobox-docs.rs-answer">{doc_html}</div>"#,
|
||||
url = html_escape::encode_quoted_attribute(&url.to_string()),
|
||||
title = html_escape::encode_text(&title),
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user