@@ -53,7 +53,7 @@ to your JupyterLite deployment.
53
53
jupyterlite_config = "jupyterlite_config.json"
54
54
```
55
55
56
- ## Strip particular tagged cells from IPython Notebooks
56
+ ## Strip particular tagged cells from notebooks
57
57
58
58
When using the ` NotebookLite ` , ` JupyterLite ` , or ` Voici ` directives with a notebook passed to them, you can
59
59
strip particular tagged cells from the notebook before rendering it in the JupyterLite console.
@@ -64,7 +64,7 @@ This behaviour can be enabled by setting the following config:
64
64
strip_tagged_cells = True
65
65
```
66
66
67
- and then by tagging the cells you want to strip with the tag ` jupyterlite_sphinx_strip ` in the JSON metadata
67
+ and then by tagging the cells you want to strip with the ` jupyterlite_sphinx_strip ` tag in the JSON metadata
68
68
of the cell, like this:
69
69
70
70
``` json
@@ -77,7 +77,7 @@ of the cell, like this:
77
77
78
78
This is useful when you want to remove some cells from the rendered notebook in the JupyterLite
79
79
console, for example, cells that are used for adding reST-based directives or other
80
- Sphinx-specific content.
80
+ Sphinx-specific content. It can be used to remove either code cells or Markdown cells.
81
81
82
82
For example, you can use this feature to remove the ` toctree ` directive from the rendered notebook
83
83
in the JupyterLite console:
@@ -115,9 +115,43 @@ in the JupyterLite console:
115
115
where the cell with the ` toctree ` directive will be removed from the rendered notebook in
116
116
the JupyterLite console.
117
117
118
+ In the case of a MyST notebook, you can use the following syntax to tag the cells:
119
+
120
+ ```` markdown
121
+
122
+ +++ {"tags": ["jupyterlite_sphinx_strip"]}
123
+
124
+ # Heading 1
125
+
126
+ This is a Markdown cell that will be stripped from the rendered notebook in the
127
+ JupyterLite console.
128
+
129
+ +++
130
+
131
+ ```{code-cell} ipython3
132
+ :tags: [jupyterlite_sphinx_strip]
133
+
134
+ # This is a code cell that will be stripped from the rendered notebook in the
135
+ # JupyterLite console.
136
+ def foo():
137
+ print(3)
138
+ ```
139
+
140
+ ```{code-cell} ipython3
141
+ # This cell will not be stripped
142
+ def bar():
143
+ print(4)
144
+ ```
145
+ ````
146
+
147
+ The Markdown cells are not wrapped, and hence the ` +++ ` and ` +++ ` markers are used to
148
+ indicate where the cells start and end. For more details around writing and customising
149
+ MyST-flavoured notebooks, please refer to the
150
+ [ MyST Markdown overview] ( https://jupyterbook.org/en/stable/content/myst.html ) .
151
+
118
152
Note that this feature is only available for the ` NotebookLite ` , ` JupyterLite ` , and the
119
- ` Voici ` directives and works with the ` .ipynb ` files passed to them. It is not implemented
120
- for the ` TryExamples ` directive.
153
+ ` Voici ` directives and works with the ` .md ` (MyST) or ` . ipynb` files passed to them. It
154
+ is not implemented for the ` TryExamples ` directive.
121
155
122
156
## Disable the ` .ipynb ` docs source binding
123
157
0 commit comments