Skip to content

Commit 4cce3a0

Browse files
committed
Build with mdbook 0.4.43
1 parent 62194f9 commit 4cce3a0

File tree

2 files changed

+30
-59
lines changed

2 files changed

+30
-59
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ build:
33
os: "ubuntu-22.04"
44
commands:
55
- mkdir -p bin
6-
- curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz" | tar -xvz --directory "bin"
6+
- curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v0.4.43/mdbook-v0.4.43-x86_64-unknown-linux-gnu.tar.gz" | tar -xvz --directory "bin"
77
- mkdir -p $READTHEDOCS_OUTPUT/html
88
- echo "site-url = \"/$READTHEDOCS_LANGUAGE/$READTHEDOCS_VERSION/\"" >> doc/book.toml
99
- bin/mdbook build doc --dest-dir=$READTHEDOCS_OUTPUT/html

doc/theme/index.hbs

Lines changed: 29 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE HTML>
2-
<html lang="{{ language }}" class="{{ default_theme }}" dir="{{ text_direction }}">
2+
<html lang="{{ language }}" class="{{ default_theme }} sidebar-visible" dir="{{ text_direction }}">
33
<head>
44
<!-- Book generated using mdBook -->
55
<meta charset="UTF-8">
@@ -52,15 +52,17 @@
5252
<!-- MathJax -->
5353
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
5454
{{/if}}
55-
</head>
56-
<body class="sidebar-visible no-js">
57-
<div id="body-container">
55+
5856
<!-- Provide site root to javascript -->
5957
<script>
6058
var path_to_root = "{{ path_to_root }}";
6159
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
6260
</script>
63-
61+
<!-- Start loading toc.js asap -->
62+
<script src="{{ path_to_root }}toc.js"></script>
63+
</head>
64+
<body>
65+
<div id="body-container">
6466
<!-- Work around some values being stored in localStorage wrapped in quotes -->
6567
<script>
6668
try {
@@ -82,19 +84,16 @@
8284
var theme;
8385
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
8486
if (theme === null || theme === undefined) { theme = default_theme; }
85-
var html = document.querySelector('html');
87+
const html = document.documentElement;
8688
html.classList.remove('{{ default_theme }}')
8789
html.classList.add(theme);
88-
var body = document.querySelector('body');
89-
body.classList.remove('no-js')
90-
body.classList.add('js');
90+
html.classList.add("js");
9191
</script>
9292

9393
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
9494

9595
<!-- Hide / unhide sidebar before it is displayed -->
9696
<script>
97-
var body = document.querySelector('body');
9897
var sidebar = null;
9998
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
10099
if (document.body.clientWidth >= 1080) {
@@ -104,49 +103,21 @@
104103
sidebar = 'hidden';
105104
}
106105
sidebar_toggle.checked = sidebar === 'visible';
107-
body.classList.remove('sidebar-visible');
108-
body.classList.add("sidebar-" + sidebar);
106+
html.classList.remove('sidebar-visible');
107+
html.classList.add("sidebar-" + sidebar);
109108
</script>
110109

111110
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
112-
<div class="sidebar-scrollbox">
113-
{{#toc}}{{/toc}}
114-
<div
115-
id="mdbook-ad-placement"
116-
class="flat"
117-
data-ea-publisher="readthedocs"
118-
data-ea-type="readthedocs-sidebar"
119-
data-ea-manual="true"
120-
style="width: 70%; margin: 0 auto;"
121-
></div>
122-
</div>
111+
<!-- populated by js -->
112+
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
113+
<noscript>
114+
<iframe class="sidebar-iframe-outer" src="{{ path_to_root }}toc.html"></iframe>
115+
</noscript>
123116
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
124117
<div class="sidebar-resize-indicator"></div>
125118
</div>
126119
</nav>
127120

128-
<!-- Track and set sidebar scroll position -->
129-
<script>
130-
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
131-
sidebarScrollbox.addEventListener('click', function(e) {
132-
if (e.target.tagName === 'A') {
133-
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
134-
}
135-
}, { passive: true });
136-
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
137-
sessionStorage.removeItem('sidebar-scroll');
138-
if (sidebarScrollTop) {
139-
// preserve sidebar scroll position when navigating via links within sidebar
140-
sidebarScrollbox.scrollTop = sidebarScrollTop;
141-
} else {
142-
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
143-
var activeSection = document.querySelector('#sidebar .active');
144-
if (activeSection) {
145-
activeSection.scrollIntoView({ block: 'center' });
146-
}
147-
}
148-
</script>
149-
150121
<div id="page-wrapper" class="page-wrapper">
151122

152123
<div class="page">
@@ -222,19 +193,19 @@
222193
<main>
223194
{{{ content }}}
224195

225-
<!-- Page footer -->
226-
<hr>
227-
<div class="left" style="width: 75%">
228-
<p>Development of <b>glotzerlab-software</b> is led by the <a href="https://glotzerlab.engin.umich.edu">Glotzer Group</a> at the <a href="https://umich.edu">University of Michigan</a>.
229-
<p>Copyright &#169; 2024 The Regents of the University of Michigan.
230-
</div>
231-
<div class="right">
232-
<a href="https://umich.edu">
233-
<img class="right" src="{{ path_to_root }}images/umich-block-M.svg" alt="University of Michigan logo" style="width: 84px" />
234-
</a>
235-
</div>
236-
<div style="clear:both" />
237-
</main>
196+
<!-- Page footer -->
197+
<hr>
198+
<div class="left" style="width: 75%">
199+
<p>Development of <b>glotzerlab-software</b> is led by the <a href="https://glotzerlab.engin.umich.edu">Glotzer Group</a> at the <a href="https://umich.edu">University of Michigan</a>.
200+
<p>Copyright &#169; 2024 The Regents of the University of Michigan.
201+
</div>
202+
<div class="right">
203+
<a href="https://umich.edu">
204+
<img class="right" src="{{ path_to_root }}images/umich-block-M.svg" alt="University of Michigan logo" style="width: 84px" />
205+
</a>
206+
</div>
207+
<div style="clear:both" />
208+
</main>
238209

239210
<nav class="nav-wrapper" aria-label="Page navigation">
240211
<!-- Mobile navigation buttons -->

0 commit comments

Comments
 (0)