Skip to content

Commit

Permalink
Remove Turing's navbar from MCMCDiagnosticTools page
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Jul 14, 2024
1 parent 49ec046 commit b230008
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/assets/hide_turing_menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Remove the Turing navigation menu from the documentation pages,
// if present. Tested against the navbar code defined in
// https://github.com/TuringLang/turinglang.github.io/blob/3e4f5900d90e014a939867e3fe1ac256bdd37f14/assets/scripts/TuringNavbar.html
document.addEventListener("DOMContentLoaded", function () {
var navElement = document.querySelector('nav.ext-navigation');
if (navElement) {
// Remove the <style> tag before the <nav> element
var prevElement = navElement.previousElementSibling;
if (prevElement && prevElement.tagName.toLowerCase() === 'style') {
prevElement.parentNode.removeChild(prevElement);
}

// Remove the <nav> element
navElement.parentNode.removeChild(navElement);

// Remove the <script> tag after the <nav> element
var nextElement = navElement.nextElementSibling;
if (nextElement && nextElement.tagName.toLowerCase() === 'script') {
nextElement.parentNode.removeChild(nextElement);
}
}
});
5 changes: 5 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ MultiDocumenter.make(
index_versions=["stable"], engine=MultiDocumenter.FlexSearch
),
brand_image=MultiDocumenter.BrandImage(".", joinpath("assets", "logo.png")),
custom_scripts=Any[joinpath("assets", "hide_turing_menu.js")]
)

# download logo
Expand All @@ -85,6 +86,10 @@ Downloads.download(
joinpath(assets_dir, "logo.png");
verbose=true,
)
cp(
joinpath(@__DIR__, "assets", "hide_turing_menu.js"),
joinpath(assets_dir, "hide_turing_menu.js"),
)

# deploy to GitHub Pages
git_root = normpath(joinpath(@__DIR__, ".."))
Expand Down

0 comments on commit b230008

Please sign in to comment.