-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path_technical-documentation.scss
234 lines (189 loc) · 4.69 KB
/
_technical-documentation.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// Adds combination of margin and padding to headings to make them appear
// correctly when they're linked to as anchors, and scale them on mobile
@mixin heading-offset($tabletTopMargin) {
// Scale margins with font size on mobile (16/19ths)
$mobileTopMargin: ceil($tabletTopMargin * (16 / 19));
// Offset headings down on mobile so that linking to anchors they appear after
// the sticky 'table of contents' element
$stickyTocOffset: 20px + $gutter-half + 10px + 1px;
// Pad the heading so that when linking to an anchor there is at most a
// $gutter-half (mobile) or $gutter (tablet and above) sized gap between the
// top of the viewport and the heading.
padding-top: min($mobileTopMargin, $gutter-half) + $stickyTocOffset;
margin-top: max(0, $mobileTopMargin - $gutter-half) - $stickyTocOffset;
@include media(tablet) {
padding-top: min($tabletTopMargin, $gutter);
margin-top: max(0, $tabletTopMargin - $gutter);
}
}
.technical-documentation {
// Required for IE11 to render <main> correctly
display: block;
margin: 0 $gutter-half 10px;
max-width: 40em;
line-height: 1.4;
color: $text-colour;
@include media(tablet) {
// We add 2 pixels to the gutter here to ensure there's sufficient spacing between
// an anchor link (see _anchored-heading.scss) on a heading and the left-hand pane.
margin: 0 ($gutter + 2px) $gutter;
}
// Headings
h1 {
@include bold-48;
@include heading-offset($gutter * 2);
&:first-of-type {
@include heading-offset($gutter);
}
}
h2 {
@include bold-36;
@include heading-offset($gutter * 1.5);
}
h3, h4, h5, h6 {
@include heading-offset($gutter);
}
h3 {
@include bold-24;
}
h4 {
@include bold-19;
}
h5 {
@include bold-19;
color: $secondary-text-colour;
}
h6 {
@include core-19;
color: $secondary-text-colour;
}
// Expand margin when h1 followed directly by paragraph
h1 + p {
@include media(tablet) {
margin-top: $gutter * 1.5;
}
}
// Tighten up margins where headings follow each other
h1 + h2 {
@include heading-offset($gutter);
}
h2 + h3, h3 + h4, h4 + h5, h5 + h6 {
@include heading-offset(20px);
}
p {
margin-top: ceil($gutter-half * (16 / 19));
margin-bottom: 0;
@include media(tablet) {
margin-top: $gutter-half;
}
}
img {
max-width: 100%;
width: auto;
height: auto;
}
ol, ul {
margin: $gutter-half 0 0;
padding-left: 20px;
}
ol ol, ul ul, ol ul, ul ol {
margin-top: 0;
}
li {
margin-top: 5px;
}
ol + p, ul + p, .table-container + p {
margin-top: ceil($gutter * (16 / 19));
@include media(tablet) {
margin-top: $gutter;
}
}
blockquote {
background: $grey-4;
padding: $gutter-half;
margin: $gutter-half;
border-left: 5px solid $grey-3;
}
pre {
background: $code-00;
padding: 15px;
overflow: auto;
position: relative;
border: 1px solid $code-02;
}
pre code {
background: none;
color: inherit;
padding: 0;
}
code {
background: $code-01;
padding: 3px 5px;
border-radius: 1px;
font-family: monaco, Consolas, "Lucida Console", monospace;
font-size: 15px;
color: $code-0E;
@include media(tablet) {
font-size: 16px;
}
// Handle long strings (URLs, long variable names, etc) by allowing them
// to break anywhere if required.
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
/* This is the dangerous one in WebKit, as it breaks things wherever */
word-break: break-all;
/* Instead use this non-standard one: */
word-break: break-word;
}
// Support monospace headings for e.g. listing API endpoints
h1, h2, h3, h4, h5, h6 {
code {
font-size: inherit;
color: $text-colour;
background: none;
padding: 0;
}
}
.table-container {
display: block;
max-width: 100%;
overflow-x: auto;
margin-top: $gutter-half;
}
table {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
th, td {
padding: $gutter-one-third $gutter-two-thirds $gutter-one-third 0;
background-color: transparent;
border-bottom: 1px solid $border-colour;
border-width: 0 0 1px 0;
@include core-16;
vertical-align: top;
text-align: left;
}
th {
font-weight: bold;
}
td {
p, ul, ol {
margin: 0;
}
p+p, p+ul, p+ol,
ul+p, ul+ol,
ol+p {
margin-top: $gutter-one-third;
}
}
hr {
height: 1px;
border: none;
margin-top: $gutter - 1px;
margin-bottom: $gutter;
background-color: $border-colour;
color: $border-colour;
}
}