Skip to content

Commit

Permalink
src/theme: import theme from mdBook upstream, filter out what's needed
Browse files Browse the repository at this point in the history
add buttons for printing, editing, and changing to dark theme
clean up CSS, including improvements to the print theming

Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
  • Loading branch information
classabbyamp and ericonr committed Jun 2, 2022
1 parent cd6e32f commit d16b3dd
Show file tree
Hide file tree
Showing 7 changed files with 864 additions and 209 deletions.
3 changes: 3 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ title = "Void Linux Handbook"

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

[output.html.redirect]
"/about-this-handbook.html" = "/about/about-this-handbook.html"
Expand Down
15 changes: 15 additions & 0 deletions src/theme/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
// Fix back button cache problem
window.onunload = function () { };

(function theme() {
var html = document.querySelector("html");
var themeToggleButton = document.getElementById("theme-toggle");

themeToggleButton.addEventListener('click', function sidebarToggle() {
if (html.classList.contains("void-light")) {
html.classList.replace("void-light", "void-dark");
localStorage.setItem('mdbook-theme', "void-dark");
} else {
html.classList.replace("void-dark", "void-light");
localStorage.setItem('mdbook-theme', "void-light");
}
});
})();

(function sidebar() {
var html = document.querySelector("html");
var sidebar = document.getElementById("sidebar");
Expand Down
Loading

0 comments on commit d16b3dd

Please # to comment.