From 8ffe156c6e8ac69bf3c39bf9905eaaad43211cb5 Mon Sep 17 00:00:00 2001 From: cristianjd Date: Thu, 8 Aug 2024 11:45:09 -0700 Subject: [PATCH] Version Switcher Part 3 (#47019) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why are these changes needed? A few small follow ups for the version switcher: - move constants to inside the versions JSON generation function - updated height of version switcher to be relative so it scales up with zoom level - changed `overflow` to `overflow-y` to stop the extra horizontal scroll from showing up Before: ![Screenshot 2024-08-08 at 9 56 01 AM](https://github.com/user-attachments/assets/ac94b727-ca20-4c3b-8488-347549d19eca) After: ![Screenshot 2024-08-08 at 10 02 21 AM](https://github.com/user-attachments/assets/05813997-bee1-480a-bbcb-e4f02ac88a99) Signed-off-by: cristianjd --- doc/source/_static/css/custom.css | 4 ++-- doc/source/custom_directives.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/source/_static/css/custom.css b/doc/source/_static/css/custom.css index e9f5c4b78a4d..88ee33d2b970 100644 --- a/doc/source/_static/css/custom.css +++ b/doc/source/_static/css/custom.css @@ -410,8 +410,8 @@ table.autosummary tr > td:first-child > p > a > code > span { /* Prevent the the PyData theme Version Switcher from getting too large */ .version-switcher__menu { - max-height: 496px; - overflow: scroll; + max-height: 40rem; + overflow-y: scroll; } /* Hide the RTD version switcher since we are using PyData theme one */ diff --git a/doc/source/custom_directives.py b/doc/source/custom_directives.py index 29a03031bf2a..df46f6e72505 100644 --- a/doc/source/custom_directives.py +++ b/doc/source/custom_directives.py @@ -1227,14 +1227,6 @@ def pregenerate_example_rsts( ) -ray_prefix = "ray-" -min_version = "1.11.0" -repo_url = "https://github.com/ray-project/ray.git" -static_dir_name = "_static" -version_json_filename = "versions.json" -dereference_suffix = "^{}" - - def generate_version_url(version): return f"https://docs.ray.io/en/{version}/" @@ -1244,6 +1236,13 @@ def generate_versions_json(): and generates the JSON needed for the version switcher """ + ray_prefix = "ray-" + min_version = "1.11.0" + repo_url = "https://github.com/ray-project/ray.git" + static_dir_name = "_static" + version_json_filename = "versions.json" + dereference_suffix = "^{}" + version_json_data = [] # Versions that should always appear at the top