Skip to content

Commit 26a5c97

Browse files
committed
auto merge of #7077 : SiegeLord/rust/new_css, r=pnkfelix
I was making documentation for my own little Rust project, and I was somewhat unhappy with how the documentation looked. While many of the issues are endemic to how rustdoc generates its output, you can get pretty far in making the documentation readable by using a better CSS style. This commit alters the CSS style used in Rust's documentation in order to make the various sections stand out more. You can see an example of its usage in my own project's documentation: http://siegelord.github.io/RustGnuplot/#implementation-for-figureself-where-self. I showed it to some people on IRC and they suggested that I make a pull request here. I tested it on the only browser that matters, but also Chrome and Opera.
2 parents df483e8 + d641b0b commit 26a5c97

File tree

1 file changed

+73
-23
lines changed

1 file changed

+73
-23
lines changed

doc/rust.css

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,81 @@
11
body {
2-
padding: 1em;
3-
margin: 0;
4-
margin-bottom: 4em;
5-
font-family: "Helvetica Neue", Helvetica, sans-serif;
6-
background-color: white;
7-
color: black;
8-
line-height: 1.6em;
9-
}
10-
11-
body {
12-
padding: 1em 6em;
13-
max-width: 60em;
2+
padding: 1em 6em;
3+
margin: 0;
4+
margin-bottom: 4em;
5+
font-family: "Helvetica Neue", Helvetica, sans-serif;
6+
font-size: 12pt;
7+
background-color: white;
8+
color: black;
9+
line-height: 1.6em;
10+
min-width: 45em;
11+
max-width: 60em;
1412
}
1513

1614
h1 {
17-
font-size: 20pt;
18-
margin-top: 2em;
19-
border-bottom: 1px solid silver;
20-
line-height: 1.6em;
15+
font-size: 20pt;
16+
margin-top: 2em;
17+
padding-left: 0.4em;
18+
line-height: 1.6em;
19+
background-color:#FFF2CE;
20+
border-radius: 0.2em;
21+
border: 1px solid rgba(0, 0, 0, 0.15);
2122
}
23+
2224
h2 {
2325
font-size: 15pt;
2426
margin-top: 2em;
27+
padding-left: 0.4em;
28+
background-color:#FFF2CE;
29+
border-radius: 0.4em;
30+
border: 1px solid rgba(0, 0, 0, 0.15);
31+
}
32+
33+
h2 code {
34+
color: #097334;
35+
font-size: 15pt;
36+
}
37+
38+
h3 {
39+
font-size: 13pt;
40+
color: black;
41+
background-color:#D9E7FF;
42+
border-radius: 0.4em;
43+
border: 1px solid rgba(0, 0, 0, 0.15);
44+
padding: 0 0.4em 0 0.4em;
45+
}
46+
47+
h3 code {
48+
color: #541800;
49+
font-size: 13pt;
50+
font-style: italic;
51+
}
52+
53+
h4 {
54+
font-size: 11pt;
55+
margin-top: 0em;
56+
margin-bottom: 0em;
57+
}
58+
59+
code {
60+
font-size: 11pt;
2561
}
26-
h3 { font-size: 13pt; }
2762

2863
pre {
29-
margin: 1.1em 0;
30-
padding: .4em .4em .4em 2em;
31-
font-size: 120%;
64+
margin-left: 1.1em;
65+
padding: .4em .4em .4em .8em;
66+
font-size: 10pt;
67+
background-color: #F5F5F5;
68+
border-radius: 0.5em;
69+
border: 1px solid rgba(0, 0, 0, 0.15);
70+
}
71+
72+
pre.rust {
73+
background-color: #F3F6FF;
3274
}
3375

3476
a, a:visited, a:link {
35-
text-decoration: none;
36-
color: rgb(0, 105, 214);
77+
text-decoration: none;
78+
color: rgb(0, 105, 214);
3779
}
3880

3981
h1 a:link, h1 a:visited, h2 a:link, h2 a:visited,
@@ -106,4 +148,12 @@ td {
106148
/* Adjust list alignment so rustdoc indexes don't align with blockquotes */
107149
div.index ul {
108150
padding-left: 1em;
109-
}
151+
}
152+
153+
ul {
154+
margin-top: 0em
155+
}
156+
157+
div.section.level3 {
158+
margin-left: 1.0em;
159+
}

0 commit comments

Comments
 (0)