Skip to content

Commit 6719f49

Browse files
authored
Better differentiate headings/sections (#2164)
1 parent d3ee0ef commit 6719f49

File tree

5 files changed

+61
-22
lines changed

5 files changed

+61
-22
lines changed

assets/css/_html.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@import "keyboard-shortcuts.css";
2626
@import "quick-switch.css";
2727
@import "autocomplete.css";
28-
@import "tooltips.css";
28+
@import "tooltips.css"; /* must remain below functions */
2929
@import "copy-button.css";
3030
@import "settings.css";
3131
@import "toast.css";

assets/css/content/cheatsheet.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/* h2 */
2424

2525
.page-cheatmd .content-inner h2 {
26+
font-size: 1.6rem;
2627
margin: var(--vertical-space) 0;
2728
column-span: all;
2829
color: var(--gray700);
@@ -36,6 +37,7 @@
3637
/* h3 */
3738

3839
.page-cheatmd .content-inner h3 {
40+
font-size: 1.375rem;
3941
margin: 0 0 1em;
4042
font-weight: 400;
4143
}
@@ -66,6 +68,7 @@
6668
/* h4 */
6769

6870
.page-cheatmd .content-inner h4 {
71+
font-size: 1rem;
6972
display: block;
7073
margin: 0;
7174
padding: 0.25em var(--horizontal-space);

assets/css/content/functions.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
position: relative;
2626
}
2727

28+
/* !important used in order to beat main heading styles (which use #id selectors),
29+
in both HTML and ePub. */
2830
.content-inner .detail-header .signature {
2931
font-family: var(--monoFontFamily);
30-
font-size: 13px;
3132
font-weight: 700;
32-
line-height: 2em;
33+
font-size: 13px !important;
34+
line-height: 2em !important;
35+
margin: 0 !important;
3336
}
3437

3538
.content-inner .detail-header:hover a.detail-link,

assets/css/content/general.css

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@
6262
color: var(--textHeaders);
6363
}
6464

65-
.content-inner h1 {
66-
font-size: 2em;
67-
margin: 0.5em 0;
68-
}
69-
70-
.content-inner h1.section-heading {
71-
margin: 1.5em 0 0.5em;
72-
}
73-
7465
.content-inner div.group-description {
7566
margin: 0 0 3em;
7667
}
@@ -79,15 +70,43 @@
7970
font-weight: 400;
8071
}
8172

82-
.content-inner h2 {
83-
font-size: 1.6em;
84-
padding-top: 1em;
85-
margin-bottom: 0.5em;
86-
}
73+
/* Headings
74+
Summary, Callbacks and Functions sections output h1 and h2,
75+
which we style as h2 and h3. */
76+
77+
.content-inner {
78+
& h1 {
79+
font-size: 2rem;
80+
margin-top: 1.75em;
81+
}
82+
83+
& h2,
84+
& :is(#summary, #callbacks, #functions) h1 {
85+
font-size: 1.75rem;
86+
margin-top: 1.5em;
87+
margin-bottom: 0.5em;
88+
}
89+
90+
& h3,
91+
& :is(#summary, #callbacks, #functions) h2 {
92+
font-size: 1.45rem;
93+
margin-top: 1.5em;
94+
margin-bottom: 0.5em;
95+
}
8796

88-
.content-inner h3 {
89-
font-size: 1.375em;
90-
margin: 1em 0 0.5em;
97+
& :is(h4, h5, h6) {
98+
font-size: 1.15rem;
99+
margin-top: 1.25em;
100+
margin-bottom: 0.5em;
101+
}
102+
103+
& :is(h5, h6) {
104+
font-weight: normal;
105+
}
106+
107+
& h6 {
108+
font-size: 1rem;
109+
}
91110
}
92111

93112
.content-inner li + li {
@@ -140,6 +159,18 @@
140159
overflow: auto;
141160
border-radius: var(--borderRadius-base);
142161

162+
& :is(h1, h2, h3, h4, h5, h6) {
163+
margin: 1.25rem 0;
164+
}
165+
166+
& :is(h1, h2, h3) {
167+
font-size: 1.375rem;
168+
}
169+
170+
& :is(h4, h5, h6) {
171+
font-size: 1rem;
172+
}
173+
143174
& :is(code, pre code) {
144175
background-color: var(--admCodeBackground);
145176
border: 1px solid var(--admCodeBorder);
@@ -151,7 +182,7 @@
151182
}
152183

153184
& :is(h1, h2, h3, h4, h5, h6):first-child {
154-
padding-bottom: 1em;
185+
padding-bottom: 1rem;
155186
border-bottom: 2px solid hsl(from currentColor h s l / 15%);
156187
}
157188

assets/css/tooltips.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ as it has absolute positioning, so doesn't impact the layout and click events pa
3333
overflow: auto;
3434
}
3535

36+
/* !important used in order to beat main heading and functions signature styles. */
3637
.tooltip .tooltip-body .signature {
3738
min-width: 320px;
3839
width: 100%;
39-
line-height: 1em;
40+
line-height: 1em !important;
41+
margin: .75em 0 !important;
4042
}
4143

4244
.tooltip .tooltip-body .detail-header {

0 commit comments

Comments
 (0)