diff --git a/docs/conf.py b/docs/conf.py index b9fd713f..b60382ed 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -111,6 +111,7 @@ "binderhub_url": "https://mybinder.org", "colab_url": "https://colab.research.google.com/", "deepnote_url": "https://deepnote.com/", + "basthon_url": "https://notebook.basthon.fr/", "notebook_interface": "jupyterlab", "thebe": True, # "jupyterhub_url": "https://datahub.berkeley.edu", # For testing diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index c5b220b0..68f78dba 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -102,6 +102,7 @@ def add_launch_buttons( jupyterhub_url = launch_buttons.get("jupyterhub_url", "").strip("/") binderhub_url = launch_buttons.get("binderhub_url", "").strip("/") colab_url = launch_buttons.get("colab_url", "").strip("/") + basthon_url = launch_buttons.get("basthon_url", "").strip("/") deepnote_url = launch_buttons.get("deepnote_url", "").strip("/") if binderhub_url: url = ( @@ -161,6 +162,18 @@ def add_launch_buttons( } ) + if basthon_url: + url = f"{basthon_url}/?from=https://raw.githubusercontent.com/{org}/{repo}/{branch}/{path_rel_repo}" + launch_buttons_list.append( + { + "type": "link", + "text": "Basthon", + "tooltip": "Launch on Basthon", + "icon": "_static/images/logo_basthon.svg", + "url": url, + } + ) + # Add thebe flag in context if launch_buttons.get("thebe", False): launch_buttons_list.append( diff --git a/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.svg b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.svg new file mode 100644 index 00000000..2b2b9a50 --- /dev/null +++ b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.svg @@ -0,0 +1,62 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/tests/sites/base/conf.py b/tests/sites/base/conf.py index c778039b..9f628a72 100644 --- a/tests/sites/base/conf.py +++ b/tests/sites/base/conf.py @@ -27,6 +27,7 @@ "jupyterhub_url": "https://datahub.berkeley.edu", "colab_url": "https://colab.research.google.com", "deepnote_url": "https://deepnote.com", + "basthon_url": "https://notebook.basthon.fr", "notebook_interface": "jupyterlab", "thebe": True, }, diff --git a/tests/test_build/build__header-article.html b/tests/test_build/build__header-article.html index 74bc3326..b7a6fc73 100644 --- a/tests/test_build/build__header-article.html +++ b/tests/test_build/build__header-article.html @@ -56,6 +56,16 @@ +
  • + + + + + + Basthon + + +
  • +
  • + + + + + + Basthon + + +