From d770c541605f3d565596eff99e84733856a5f9b7 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Fri, 17 May 2024 07:18:17 -0700 Subject: [PATCH 1/2] Style version dropdown --- docs/_static/css/custom.css | 35 +++++++++++++++++++++++++++++++++++ docs/conf.py | 10 +++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 docs/_static/css/custom.css diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css new file mode 100644 index 000000000..da99f3305 --- /dev/null +++ b/docs/_static/css/custom.css @@ -0,0 +1,35 @@ +/* Improve spacing */ +.version-switcher__container.dropdown { + margin-left: 10px; +} + + +button.btn.version-switcher__button { + margin-bottom: 0px; +} + +/* Show on hover */ +.version-switcher__container.dropdown:hover .dropdown-menu { + display: block; + left: 0; + margin-top: var(--bs-dropdown-spacer); + top: 100%; +} + +.dropdown-menu.show { + display: none; +} + +/* Remove underline and borders */ +button.btn.version-switcher__button:hover { + text-decoration: none; +} + +.version-switcher__menu a.list-group-item { + border: none !important; + +} + +.version-switcher__menu a.list-group-item:hover { + text-decoration: none !important; +} \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 52a59ff6f..29b44b12a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,9 +45,9 @@ ] # These paths are either relative to html_static_path or fully qualified paths (eg. https://...) -# html_css_files = [ -# "css/custom.css", -# ] +html_css_files = [ + "css/custom.css", +] linkcheck_anchors = False @@ -85,6 +85,7 @@ version_match = os.environ.get("READTHEDOCS_VERSION") with open("../package.json") as f: release = json.load(f)["version"] + # If READTHEDOCS_VERSION doesn't exist, we're not on RTD # If it is an integer, we're in a PR build and the version isn't correct. # If it's "latest" → change to "dev" (that's what we want the switcher to call it) @@ -144,3 +145,6 @@ def _correct_signatures(app, what, name, obj, options, signature, return_annotat def setup(app): # This makes the data-interfaces signatures display on the docs/api, they don't otherwise app.connect("autodoc-process-signature", _correct_signatures) + + # Add custom CSS + app.add_css_file("css/custom.css") From 2b2468d75b17af3362c2626a89b0594ce5727d21 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 17 May 2024 14:19:21 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/_static/css/custom.css | 4 +--- docs/conf.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index da99f3305..4e72cecdb 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -3,7 +3,6 @@ margin-left: 10px; } - button.btn.version-switcher__button { margin-bottom: 0px; } @@ -27,9 +26,8 @@ button.btn.version-switcher__button:hover { .version-switcher__menu a.list-group-item { border: none !important; - } .version-switcher__menu a.list-group-item:hover { text-decoration: none !important; -} \ No newline at end of file +} diff --git a/docs/conf.py b/docs/conf.py index 29b44b12a..5067e13b6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -85,7 +85,7 @@ version_match = os.environ.get("READTHEDOCS_VERSION") with open("../package.json") as f: release = json.load(f)["version"] - + # If READTHEDOCS_VERSION doesn't exist, we're not on RTD # If it is an integer, we're in a PR build and the version isn't correct. # If it's "latest" → change to "dev" (that's what we want the switcher to call it)