diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aad5fdd..071998ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -This extended repository tracks the master branch [sphinx-book-theme] (https://github.com/executablebooks/sphinx-book-theme). The most recent commit of the master incorporated is [8822eef](https://github.com/executablebooks/sphinx-book-theme/commit/8822eeff673f14e627925a51070d5eeaf3360dbe) +This extended repository tracks the master branch [sphinx-book-theme] (https://github.com/executablebooks/sphinx-book-theme). The most recent commit of the master incorporated is [f76b6c3](https://github.com/executablebooks/sphinx-book-theme/commit/f76b6c3957f4beb105555e319d9e662755d17c95) ## The following files have been added: diff --git a/pyproject.toml b/pyproject.toml index bfcd5613..3d67b982 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,8 @@ filterwarnings = [ # Sphinx triggers this '''ignore:'imghdr' is deprecated and slated for removal in Python 3\.13:DeprecationWarning''', '''ignore:'sphinx.util.import_object' is deprecated.:PendingDeprecationWarning''', - 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning' + 'ignore:Parsing dates involving a day of month without a year specified is ambiguious:DeprecationWarning', + 'ignore:Argument "parser_name" will be removed in Docutils 2.0.:PendingDeprecationWarning', ] diff --git a/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss b/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss index f446759f..ba026a3c 100644 --- a/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss +++ b/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss @@ -18,6 +18,15 @@ opacity variables.$animation-time ease 0s, visibility variables.$animation-time ease 0s; + // Hide sidebar when toggle button is clicked on wide screens + &.pst-sidebar-hidden { + @media (min-width: variables.$breakpoint-lg) { + margin-left: -(variables.$sidebar-primary-width-widescreen); + visibility: hidden; + opacity: 0; + } + } + @media (max-width: variables.$breakpoint-md) { // So that tooltips don't overlap z-index: variables.$zindex-tooltip + 1; @@ -28,6 +37,13 @@ border-top: none; } + // Left-align icon badges with standard gap spacing instead of centering + .navbar-icon-links { + display: flex !important; + justify-content: flex-start !important; + gap: 0.5rem !important; + } + // On wide screens we have a smaller sidebar width than PST @media (min-width: variables.$breakpoint-lg) { flex-basis: variables.$sidebar-primary-width-widescreen; diff --git a/src/sphinx_book_theme/header_buttons/__init__.py b/src/sphinx_book_theme/header_buttons/__init__.py index 86ed39fb..286492af 100644 --- a/src/sphinx_book_theme/header_buttons/__init__.py +++ b/src/sphinx_book_theme/header_buttons/__init__.py @@ -117,6 +117,7 @@ def add_header_buttons(app, pagename, templatename, context, doctree): "tooltip": translation("Fullscreen mode"), "icon": "fas fa-expand", "label": "fullscreen-button", + "classes": "pst-navbar-icon", } ) diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 3ab773ea..48b6b5ce 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -54,6 +54,7 @@ def add_launch_buttons( "jupyterhub_url", "thebe", "colab_url", + "jupyterlite_url", "use_lite_button", "use_reveal_button", "use_powerpoint_button", @@ -123,6 +124,9 @@ def add_launch_buttons( binderhub_url = launch_buttons.get("binderhub_url", "").strip("/") colab_url = launch_buttons.get("colab_url", "").strip("/") deepnote_url = launch_buttons.get("deepnote_url", "").strip("/") + # jupyterlite_url could be absolute but without a domain, so we only + # strip trailing slashes, not leading ones + jupyterlite_url = launch_buttons.get("jupyterlite_url", "").rstrip("/") lightning_studios_url = launch_buttons.get("lightning_studios_url", "").strip("/") # Loop through each provider and add a button for it if needed @@ -211,6 +215,19 @@ def add_launch_buttons( "url": url, } ) + if jupyterlite_url: + jl_ext = launch_buttons.get("jupyterlite_ext", extension).strip() + jl_rel_repo = f"{book_relpath}{pagename}{jl_ext}" + url = f"{jupyterlite_url}?path={jl_rel_repo}" + launch_buttons_list.append( + { + "type": "link", + "text": "JupyterLite", + "tooltip": "Launch via JupyterLite", + "icon": "_static/images/logo_jupyterlite.svg", + "url": url, + } + ) # Add thebe flag in context if launch_buttons.get("thebe", False): launch_buttons_list.append(