Skip to content

Commit c34fab9

Browse files
Respect user font preferences
Technically savvy users are more likely to have a font preference configured, and developers are more likely to have a preference for a particular monospace font. This commit removes the font family and base font size from the stylesheet so that users can view the documentation with their preferred fonts. In particular, this stops forcing the use of the Courier font for `<code>` elements nested in `<p>` when the Consolas and Menlo fonts are not installed, which is commonly the case on Linux. This also fixes mismatching fonts for `<code>` elements nested in `<p>` versus `<code>` elements nested in `<pre>`.
1 parent 1575e97 commit c34fab9

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

lib/rdoc/generator/template/rails/resources/css/main.css

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
* { box-sizing: border-box; }
22

33
:root {
4+
--line-height: 1.5;
5+
46
--text-color: #3b3b3b;
57
--link-color: #cc0000;
68
--link-hover-color: #990000;
@@ -28,12 +30,12 @@ html {
2830
}
2931

3032
body {
31-
font-family: "Helvetica Neue", Arial, sans-serif;
33+
line-height: var(--line-height);
34+
3235
background: var(--body-bg);
3336
color: var(--text-color);
37+
3438
margin: 0px;
35-
font-size: 15px;
36-
line-height: 1.25em;
3739
min-height: 100%;
3840
}
3941

@@ -214,10 +216,6 @@ pre
214216
.attr-desc {
215217
}
216218

217-
tt {
218-
font-size: 1.15em;
219-
}
220-
221219
.attr-value {
222220
font-family: monospace;
223221
padding-left: 1em;
@@ -236,7 +234,6 @@ tt {
236234
padding: 1em 1.2em;
237235
background: var(--code-bg);
238236
border-radius: 10px;
239-
font-size: 15px;
240237
}
241238

242239
.description pre,
@@ -326,8 +323,6 @@ tt {
326323
p code {
327324
background: var(--code-bg);
328325
border-radius: 5px;
329-
font-family: Consolas, Menlo, Courier, monospace;
330-
font-size: 14px;
331326
margin-bottom: 1px;
332327
padding: 0 5px;
333328
}
@@ -369,7 +364,6 @@ p code {
369364
color: white;
370365
transform: rotate(45deg) translate(27.5%, -40%);
371366
min-width: 200px;
372-
font-family: Helvetica, Arial, sans-serif;
373367
font-size: 30px;
374368
font-weight: bold;
375369
font-style: italic;

lib/rdoc/generator/template/rails/resources/css/panel.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Results (begin) */
1010
.panel .result
1111
{
12+
font-family: "Helvetica Neue", Arial, sans-serif;
1213
line-height: 1;
1314
}
1415

@@ -164,6 +165,11 @@
164165
/* Results (end) */
165166

166167
/* Tree (begin) */ /**/
168+
.panel .tree
169+
{
170+
font-family: "Helvetica Neue", Arial, sans-serif;
171+
}
172+
167173
.panel .tree ul:first-child
168174
{
169175
background: url(../i/tree_bg.svg);

lib/rdoc/generator/template/rails/resources/css/reset.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ table, caption, tbody, tfoot, thead, tr, th, td {
1717
vertical-align: baseline;
1818
background: transparent;
1919
}
20-
body {
21-
line-height: 1;
22-
}
2320
ol, ul {
2421
list-style: none;
2522
}
@@ -44,4 +41,4 @@ del {
4441
table {
4542
border-collapse: collapse;
4643
border-spacing: 0;
47-
}
44+
}

0 commit comments

Comments
 (0)