ExampleView

The single place an example’s outcome becomes a Readout, shared by the documentation build and the interactive (jdoc) path so they can’t drift apart.

  • block: Any

    the ExampleBlock

  • value: Any

    the value of the block’s last expression (or _NO_VALUE/None)

  • stdout: Any

    the text the block printed

  • to_readout: Any

    override for value_to_readout (a callable (value, options) -> Readout)

  • show_trivial: Any

    show readouts that say next to nothing (a bare number’s one-field record, see is_trivial); None (default) defers to the block’s show_trivial option, which defaults to off

 

__init__(self, block, value=<object instance>, stdout='', to_readout=None, max_output=20000, show_trivial=None): 

 

@property
display(self): 

 

@property
has_value(self): 

 

@property
shows_trivial(self): 

 

node(self, include_code=False, style=None): 

The Readout for this example according to its display option; None for display="none". With include_code the example’s source is shown first. style is the theme the node will be rendered with: a readout that is trivial in it (see is_trivial) is suppressed.

 

to_fragment(self, style=None, x3dom_path=None, css='inline'): 

The embeddable FragmentResult for the site, or None for display="none".

 

to_element(self, mode='static', style=None, css='inline', include_code=True, **opts): 

The code plus its output as an element: mode="static" (plain elements, .tostring()) for pages, mode="widget" for Jupyter. With include_code=False only the output (None for display="none"), for hosts that already show the code.


Feedback

Examples

Templates

Documentation