From ef2dd313d77c1bb8bccd77531bd508d3f9c9cd80 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:16:39 +0530 Subject: [PATCH] Fix incorrect regex usage instructions --- docs/directives/try_examples.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/directives/try_examples.md b/docs/directives/try_examples.md index 12c0d1c..354252f 100644 --- a/docs/directives/try_examples.md +++ b/docs/directives/try_examples.md @@ -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