Skip to content

Commit 7281ced

Browse files
classabbyampericonr
andcommitted
src/theme: import theme from mdBook upstream, filter out what's needed
add buttons for printing, editing, and changing to dark theme clean up CSS, including improvements to the print theming Co-authored-by: Érico Nogueira <[email protected]>
1 parent 5500bad commit 7281ced

File tree

7 files changed

+864
-209
lines changed

7 files changed

+864
-209
lines changed

book.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ title = "Void Linux Handbook"
66

77
[output.html]
88
theme = "src/theme"
9+
default-theme = "void-light"
10+
preferred-dark-theme = "void-dark"
11+
edit-url-template = "https://github.com/void-linux/void-docs/edit/master/{path}"
912

1013
[output.html.redirect]
1114
"/about-this-handbook.html" = "/about/about-this-handbook.html"

src/theme/book.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
// Fix back button cache problem
44
window.onunload = function () { };
55

6+
(function theme() {
7+
var html = document.querySelector("html");
8+
var themeToggleButton = document.getElementById("theme-toggle");
9+
10+
themeToggleButton.addEventListener('click', function sidebarToggle() {
11+
if (html.classList.contains("void-light")) {
12+
html.classList.replace("void-light", "void-dark");
13+
localStorage.setItem('mdbook-theme', "void-dark");
14+
} else {
15+
html.classList.replace("void-dark", "void-light");
16+
localStorage.setItem('mdbook-theme', "void-light");
17+
}
18+
});
19+
})();
20+
621
(function sidebar() {
722
var html = document.querySelector("html");
823
var sidebar = document.getElementById("sidebar");

0 commit comments

Comments
 (0)