You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/use.md
+13-19Lines changed: 13 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,15 @@ There are two steps to using `sphinx-thebe`. First, you must mark certain
6
6
parts of your page as "ready for thebe". Next, you must insert a button onto
7
7
the page to tell Thebe to initialize.
8
8
9
-
```{tip}
10
-
The examples on this page use a flavor of markdown called [MyST Markdown](https://myst-parser.readthedocs.io/en/latest/).
11
-
However you can also use reStructuredText with `sphinx-thebe` in the same way. See
12
-
[](examples/rst) for some tips.
13
-
```
9
+
:::{admonition,tip} Using reStructuredText vs. MyST Markdown
10
+
The examples on this page use **MyST Markdown syntax**, a form of markdown that works with Sphinx directives. You can also use reStructuredText if you wish. For information about reStructuredText vs. MyST Markdown, see [the MyST Parser documentation](https://myst-parser.readthedocs.io/en/latest/using/syntax.html) as well as [](examples/rst) for some tips.
11
+
:::
14
12
15
13
### Mark elements for thebe
16
14
17
15
By default, thebe will be run on any elements in your documentation that contain
18
16
the class `thebe` and that have a `<pre`> element underneath them.
19
17
20
-
```{note}
21
-
This documentation is written in [MyST Markdown](https://myst-parser.readthedocs.io),
22
-
so the syntax for writing directives looks different from reStructuredText. However,
23
-
rST works just fine as well.
24
-
```
25
-
26
18
You can add code blocks like so:
27
19
28
20
````
@@ -107,13 +99,15 @@ import matplotlib.pyplot as plt
107
99
plt.scatter(*data, c=data[0], s=200)
108
100
```
109
101
110
-
###Interactive outputs
102
+
## Interactive outputs
111
103
112
-
Interactive outputs are still a little bit flaky, but please try out
113
-
`sphinx-thebe` with the interactive visualization library of your choice,
114
-
and report back how things work!
104
+
Interactive outputs work with `sphinx-thebe`**if their web dependencies are loaded**.
105
+
106
+
Many interactive libraries assume that some javascript packages are pre-loaded in a notebook environment. For example, both Jupyter Lab and Notebook come bundled with `require.js`. To use visualization libraries that depend on this, **you must load these libraries on your own in Sphinx**. To do so, you can add the following to your `conf.py`:
107
+
108
+
```python
109
+
defsetup(app):
110
+
app.add_js_file("url-of-package.js")
111
+
```
115
112
116
-
As a general rule, `sphinx-thebe` will only work with interactive libraries
117
-
that are able to output self-contained bundles of HTML/JS that work on their own.
118
-
Many Jupyter environments have libraries pre-loaded, and that will not be the case
119
-
with `sphinx-thebe`.
113
+
Note that some visualization libraries output *bundles of JavaScript/HTML* that will work out-of-the-box. You should consult the documentation of the library you wish to use in order to figure out how to configure it properly. See [the `thebe` examples](https://thebe.readthedocs.io/en/latest/) for examples of some popular visualization libraries.
0 commit comments