Remove Mermaid support from mdbook build configuration
This commit is contained in:
@@ -7,10 +7,7 @@ description = "A taxonomy of puzzle design patterns from classic point-and-click
|
|||||||
[output.html]
|
[output.html]
|
||||||
git-repository-url = "https://github.com/noti/puzzle-design-kb"
|
git-repository-url = "https://github.com/noti/puzzle-design-kb"
|
||||||
edit-url-template = "https://github.com/noti/puzzle-design-kb/edit/main/{path}"
|
edit-url-template = "https://github.com/noti/puzzle-design-kb/edit/main/{path}"
|
||||||
additional-js = ["mermaid.min.js", "mermaid-init.js"]
|
|
||||||
|
|
||||||
[output.html.playground]
|
[output.html.playground]
|
||||||
editable = true
|
editable = true
|
||||||
line-numbers = true
|
line-numbers = true
|
||||||
|
|
||||||
[preprocessor.mermaid]
|
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
|
|
||||||
(() => {
|
|
||||||
const darkThemes = ['ayu', 'navy', 'coal'];
|
|
||||||
const lightThemes = ['light', 'rust'];
|
|
||||||
|
|
||||||
const classList = document.getElementsByTagName('html')[0].classList;
|
|
||||||
|
|
||||||
let lastThemeWasLight = true;
|
|
||||||
for (const cssClass of classList) {
|
|
||||||
if (darkThemes.includes(cssClass)) {
|
|
||||||
lastThemeWasLight = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const theme = lastThemeWasLight ? 'default' : 'dark';
|
|
||||||
mermaid.initialize({ startOnLoad: false, theme });
|
|
||||||
|
|
||||||
// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page
|
|
||||||
|
|
||||||
function initThemeButtons() {
|
|
||||||
for (const darkTheme of darkThemes) {
|
|
||||||
const darkBtn = document.getElementById(darkTheme);
|
|
||||||
if (darkBtn) {
|
|
||||||
darkBtn.addEventListener('click', () => {
|
|
||||||
if (lastThemeWasLight) {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const lightTheme of lightThemes) {
|
|
||||||
const lightBtn = document.getElementById(lightTheme);
|
|
||||||
if (lightBtn) {
|
|
||||||
lightBtn.addEventListener('click', () => {
|
|
||||||
if (!lastThemeWasLight) {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
|
||||||
document.addEventListener('DOMContentLoaded', initThemeButtons);
|
|
||||||
} else {
|
|
||||||
initThemeButtons();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
2609
mermaid.min.js
vendored
2609
mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user