Skip to content

Commit

Permalink
add internal end-to-end docs (#1849)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Jan 28, 2025
1 parent 0fef231 commit 0c5e42b
Show file tree
Hide file tree
Showing 7 changed files with 2,833 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ src = "src"
title = "Shotover"

[output.html]
additional-js = ["mermaid.min.js", "mermaid-init.js"]

[output.linkcheck]
# Should we check links on the internet? Enabling this option adds a
# non-negligible performance impact
follow-web-links = false

warning-policy = "error"

[preprocessor]

[preprocessor.mermaid]
command = "mdbook-mermaid"
35 changes: 35 additions & 0 deletions docs/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();
}
});
}
})();
2,186 changes: 2,186 additions & 0 deletions docs/mermaid.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
- [Shotover sidecars](./examples/cassandra-cluster-shotover-sidecar.md)
- [Contributing](./dev-docs/contributing.md)
- [Debugging](./dev-docs/debugging.md)
- [Internal End-to-End Overview](./dev-docs/end-to-end-overview.md)
596 changes: 596 additions & 0 deletions docs/src/dev-docs/end-to-end-overview.md

Large diffs are not rendered by default.

Binary file added docs/src/dev-docs/end-to-end-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions website/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ fn main() {
return;
}

if !Command::new("cargo")
.args(["install", "mdbook-mermaid", "--version", "0.14.0"])
.status()
.unwrap()
.success()
{
return;
}

let root = current_dir.join("website").join("root");
std::fs::remove_dir_all(&root).ok();
std::fs::create_dir_all(&root).unwrap();
Expand Down

0 comments on commit 0c5e42b

Please sign in to comment.