@@ -368,6 +368,7 @@ class TryExamplesDirective(SphinxDirective):
368368 "theme" : directives .unchanged ,
369369 "button_text" : directives .unchanged ,
370370 "example_class" : directives .unchanged ,
371+ "warning_text" : directives .unchanged ,
371372 }
372373
373374 def run (self ):
@@ -382,6 +383,7 @@ def run(self):
382383 button_text = self .options .pop ("button_text" , "Try it with Jupyterlite!" )
383384 height = self .options .pop ("height" , None )
384385 example_class = self .options .pop ("example_class" , "" )
386+ warning_text = self .options .pop ("warning_text" , None )
385387
386388 # We need to get the relative path back to the documentation root from
387389 # whichever file the docstring content is in.
@@ -404,7 +406,7 @@ def run(self):
404406 self .state .nested_parse (self .content , self .content_offset , content_node )
405407
406408 if notebook_unique_name is None :
407- nb = examples_to_notebook (self .content )
409+ nb = examples_to_notebook (self .content , warning_text = warning_text )
408410 self .content = None
409411 notebooks_dir = Path (self .env .app .srcdir ) / CONTENT_DIR
410412 notebook_unique_name = f"{ uuid4 ()} .ipynb" .replace ("-" , "_" )
@@ -506,6 +508,7 @@ def _process_autodoc_docstrings(app, what, name, obj, options, lines):
506508 try_examples_options = {
507509 "theme" : app .config .try_examples_global_theme ,
508510 "button_text" : app .config .try_examples_global_button_text ,
511+ "warning_text" : app .config .try_examples_global_warning_text ,
509512 }
510513 try_examples_options = {
511514 key : value for key , value in try_examples_options .items () if value is not None
@@ -614,6 +617,7 @@ def setup(app):
614617
615618 app .add_config_value ("global_enable_try_examples" , default = False , rebuild = True )
616619 app .add_config_value ("try_examples_global_theme" , default = None , rebuild = True )
620+ app .add_config_value ("try_examples_global_warning_text" , default = None , rebuild = True )
617621 app .add_config_value (
618622 "try_examples_global_button_text" ,
619623 default = None ,
0 commit comments