diff --git a/docs/conf.py b/docs/conf.py index 001d9696..7c9c3520 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -108,6 +108,7 @@ "binderhub_url": "https://mybinder.org", # "jupyterhub_url": "https://datahub.berkeley.edu", # For testing "colab_url": "https://colab.research.google.com/", + "deepnote_url": "https://deepnote.com/", "notebook_interface": "jupyterlab", "thebe": True, }, diff --git a/docs/launch.md b/docs/launch.md index 4e0dc7d4..476f8077 100644 --- a/docs/launch.md +++ b/docs/launch.md @@ -67,6 +67,24 @@ html_theme_options = { ... } ``` +## Deepnote + +To add [Deepnote](https://deepnote.com) links to your page, add the following configuration: + +```python +html_theme_options = { + ... + "launch_buttons": { + "deepnote_url": "https://deepnote.com" + }, + ... +} +``` + +```{warning} +This will create a new Deepnote project every time you click the launch button. +``` + ## Live code cells with Thebe diff --git a/sphinx_book_theme/launch.py b/sphinx_book_theme/launch.py index 86da7465..65237f91 100644 --- a/sphinx_book_theme/launch.py +++ b/sphinx_book_theme/launch.py @@ -95,6 +95,7 @@ def add_hub_urls( jupyterhub_url = launch_buttons.get("jupyterhub_url") binderhub_url = launch_buttons.get("binderhub_url") colab_url = launch_buttons.get("colab_url") + deepnote_url = launch_buttons.get("deepnote_url") if binderhub_url: url = ( f"{binderhub_url}/v2/gh/{org}/{repo}/{branch}?" @@ -113,6 +114,11 @@ def add_hub_urls( url = f"{colab_url}/github/{org}/{repo}/blob/{branch}/{path_rel_repo}" context["colab_url"] = url + if deepnote_url: + github_path = f"%2F{org}%2F{repo}%2Fblob%2F{branch}%2F{path_rel_repo}" + url = f"{deepnote_url}/launch?url=https%3A%2F%2Fgithub.com{github_path}" + context["deepnote_url"] = url + # Add thebe flag in context if launch_buttons.get("thebe", False): context["use_thebe"] = True diff --git a/sphinx_book_theme/static/images/logo_deepnote.svg b/sphinx_book_theme/static/images/logo_deepnote.svg new file mode 100644 index 00000000..fa77ebfc --- /dev/null +++ b/sphinx_book_theme/static/images/logo_deepnote.svg @@ -0,0 +1 @@ + diff --git a/sphinx_book_theme/topbar/launchbuttons.html b/sphinx_book_theme/topbar/launchbuttons.html index 9d635a52..33535786 100644 --- a/sphinx_book_theme/topbar/launchbuttons.html +++ b/sphinx_book_theme/topbar/launchbuttons.html @@ -1,5 +1,5 @@ -{% if binder_url or jupyterhub_url or colab_url or use_thebe %} +{% if binder_url or jupyterhub_url or colab_url or deepnote_url or use_thebe %}