try_examples_global_button_text
does not propagate to custom .. try_examples::
directives
#157
Labels
Description
When using the
try_examples_global_button_text
configuration value to customise the text displayed on every button, the text is used on buttons for docstring-based examples present in the API documentation for a library. However, buttons that are manually created/enabled using the.. try_examples::
directive on code snippets outside of docstrings (such as those written in-line in.rst
files, rather than.py
files) do not respect this configuration and use the placeholder text "Try it with Jupyterliteinstead of the
try_examples_global_button_textvalue set in
conf.py`.It is to be noted that a
:button_text
option is available in order to customise the text for the granularity of a specific button, but doing this for documentation websites where such buttons might be several in number might not make sense.Reproduce
In a standard documentation deployment provided with Sphinx, please follow these steps to reproduce:
try_examples_global_button_text = "Your text here"
toconf.py
.rst
file tracked by Sphinx for inclusion in the built docs, like this:A simple reproducer is available on a PR preview on Read the Docs for the PyWavelets documentation, as follows:
The example mentioned in the
pywt.families()
docstring has the button with the "Try it in your browser" text, as intended:However, on the same page, code snippets coming from
wavelets.rst
, i.e., those not from.. autofunction::
directives:don't have the correct text as mentioned above.
Here is a link to the specified page: https://pywavelets--728.org.readthedocs.build/en/728/ref/wavelets.html
xref: PyWavelets/pywt#728
Expected behavior
The expected behaviour here, IMO, is that
.. try_examples::
, in the absence of an:button_text:
option, should use the value added totry_examples_global_button_text
instead of the "Try it with Jupyterlite" boilerplate/placeholder text (it is a global value, after all, as noted in its name!)Therefore, a summary is as follows:
try_examples_global_button_text
is notNone
, apply it for all examples and.. try_examples::
directives.. try_examples::
directive placed somewhere has a custom:button_text:
, use that instead, overridingtry_examples_global_button_text
Context
jupyterlite-core
(0.2.3
),jupyterlite-sphinx
(0.12.0
)The text was updated successfully, but these errors were encountered: