Skip to content

Commit 6be26f9

Browse files
committed
Adjust overlap of code buttons with code blocks.
1 parent f878266 commit 6be26f9

File tree

6 files changed

+29
-13
lines changed

6 files changed

+29
-13
lines changed

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,8 @@ fn add_playground_pre(
880880
// we need to inject our own main
881881
let (attrs, code) = partition_source(code);
882882

883-
format!(
884-
"\n# #![allow(unused)]\n{}#fn main() {{\n{}#}}",
885-
attrs, code
886-
)
887-
.into()
883+
format!("# #![allow(unused)]\n{}#fn main() {{\n{}#}}", attrs, code)
884+
.into()
888885
};
889886
hide_lines(&content)
890887
}

src/theme/ayu-highlight.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Original by Dempfi (https://github.com/dempfi/ayu)
88
overflow-x: auto;
99
background: #191f26;
1010
color: #e6e1cf;
11-
padding: 0.5em;
1211
}
1312

1413
.hljs-comment,

src/theme/css/chrome.css

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ pre {
208208
pre > .buttons {
209209
position: absolute;
210210
z-index: 100;
211-
right: 5px;
212-
top: 5px;
211+
right: 0px;
212+
top: 2px;
213+
margin: 0px;
214+
padding: 2px 0px;
213215

214216
color: var(--sidebar-fg);
215217
cursor: pointer;
@@ -225,7 +227,29 @@ pre > .buttons button {
225227
background: transparent;
226228
border: none;
227229
cursor: inherit;
230+
margin: 0px;
231+
padding: 0px 0.5rem;
232+
font-size: 14px;
233+
}
234+
@media (pointer: coarse) {
235+
pre > .buttons button {
236+
/* On mobile, make it easier to tap buttons. */
237+
padding: 0 1rem;
238+
}
239+
}
240+
code {
241+
padding: 1.6rem 1rem;
228242
}
243+
244+
/* FIXME: ACE editors overlap their buttons because ACE does absolute
245+
positioning within the code block which breaks padding. The only solution I
246+
can think of is to move the padding to the outer pre tag (or insert a div
247+
wrapper), but that would require fixing a whole bunch of CSS rules.
248+
*/
249+
.hljs.ace_editor {
250+
padding: 0rem 0rem;
251+
}
252+
229253
pre > .result {
230254
margin-top: 10px;
231255
}

src/theme/css/general.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ h6:target::before {
8080

8181
.content {
8282
overflow-y: auto;
83-
padding: 0 15px;
84-
padding-bottom: 50px;
83+
padding: 0 5px 50px 5px;
8584
}
8685
.content main {
8786
margin-left: auto;

src/theme/highlight.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
overflow-x: auto;
6262
background: #f6f7f6;
6363
color: #000;
64-
padding: 0.5em;
6564
}
6665

6766
.hljs-emphasis {

src/theme/tomorrow-night.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@
8181
overflow-x: auto;
8282
background: #1d1f21;
8383
color: #c5c8c6;
84-
padding: 0.5em;
85-
-webkit-text-size-adjust: none;
8684
}
8785

8886
.coffeescript .javascript,

0 commit comments

Comments
 (0)