Skip to content

Commit 951d7a1

Browse files
fortierqcholdgrafagoose77
committed
Add basthon support
Co-authored-by: Chris Holdgraf <choldgraf@gmail.com> Co-authored-by: Angus Hollands <goosey15@gmail.com>
1 parent 19c973c commit 951d7a1

File tree

7 files changed

+54
-0
lines changed

7 files changed

+54
-0
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"binderhub_url": "https://mybinder.org",
114114
"colab_url": "https://colab.research.google.com/",
115115
"deepnote_url": "https://deepnote.com/",
116+
"basthon_url": "https://notebook.basthon.fr/",
116117
"notebook_interface": "jupyterlab",
117118
"thebe": True,
118119
# "jupyterhub_url": "https://datahub.berkeley.edu", # For testing

docs/content/launch.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ html_theme_options = {
6767
...
6868
}
6969
```
70+
7071
## Deepnote
7172

7273
To add [Deepnote](https://deepnote.com) links to your page, add the following configuration:
@@ -85,6 +86,23 @@ html_theme_options = {
8586
This will create a new Deepnote project every time you click the launch button.
8687
```
8788

89+
## Basthon
90+
91+
To add [Basthon](https://basthon.fr/) links to your page, add the following configuration:
92+
93+
```python
94+
html_theme_options = {
95+
...
96+
"launch_buttons": {
97+
"basthon_url": "https://notebook.basthon.fr"
98+
},
99+
...
100+
}
101+
```
102+
103+
```{tip}
104+
By default, a Python kernel is used. You can add "/sql" or "/ocaml" to basthon_url to run a notebook with another language.
105+
```
88106

89107
## Live code cells with Thebe
90108

src/sphinx_book_theme/header_buttons/launch.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def add_launch_buttons(
114114
jupyterhub_url = launch_buttons.get("jupyterhub_url", "").strip("/")
115115
binderhub_url = launch_buttons.get("binderhub_url", "").strip("/")
116116
colab_url = launch_buttons.get("colab_url", "").strip("/")
117+
basthon_url = launch_buttons.get("basthon_url", "").strip("/")
117118
deepnote_url = launch_buttons.get("deepnote_url", "").strip("/")
118119

119120
# Loop through each provider and add a button for it if needed
@@ -188,6 +189,19 @@ def add_launch_buttons(
188189
}
189190
)
190191

192+
if basthon_url:
193+
gh = "https://raw.githubusercontent.com"
194+
url = f"{basthon_url}/?from={gh}/{org}/{repo}/{branch}/{path_rel_repo}"
195+
launch_buttons_list.append(
196+
{
197+
"type": "link",
198+
"text": "Basthon",
199+
"tooltip": "Launch on Basthon",
200+
"icon": "_static/images/logo_basthon.png",
201+
"url": url,
202+
}
203+
)
204+
191205
# Add thebe flag in context
192206
if launch_buttons.get("thebe", False):
193207
launch_buttons_list.append(
10 KB
Loading

tests/sites/base/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"jupyterhub_url": "https://datahub.berkeley.edu",
2828
"colab_url": "https://colab.research.google.com",
2929
"deepnote_url": "https://deepnote.com",
30+
"basthon_url": "https://notebook.basthon.fr",
3031
"notebook_interface": "jupyterlab",
3132
"thebe": True,
3233
},

tests/test_build/build__header-article.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@
5757
</span>
5858
</a>
5959
</li>
60+
<li>
61+
<a class="btn btn-sm dropdown-item" data-bs-placement="left" data-bs-toggle="tooltip" href="https://notebook.basthon.fr/?from=https://raw.githubusercontent.com/executablebooks/sphinx-book-theme/master/TESTPATH/section1/ntbk.ipynb" target="_blank" title="Launch on Basthon">
62+
<span class="btn__icon-container">
63+
<img src="../_static/images/logo_basthon.png"/>
64+
</span>
65+
<span class="btn__text-container">
66+
Basthon
67+
</span>
68+
</a>
69+
</li>
6070
<li>
6171
<button class="btn btn-sm btn-launch-thebe dropdown-item" data-bs-placement="left" data-bs-toggle="tooltip" onclick="initThebeSBT()" title="Launch Thebe">
6272
<span class="btn__icon-container">

tests/test_build/test_header_launchbtns.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@
4444
</span>
4545
</a>
4646
</li>
47+
<li>
48+
<a class="btn btn-sm dropdown-item" data-bs-placement="left" data-bs-toggle="tooltip" href="https://notebook.basthon.fr/?from=https://raw.githubusercontent.com/executablebooks/sphinx-book-theme/master/TESTPATH/section1/ntbk.ipynb" target="_blank" title="Launch on Basthon">
49+
<span class="btn__icon-container">
50+
<img src="../_static/images/logo_basthon.png"/>
51+
</span>
52+
<span class="btn__text-container">
53+
Basthon
54+
</span>
55+
</a>
56+
</li>
4757
<li>
4858
<button class="btn btn-sm btn-launch-thebe dropdown-item" data-bs-placement="left" data-bs-toggle="tooltip" onclick="initThebeSBT()" title="Launch Thebe">
4959
<span class="btn__icon-container">

0 commit comments

Comments
 (0)