Skip to content

Commit c6d3d2d

Browse files
committed
publish online book
1 parent 8623c03 commit c6d3d2d

File tree

133 files changed

+4344
-2480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+4344
-2480
lines changed

docs/404.html

Lines changed: 17 additions & 20 deletions
Large diffs are not rendered by default.

docs/PREFACE.html

Lines changed: 16 additions & 19 deletions
Large diffs are not rendered by default.

docs/ayu-highlight.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
88
overflow-x: auto;
99
background: #191f26;
1010
color: #e6e1cf;
11+
padding: 0.5em;
1112
}
1213

1314
.hljs-comment,

docs/book.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
window.onunload = function () { };
55

66
// Global variable, shared between modules
7-
function playground_text(playground, hidden = true) {
7+
function playground_text(playground) {
88
let code_block = playground.querySelector("code");
99

1010
if (window.ace && code_block.classList.contains("editable")) {
1111
let editor = window.ace.edit(code_block);
1212
return editor.getValue();
13-
} else if (hidden) {
14-
return code_block.textContent;
1513
} else {
16-
return code_block.innerText;
14+
return code_block.textContent;
1715
}
1816
}
1917

@@ -68,7 +66,7 @@ function playground_text(playground, hidden = true) {
6866
}
6967

7068
// updates the visibility of play button based on `no_run` class and
71-
// used crates vs ones available on https://play.rust-lang.org
69+
// used crates vs ones available on http://play.rust-lang.org
7270
function update_play_button(pre_block, playground_crates) {
7371
var play_button = pre_block.querySelector(".play-button");
7472

@@ -168,6 +166,7 @@ function playground_text(playground, hidden = true) {
168166
.filter(function (node) {return node.classList.contains("editable"); })
169167
.forEach(function (block) { block.classList.remove('language-rust'); });
170168

169+
Array
171170
code_nodes
172171
.filter(function (node) {return !node.classList.contains("editable"); })
173172
.forEach(function (block) { hljs.highlightBlock(block); });
@@ -179,7 +178,7 @@ function playground_text(playground, hidden = true) {
179178
// even if highlighting doesn't apply
180179
code_nodes.forEach(function (block) { block.classList.add('hljs'); });
181180

182-
Array.from(document.querySelectorAll("code.hljs")).forEach(function (block) {
181+
Array.from(document.querySelectorAll("code.language-rust")).forEach(function (block) {
183182

184183
var lines = Array.from(block.querySelectorAll('.boring'));
185184
// If no lines were hidden, return
@@ -301,13 +300,6 @@ function playground_text(playground, hidden = true) {
301300
themePopup.querySelector("button#" + get_theme()).focus();
302301
}
303302

304-
function updateThemeSelected() {
305-
themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
306-
el.classList.remove('theme-selected');
307-
});
308-
themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
309-
}
310-
311303
function hideThemes() {
312304
themePopup.style.display = 'none';
313305
themeToggleButton.setAttribute('aria-expanded', false);
@@ -363,7 +355,6 @@ function playground_text(playground, hidden = true) {
363355

364356
html.classList.remove(previousTheme);
365357
html.classList.add(theme);
366-
updateThemeSelected();
367358
}
368359

369360
// Set theme
@@ -601,7 +592,7 @@ function playground_text(playground, hidden = true) {
601592
text: function (trigger) {
602593
hideTooltip(trigger);
603594
let playground = trigger.closest("pre");
604-
return playground_text(playground, false);
595+
return playground_text(playground);
605596
}
606597
});
607598

docs/css/chrome.css

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
@import 'variables.css';
44

5+
::-webkit-scrollbar {
6+
background: var(--bg);
7+
}
8+
::-webkit-scrollbar-thumb {
9+
background: var(--scrollbar);
10+
}
511
html {
612
scrollbar-color: var(--scrollbar) var(--bg);
713
}
@@ -12,19 +18,6 @@ a > .hljs {
1218
color: var(--links);
1319
}
1420

15-
/*
16-
body-container is necessary because mobile browsers don't seem to like
17-
overflow-x on the body tag when there is a <meta name="viewport"> tag.
18-
*/
19-
#body-container {
20-
/*
21-
This is used when the sidebar pushes the body content off the side of
22-
the screen on small screens. Without it, dragging on mobile Safari
23-
will want to reposition the viewport in a weird way.
24-
*/
25-
overflow-x: clip;
26-
}
27-
2821
/* Menu Bar */
2922

3023
#menu-bar,
@@ -215,63 +208,24 @@ pre {
215208
pre > .buttons {
216209
position: absolute;
217210
z-index: 100;
218-
right: 0px;
219-
top: 2px;
220-
margin: 0px;
221-
padding: 2px 0px;
211+
right: 5px;
212+
top: 5px;
222213

223214
color: var(--sidebar-fg);
224215
cursor: pointer;
225-
visibility: hidden;
226-
opacity: 0;
227-
transition: visibility 0.1s linear, opacity 0.1s linear;
228-
}
229-
pre:hover > .buttons {
230-
visibility: visible;
231-
opacity: 1
232216
}
233217
pre > .buttons :hover {
234218
color: var(--sidebar-active);
235-
border-color: var(--icons-hover);
236-
background-color: var(--theme-hover);
237219
}
238220
pre > .buttons i {
239221
margin-left: 8px;
240222
}
241223
pre > .buttons button {
224+
color: inherit;
225+
background: transparent;
226+
border: none;
242227
cursor: inherit;
243-
margin: 0px 5px;
244-
padding: 3px 5px;
245-
font-size: 14px;
246-
247-
border-style: solid;
248-
border-width: 1px;
249-
border-radius: 4px;
250-
border-color: var(--icons);
251-
background-color: var(--theme-popup-bg);
252-
transition: 100ms;
253-
transition-property: color,border-color,background-color;
254-
color: var(--icons);
255-
}
256-
@media (pointer: coarse) {
257-
pre > .buttons button {
258-
/* On mobile, make it easier to tap buttons. */
259-
padding: 0.3rem 1rem;
260-
}
261-
}
262-
pre > code {
263-
padding: 1rem;
264-
}
265-
266-
/* FIXME: ACE editors overlap their buttons because ACE does absolute
267-
positioning within the code block which breaks padding. The only solution I
268-
can think of is to move the padding to the outer pre tag (or insert a div
269-
wrapper), but that would require fixing a whole bunch of CSS rules.
270-
*/
271-
.hljs.ace_editor {
272-
padding: 0rem 0rem;
273228
}
274-
275229
pre > .result {
276230
margin-top: 10px;
277231
}
@@ -514,8 +468,6 @@ ul#searchresults span.teaser em {
514468
padding: 0;
515469
list-style: none;
516470
display: none;
517-
/* Don't let the children's background extend past the rounded corners. */
518-
overflow: hidden;
519471
}
520472
.theme-popup .default {
521473
color: var(--icons);
@@ -524,7 +476,7 @@ ul#searchresults span.teaser em {
524476
width: 100%;
525477
border: 0;
526478
margin: 0;
527-
padding: 2px 20px;
479+
padding: 2px 10px;
528480
line-height: 25px;
529481
white-space: nowrap;
530482
text-align: left;
@@ -536,10 +488,8 @@ ul#searchresults span.teaser em {
536488
.theme-popup .theme:hover {
537489
background-color: var(--theme-hover);
538490
}
539-
540-
.theme-selected::before {
541-
display: inline-block;
542-
content: "✓";
543-
margin-left: -14px;
544-
width: 14px;
491+
.theme-popup .theme:hover:first-child,
492+
.theme-popup .theme:hover:last-child {
493+
border-top-left-radius: inherit;
494+
border-top-right-radius: inherit;
545495
}

docs/css/general.css

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,8 @@ body {
2222
}
2323

2424
code {
25-
font-family: var(--mono-font) !important;
26-
font-size: var(--code-font-size);
27-
}
28-
29-
/* make long words/inline code not x overflow */
30-
main {
31-
overflow-wrap: break-word;
32-
}
33-
34-
/* make wide tables scroll if they overflow */
35-
.table-wrapper {
36-
overflow-x: auto;
25+
font-family: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace !important;
26+
font-size: 0.875em; /* please adjust the ace font size accordingly in editor.js */
3727
}
3828

3929
/* Don't change font size in headers. */
@@ -90,7 +80,8 @@ h6:target::before {
9080

9181
.content {
9282
overflow-y: auto;
93-
padding: 0 5px 50px 5px;
83+
padding: 0 15px;
84+
padding-bottom: 50px;
9485
}
9586
.content main {
9687
margin-left: auto;
@@ -148,18 +139,6 @@ blockquote {
148139
border-bottom: .1em solid var(--quote-border);
149140
}
150141

151-
kbd {
152-
background-color: var(--table-border-color);
153-
border-radius: 4px;
154-
border: solid 1px var(--theme-popup-border);
155-
box-shadow: inset 0 -1px 0 var(--theme-hover);
156-
display: inline-block;
157-
font-size: var(--code-font-size);
158-
font-family: var(--mono-font);
159-
line-height: 10px;
160-
padding: 4px 5px;
161-
vertical-align: middle;
162-
}
163142

164143
:not(.footnote-definition) + .footnote-definition,
165144
.footnote-definition + :not(.footnote-definition) {

docs/css/variables.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
--page-padding: 15px;
77
--content-max-width: 750px;
88
--menu-bar-height: 50px;
9-
--mono-font: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
10-
--code-font-size: 0.875em /* please adjust the ace font size accordingly in editor.js */
119
}
1210

1311
/* Themes */

docs/highlight.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
overflow-x: auto;
6262
background: #f6f7f6;
6363
color: #000;
64+
padding: 0.5em;
6465
}
6566

6667
.hljs-emphasis {

docs/index.html

Lines changed: 16 additions & 19 deletions
Large diffs are not rendered by default.

docs/print.html

Lines changed: 998 additions & 42 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)