Skip to content

Commit 0d41764

Browse files
committed
Some love for the rustbook, added Open Sans font, made the sidebar more beautiful with more space and colors, added some style to the code blocks
1 parent e2c273f commit 0d41764

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

src/rustbook/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ fn render(book: &Book, tgt: &Path) -> CliResult<()> {
145145
format!("--html-after-content={}", postlude.display()),
146146
format!("--markdown-playground-url=http://play.rust-lang.org"),
147147
format!("--markdown-css={}", item.path_to_root.join("rust-book.css").display()),
148+
format!("--markdown-css=http://fonts.googleapis.com/css?family&#61;Open+Sans:400italic,700italic,400,700"),
148149
"--markdown-no-toc".to_string(),
149150
];
150151
let output_result = rustdoc::main_args(rustdoc_args);

src/rustbook/css.rs

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ pub static STYLE: &'static str = r#"
1515
1616
body {
1717
max-width:none;
18+
font: 16px/1.4 'Open Sans', 'Source Serif Pro', Georgia, Times, 'Times New Roman', serif;
19+
line-height: 1.6;
20+
color: #333;
21+
}
22+
23+
h1, h2, h3, h4, h5, h6 {
24+
font-family: 'Open Sans', 'Fira Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
25+
font-weight: bold;
26+
color: #333;
1827
}
1928
2029
@media only screen {
@@ -23,20 +32,21 @@ body {
2332
left: 0px;
2433
top: 0px;
2534
bottom: 0px;
26-
width: 250px;
35+
width: 300px;
2736
overflow-y: auto;
2837
border-right: 1px solid rgba(0, 0, 0, 0.07);
2938
padding: 10px 10px;
30-
font-size: 16px;
31-
background: none repeat scroll 0% 0% #FFF;
39+
font-size: 14px;
3240
box-sizing: border-box;
3341
-webkit-overflow-scrolling: touch;
42+
background-color: #fafafa;
43+
color: #364149;
3444
}
3545
3646
#page-wrapper {
3747
position: absolute;
3848
overflow-y: auto;
39-
left: 260px;
49+
left: 310px;
4050
right: 0px;
4151
top: 0px;
4252
bottom: 0px;
@@ -84,7 +94,7 @@ body {
8494
.section {
8595
list-style: none outside none;
8696
padding-left: 20px;
87-
line-height: 30px;
97+
line-height: 40px;
8898
}
8999
90100
.section li {
@@ -94,12 +104,17 @@ body {
94104
}
95105
96106
.chapter li a {
97-
color: #000000;
107+
color: #333;
108+
padding: 5px 0;
98109
}
99110
100111
.chapter li a.active {
101-
text-decoration: underline;
102-
font-weight: bold;
112+
color: #008cff;
113+
}
114+
115+
.chapter li a:hover {
116+
color: #008cff;
117+
text-decoration: none;
103118
}
104119
105120
#toggle-nav {
@@ -138,6 +153,16 @@ body {
138153
padding: 0;
139154
}
140155
156+
pre {
157+
padding: 16px;
158+
overflow: auto;
159+
font-size: 85%;
160+
line-height: 1.45;
161+
background-color: #f7f7f7;
162+
border: 0;
163+
border-radius: 3px;
164+
}
165+
141166
.left {
142167
float: left;
143168
}

0 commit comments

Comments
 (0)