Skip to content

Commit 34e3502

Browse files
authored
Tighten up cheatsheet spacing on small screens and fix h3 line wrapping (#1638)
* Add tmp/handlebars on setup to prevent built error * Cheatsheets: less margin/padding on mobile and fix h3 wrapping
1 parent 0942b00 commit 34e3502

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

Diff for: assets/css/content/cheatsheet.css

+26-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
@media screen {
2+
.page-cheatmd {
3+
--horizontal-space: 1.5em;
4+
--vertical-space: 1em;
5+
}
6+
7+
@media (max-width: 600px) {
8+
.page-cheatmd {
9+
--horizontal-space: 1em;
10+
--vertical-space: .75em;
11+
}
12+
}
13+
214
.page-cheatmd .content-inner {
315
max-width: 1200px;
416
}
517

618
/* h1 styling */
719

820
.page-cheatmd h1 {
9-
margin-bottom: 1em;
21+
margin-bottom: var(--vertical-space);
1022
}
1123

1224
/* h2 styling */
1325

1426
.page-cheatmd h2 {
15-
margin: 1em 0;
27+
margin: var(--vertical-space) 0;
1628
column-span: all;
1729
padding-left: 3px;
1830
color: var(--gray700);
@@ -26,7 +38,6 @@
2638
/* h3 styling */
2739

2840
.page-cheatmd h3 {
29-
white-space: nowrap;
3041
overflow: hidden;
3142
margin: 0 0 1em;
3243
padding-left: 5px;
@@ -36,18 +47,20 @@
3647

3748
.page-cheatmd section.h3 {
3849
min-width: 300px;
39-
margin: 0 0 2em 0;
50+
margin: 0 0 calc(var(--vertical-space) * 2) 0;
4051
break-inside: avoid;
4152
-webkit-column-break-inside: avoid;
4253
}
4354

4455
.page-cheatmd h3::after {
45-
margin-left: 24px;
4656
content: "";
47-
vertical-align: middle;
57+
margin-left: var(--horizontal-space);
58+
vertical-align: baseline;
4859
display: inline-block;
4960
width: 100%;
5061
height: 1px;
62+
margin-right: -100%;
63+
margin-bottom: 5px;
5164
background: linear-gradient(
5265
to right,
5366
rgba(116, 95, 181, 0.2),
@@ -60,7 +73,7 @@
6073
.page-cheatmd h4 {
6174
display: block;
6275
margin: 0;
63-
padding: 0.25em 1.5em;
76+
padding: 0.25em var(--horizontal-space);
6477
font-weight: 400;
6578
background: var(--gray100);
6679
color: #567;
@@ -80,7 +93,7 @@
8093
margin: 0;
8194
display: block;
8295
background: var(--gray50);
83-
padding: 1.5em;
96+
padding: var(--vertical-space) var(--horizontal-space);
8497
}
8598

8699
.page-cheatmd.dark .h2 p {
@@ -96,7 +109,7 @@
96109
/* Code blocks */
97110

98111
.page-cheatmd pre code {
99-
padding: 1em 1.5em;
112+
padding: var(--vertical-space) var(--horizontal-space);
100113
}
101114

102115
.page-cheatmd pre code::-webkit-scrollbar {
@@ -123,15 +136,15 @@
123136
}
124137

125138
.page-cheatmd .h2 table th {
126-
padding: 0.75em 1.5em;
127-
line-height: 2em;
139+
padding: var(--vertical-space) var(--horizontal-space);
140+
line-height: inherit;
128141
margin-bottom: -1px;
129142
vertical-align: middle;
130143
border-bottom: 1px solid var(--codeBorder);
131144
}
132145

133146
.page-cheatmd .h2 table td {
134-
padding: 0.75em 1.5em;
147+
padding: var(--vertical-space) var(--horizontal-space);
135148
border: 0;
136149
border-bottom: 1px solid var(--codeBorder);
137150
}
@@ -167,7 +180,7 @@
167180

168181
.page-cheatmd .h2 li {
169182
list-style-position: inside;
170-
padding: 0.5em 1.5em;
183+
padding: 0.5em var(--horizontal-space);
171184
line-height: 2em;
172185
vertical-align: middle;
173186
background-color: var(--codeBackground);

Diff for: mix.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ defmodule ExDoc.Mixfile do
4646
clean: [&clean_test_fixtures/1, "clean"],
4747
fix: ["format", "cmd --cd assets npm run lint:fix"],
4848
lint: ["format --check-formatted", "cmd --cd assets npm run lint"],
49-
setup: ["deps.get", "cmd --cd assets npm install"]
49+
setup: ["deps.get", "cmd mkdir -p tmp/handlebars", "cmd --cd assets npm install"]
5050
]
5151
end
5252

0 commit comments

Comments
 (0)