diff --git a/docs/conf.py b/docs/conf.py index 4817e87fc..ed64cd8ac 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -107,6 +107,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 969950dba..54dd2e4f3 100644 --- a/docs/launch.md +++ b/docs/launch.md @@ -67,6 +67,19 @@ 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" + }, + ... +} +``` ## Live code cells with Thebe diff --git a/sphinx_book_theme/launch.py b/sphinx_book_theme/launch.py index 86da74658..354fc2a60 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,10 @@ def add_hub_urls( url = f"{colab_url}/github/{org}/{repo}/blob/{branch}/{path_rel_repo}" context["colab_url"] = url + if deepnote_url: + url = f"{deepnote_url}/launch?url=https%3A%2F%2Fgithub.com%2F{org}%2F{repo}%2Fblob%2F{branch}%2F{path_rel_repo}" + 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 000000000..2c364d274 --- /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 9d635a524..8f4c1ae5a 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 %}