summarizable_condition

summarizable_condition#

treescope.rendering_parts.summarizable_condition(summary: RenderableTreePart | None = None, detail: RenderableTreePart | None = None) RenderableTreePart[source]#

Builds a part that renders depending on combination of roundtrip/collapsed.

The idea is that, when collapsed and not in roundtrip mode, it’s sometimes convenient to summarize a compound node with a simpler non-roundtrippable representation.

Parameters:
  • summary – Contents to render when collapsed and not in roundtrip mode.

  • detail – Contents to render when either expanded or in roundtrip mode.

Returns:

A renderable part that renders as summary when both collpased and not in roundtrip mode, and as detail otherwise.