diff --git a/docs/conf.py b/docs/conf.py index c050d7d2b..441e4f34c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -113,6 +113,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/docs/content/launch.md b/docs/content/launch.md index 8c851c344..288a3d69a 100644 --- a/docs/content/launch.md +++ b/docs/content/launch.md @@ -67,6 +67,7 @@ html_theme_options = { ... } ``` + ## Deepnote To add [Deepnote](https://deepnote.com) links to your page, add the following configuration: @@ -85,6 +86,23 @@ html_theme_options = { This will create a new Deepnote project every time you click the launch button. ``` +## Basthon + +To add [Basthon](https://basthon.fr/) links to your page, add the following configuration: + +```python +html_theme_options = { + ... + "launch_buttons": { + "basthon_url": "https://notebook.basthon.fr" + }, + ... +} +``` + +```{tip} +By default, a Python kernel is used. You can add "/sql" or "/ocaml" to basthon_url to run a notebook with another language. +``` ## Live code cells with Thebe diff --git a/src/sphinx_book_theme/header_buttons/launch.py b/src/sphinx_book_theme/header_buttons/launch.py index 112872d89..5c254e793 100644 --- a/src/sphinx_book_theme/header_buttons/launch.py +++ b/src/sphinx_book_theme/header_buttons/launch.py @@ -114,6 +114,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("/") # Loop through each provider and add a button for it if needed @@ -188,6 +189,19 @@ def add_launch_buttons( } ) + if basthon_url: + gh = "https://raw.githubusercontent.com" + url = f"{basthon_url}/?from={gh}/{org}/{repo}/{branch}/{path_rel_repo}" + launch_buttons_list.append( + { + "type": "link", + "text": "Basthon", + "tooltip": "Launch on Basthon", + "icon": "_static/images/logo_basthon.png", + "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.png b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.png new file mode 100644 index 000000000..3a440aade Binary files /dev/null and b/src/sphinx_book_theme/theme/sphinx_book_theme/static/images/logo_basthon.png differ diff --git a/tests/sites/base/conf.py b/tests/sites/base/conf.py index 63f37fe83..13ef23f4c 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 bbac6fd67..242ac0236 100644 --- a/tests/test_build/build__header-article.html +++ b/tests/test_build/build__header-article.html @@ -57,6 +57,16 @@ +