diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs
index 8a13db9f..d32d45e4 100644
--- a/src/renderer/html_handlebars/hbs_renderer.rs
+++ b/src/renderer/html_handlebars/hbs_renderer.rs
@@ -880,11 +880,8 @@ fn add_playground_pre(
// we need to inject our own main
let (attrs, code) = partition_source(code);
- format!(
- "\n# #![allow(unused)]\n{}#fn main() {{\n{}#}}",
- attrs, code
- )
- .into()
+ format!("# #![allow(unused)]\n{}#fn main() {{\n{}#}}", attrs, code)
+ .into()
};
hide_lines(&content)
}
@@ -1007,7 +1004,7 @@ mod tests {
fn add_playground() {
let inputs = [
("x()
",
- "
\n#![allow(unused)]\nfn main() {\nx()\n}\n
"),
+ "#![allow(unused)]\nfn main() {\nx()\n}\n
"),
("fn main() {}
",
"fn main() {}\n
"),
("let s = \"foo\n # bar\n\";
",
@@ -1037,7 +1034,7 @@ mod tests {
fn add_playground_edition2015() {
let inputs = [
("x()
",
- "\n#![allow(unused)]\nfn main() {\nx()\n}\n
"),
+ "#![allow(unused)]\nfn main() {\nx()\n}\n
"),
("fn main() {}
",
"fn main() {}\n
"),
("fn main() {}
",
@@ -1061,7 +1058,7 @@ mod tests {
fn add_playground_edition2018() {
let inputs = [
("x()
",
- "\n#![allow(unused)]\nfn main() {\nx()\n}\n
"),
+ "#![allow(unused)]\nfn main() {\nx()\n}\n
"),
("fn main() {}
",
"fn main() {}\n
"),
("fn main() {}
",
@@ -1085,7 +1082,7 @@ mod tests {
fn add_playground_edition2021() {
let inputs = [
("x()
",
- "\n#![allow(unused)]\nfn main() {\nx()\n}\n
"),
+ "#![allow(unused)]\nfn main() {\nx()\n}\n
"),
("fn main() {}
",
"fn main() {}\n
"),
("fn main() {}
",
diff --git a/src/theme/ayu-highlight.css b/src/theme/ayu-highlight.css
index 0c45c6f1..32c94322 100644
--- a/src/theme/ayu-highlight.css
+++ b/src/theme/ayu-highlight.css
@@ -8,7 +8,6 @@ Original by Dempfi (https://github.com/dempfi/ayu)
overflow-x: auto;
background: #191f26;
color: #e6e1cf;
- padding: 0.5em;
}
.hljs-comment,
diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css
index 21c08b93..32b758a1 100644
--- a/src/theme/css/chrome.css
+++ b/src/theme/css/chrome.css
@@ -208,8 +208,10 @@ pre {
pre > .buttons {
position: absolute;
z-index: 100;
- right: 5px;
- top: 5px;
+ right: 0px;
+ top: 2px;
+ margin: 0px;
+ padding: 2px 0px;
color: var(--sidebar-fg);
cursor: pointer;
@@ -225,7 +227,29 @@ pre > .buttons button {
background: transparent;
border: none;
cursor: inherit;
+ margin: 0px;
+ padding: 0px 0.5rem;
+ font-size: 14px;
}
+@media (pointer: coarse) {
+ pre > .buttons button {
+ /* On mobile, make it easier to tap buttons. */
+ padding: 0 1rem;
+ }
+}
+code {
+ padding: 1.6rem 1rem;
+}
+
+/* FIXME: ACE editors overlap their buttons because ACE does absolute
+ positioning within the code block which breaks padding. The only solution I
+ can think of is to move the padding to the outer pre tag (or insert a div
+ wrapper), but that would require fixing a whole bunch of CSS rules.
+*/
+.hljs.ace_editor {
+ padding: 0rem 0rem;
+}
+
pre > .result {
margin-top: 10px;
}
diff --git a/src/theme/css/general.css b/src/theme/css/general.css
index ef2ba504..fc7ccc2f 100644
--- a/src/theme/css/general.css
+++ b/src/theme/css/general.css
@@ -80,8 +80,7 @@ h6:target::before {
.content {
overflow-y: auto;
- padding: 0 15px;
- padding-bottom: 50px;
+ padding: 0 5px 50px 5px;
}
.content main {
margin-left: auto;
diff --git a/src/theme/highlight.css b/src/theme/highlight.css
index c2343227..ba57b82b 100644
--- a/src/theme/highlight.css
+++ b/src/theme/highlight.css
@@ -61,7 +61,6 @@
overflow-x: auto;
background: #f6f7f6;
color: #000;
- padding: 0.5em;
}
.hljs-emphasis {
diff --git a/src/theme/tomorrow-night.css b/src/theme/tomorrow-night.css
index f7197925..5b4aca77 100644
--- a/src/theme/tomorrow-night.css
+++ b/src/theme/tomorrow-night.css
@@ -81,8 +81,6 @@
overflow-x: auto;
background: #1d1f21;
color: #c5c8c6;
- padding: 0.5em;
- -webkit-text-size-adjust: none;
}
.coffeescript .javascript,