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/directives/try_examples.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,3 +166,41 @@ allowing for specification of examples sections which should not be made interac
166
166
If you are using the `TryExamples` directive in your documentation, you'll need to ensure
167
167
that the version of the package installed in the Jupyterlite kernel you are using
168
168
matches that of the version you are documenting.
169
+
170
+
## Configuration without rebuilding
171
+
172
+
The `TryExamples` directive supports disabling interactive examples without rebuilding
173
+
the documentation. This can be helpful for projects requiring substantial documentation
174
+
build time. Users may add a json config file entitled `.try_examples.json` to the root
175
+
directory of the build directory for the deployed documentation. The format is a list of
176
+
[JavaScript Regex patterns](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions) attached to the key `"ignore_patterns"` like below.
`TryExamples` buttons will be hidden in url pathnames matching at least one of these
185
+
patterns, effectively disabling the interactive documentation. In the provided example:
186
+
187
+
* The pattern `".*latest/.*" disables interactive examples for urls for the documentation
188
+
for the latest version of the package, which may be useful if this documentation is
189
+
for a development version for which a corresponding package build is not available
190
+
in a Jupyterlite kernel.
191
+
192
+
* The pattern `".*stable/reference/generated/example.html"` targets a particular url
193
+
in the documentation for the latest stable release.
194
+
195
+
Note that these patterns should match the [pathname](https://developer.mozilla.org/en-US/docs/Web/API/Location/pathname) of the url, not the full url. This is the path portion of
196
+
the url. For instance, the pathname of https://jupyterlite-sphinx.readthedocs.io/en/latest/directives/try_examples.html is `/en/latest/directives/try_examples.html`.
197
+
198
+
199
+
A default configuration file can be specified in `conf.py` with the option
0 commit comments