build_custom_foldable_tree_node

build_custom_foldable_tree_node#

treescope.rendering_parts.build_custom_foldable_tree_node(contents: RenderableTreePart, path: str | None = None, label: RenderableTreePart = EmptyPart(), expand_state: part_interface.ExpandState = ExpandState.WEAKLY_COLLAPSED) RenderableAndLineAnnotations[source]#

Builds a custom foldable tree node with path buttons.

Parameters:
  • contents – Contents of this foldable that should not open/close the custom foldable when clicked.

  • path – Keypath to this node from the root. If provided, a copy-path button will be added at the end of the node.

  • label – The beginning of the first line, which should allow opening/closing the custom foldable when clicked. Should not contain any other foldables.

  • expand_state – Initial expand state for the foldable.

Returns:

A new renderable part, possibly with a copy button annotation, for use in part of a rendered treescope tree.