Skip to content

Commit

Permalink
Merge pull request #32 from YoubetDao/feature/rlp
Browse files Browse the repository at this point in the history
feat: Add RLP translation
  • Loading branch information
wfnuser authored Feb 6, 2025
2 parents fdcdb19 + f80d0bf commit 5f47839
Show file tree
Hide file tree
Showing 4 changed files with 2,419 additions and 1 deletion.
5 changes: 4 additions & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ title = "youbet-tutorial"

[output.html]
additional-css = ["custom.css"]
additional-js = ["custom.js"]
additional-js = ["custom.js", "mermaid.min.js", "mermaid-init.js"]
git-repository-url = "https://github.com/youbetdao/epf-protocol-cn/"
git-repository-icon = "fa-github"

[preprocessor.katex]
after = ["links"]

[preprocessor.mermaid]
command = "mdbook-mermaid"
35 changes: 35 additions & 0 deletions mermaid-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(() => {
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: true, theme });

// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page

for (const darkTheme of darkThemes) {
document.getElementById(darkTheme).addEventListener('click', () => {
if (lastThemeWasLight) {
window.location.reload();
}
});
}

for (const lightTheme of lightThemes) {
document.getElementById(lightTheme).addEventListener('click', () => {
if (!lastThemeWasLight) {
window.location.reload();
}
});
}
})();
Loading

0 comments on commit 5f47839

Please sign in to comment.