Rollup merge of #68553 - GuillaumeGomez:fix-run-button-scroll-pos, r=kinnison
Fix run button positionning in case of scrolling Fixes #68337. r? @kinnison
This commit is contained in:
commit
85f324004e
2 changed files with 7 additions and 8 deletions
|
|
@ -22,7 +22,7 @@ use syntax::token::{self, Token};
|
|||
pub fn render_with_highlighting(
|
||||
src: &str,
|
||||
class: Option<&str>,
|
||||
extension: Option<&str>,
|
||||
playground_button: Option<&str>,
|
||||
tooltip: Option<(&str, &str)>,
|
||||
) -> String {
|
||||
debug!("highlighting: ================\n{}\n==============", src);
|
||||
|
|
@ -58,10 +58,7 @@ pub fn render_with_highlighting(
|
|||
Ok(highlighted_source) => {
|
||||
write_header(class, &mut out).unwrap();
|
||||
write!(out, "{}", highlighted_source).unwrap();
|
||||
if let Some(extension) = extension {
|
||||
write!(out, "{}", extension).unwrap();
|
||||
}
|
||||
write_footer(&mut out).unwrap();
|
||||
write_footer(&mut out, playground_button).unwrap();
|
||||
}
|
||||
Err(()) => {
|
||||
// If errors are encountered while trying to highlight, just emit
|
||||
|
|
@ -433,6 +430,6 @@ fn write_header(class: Option<&str>, out: &mut dyn Write) -> io::Result<()> {
|
|||
write!(out, "<div class=\"example-wrap\"><pre class=\"rust {}\">\n", class.unwrap_or(""))
|
||||
}
|
||||
|
||||
fn write_footer(out: &mut dyn Write) -> io::Result<()> {
|
||||
write!(out, "</pre></div>\n")
|
||||
fn write_footer(out: &mut dyn Write, playground_button: Option<&str>) -> io::Result<()> {
|
||||
write!(out, "</pre>{}</div>\n", if let Some(button) = playground_button { button } else { "" })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ summary {
|
|||
outline: none;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
code, pre, a.test-arrow {
|
||||
font-family: "Source Code Pro", monospace;
|
||||
}
|
||||
.docblock code, .docblock-short code {
|
||||
|
|
@ -305,6 +305,7 @@ nav.sub {
|
|||
.rustdoc:not(.source) .example-wrap {
|
||||
display: inline-flex;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.example-wrap {
|
||||
|
|
@ -878,6 +879,7 @@ a.test-arrow {
|
|||
font-size: 130%;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
z-index: 1;
|
||||
}
|
||||
a.test-arrow:hover{
|
||||
text-decoration: none;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue