diff --git a/docs/Makefile b/docs/Makefile index 49b85240..0352c612 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -80,7 +80,7 @@ onlinehelpinfo: .PHONY: html html: ${GENERATED_SYNOPSIS} images/proxmox-logo.svg custom.css conf.py ${PRUNE_SIMULATOR_FILES} $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - install -m 0644 custom.css images/proxmox-logo.svg $(BUILDDIR)/html/_static/ + install -m 0644 custom.js custom.css images/proxmox-logo.svg $(BUILDDIR)/html/_static/ install -dm 0755 $(BUILDDIR)/html/prune-simulator install -m 0644 ${PRUNE_SIMULATOR_FILES} $(BUILDDIR)/html/prune-simulator @echo diff --git a/docs/conf.py b/docs/conf.py index 92a9ecb3..0e741124 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -229,6 +229,10 @@ html_favicon = 'images/favicon.ico' # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] +html_js_files = [ + 'custom.js', +] + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. diff --git a/docs/custom.js b/docs/custom.js new file mode 100644 index 00000000..7964b2cb --- /dev/null +++ b/docs/custom.js @@ -0,0 +1,7 @@ +window.addEventListener('DOMContentLoaded', (event) => { + let activeSection = document.querySelector("a.current"); + if (activeSection) { + // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView + activeSection.scrollIntoView({ block: 'center' }); + } +});