penzai.treescope.foldable_representation.foldable_impl.display_streaming_as_root(root_node: RenderableTreePart, deferreds: Sequence[DeferredWithThunk], roundtrip: bool = False, compressed: bool = True, stealable: bool = False) str | None[source]#

Displays a root node in an IPython notebook in a streaming fashion.

  • root_node – The root node to render.

  • deferreds – Deferred objects to render and splice in.

  • roundtrip – Whether to render in roundtrip mode.

  • compressed – Whether to compress the HTML for display.

  • stealable – Whether to return an extra HTML snippet that allows the streaming rendering to be relocated after it is shown.


If stealable is True, a final HTML snippet which, if inserted into a document, will “steal” the root node rendering, moving the DOM nodes for it into itself. In particular, using this as the HTML rendering of the root node during pretty printing will correctly associate the rendering with the IPython “cell output”, which is visible in some IPython backends (e.g. JupyterLab). If stealable is False, returns None.