File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,7 @@ as the first non-empty line under
202202the section header for an examples section will prevent a directive from being inserted,
203203allowing for specification of examples sections which should not be made interactive.
204204
205+ A code cell containing common setup code (similar to ` pytest ` 's ` doctest_namespace ` ) can be added using ` try_examples_preamble ` .
205206
206207The button text, theme, and warning text can be set globally with the config variables
207208` try_examples_global_button_text ` , ` try_examples_global_theme ` , and ` try_examples_global_warning_text `  in ` conf.py ` ;
@@ -213,6 +214,11 @@ global_enable_try_examples = True
213214try_examples_global_button_text =  " Try it in your browser!" 
214215try_examples_global_height =  " 200px" 
215216try_examples_global_warning_text =  " Interactive examples are experimental and may not always work as expected." 
217+ try_examples_preamble =  """ 
218+ import datetime as dt 
219+ 
220+ now = dt.datetime.now() 
221+ """ 
216222``` 
217223
218224There is no option to set a global specific height because the proper height
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments