Skip to content

Commit

Permalink
Fix incorrect regex usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Jul 29, 2024
1 parent 02a59c1 commit ef2dd31
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions docs/directives/try_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,28 +240,31 @@ The format is a list of

```json
{
"ignore_patterns": ["^/latest/.*", "^/stable/reference/generated/example.html"]
"ignore_patterns": ["^\/latest/.*", "^\/stable\/reference\/generated\/example.html"]
}
```

`TryExamples` buttons will be hidden in url pathnames matching at least one of these
patterns, effectively disabling the interactive documentation. In the provided example:

* The pattern `"^/latest/.*"` disables interactive examples for urls for the documentation
* The pattern `"^\/latest\/.*"` disables interactive examples for urls for the documentation
for the latest version of the package, which may be useful if this documentation is
for a development version for which a corresponding package build is not available
in a Jupyterlite kernel.
in a JupyterLite kernel.

* The pattern `"^/stable/reference/generated/example.html"` targets a particular url
* The pattern `"^\/stable\/reference\/generated\/example.html"` targets a particular url
in the documentation for the latest stable release.

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
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`.
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`. Also, note that since these are JavaScript-based regular
expressions, to use special characters in the regular expression (such as `/`), they
must be escaped with a backslash (`\`).

Again, the configuration file can be added or edited within the deployed documentation,
allowing for disabling or enabling examples without rebuilding the documentation.

#### "global_min_height"

To avoid having unusably small notebooks for very small examples due to the default of
having the embedded notebooks' iframe containers take the same amount of space as the
rendered content they replace, users can set a global minimum height in
Expand Down

0 comments on commit ef2dd31

Please sign in to comment.