Skip to content

Commit 0015c81

Browse files
Use global values for example_class, warning
1 parent 244de38 commit 0015c81

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

jupyterlite_sphinx/jupyterlite_sphinx.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,31 @@ def run(self):
382382

383383
# Use button_text from try_examples_global_button_text if not provided
384384
if self.env.config.try_examples_global_button_text is not None:
385-
button_text = self.options.pop(
385+
button_text = self.options.get(
386386
"button_text", self.env.config.try_examples_global_button_text
387387
)
388388
else:
389389
button_text = self.options.pop("button_text", "Try it with JupyterLite!")
390+
391+
# Use warning_text from try_examples_global_warning_text if not provided
392+
if self.env.config.try_examples_global_warning_text is not None:
393+
warning_text = self.options.get(
394+
"warning_text", self.env.config.try_examples_global_warning_text
395+
)
396+
else:
397+
warning_text = self.options.pop("warning_text", None)
398+
399+
# Keep height as is because it is specific to the example being embedded
400+
# into the notebook
390401
height = self.options.pop("height", None)
391-
example_class = self.options.pop("example_class", "")
392-
warning_text = self.options.pop("warning_text", None)
402+
403+
# Use example_class from try_examples_global_theme if not provided
404+
if self.env.config.try_examples_global_theme is not None:
405+
example_class = self.options.get(
406+
"example_class", self.env.config.try_examples_global_theme
407+
)
408+
else:
409+
example_class = self.options.pop("example_class", "")
393410

394411
# We need to get the relative path back to the documentation root from
395412
# whichever file the docstring content is in.

0 commit comments

Comments
 (0)