build_one_line_tree_node

build_one_line_tree_node#

penzai.treescope.foldable_representation.common_structures.build_one_line_tree_node(line: RenderableAndLineAnnotations | RenderableTreePart | str, path: tuple[Any, ...] | None = None, background_color: str | None = None, background_pattern: str | None = None) RenderableAndLineAnnotations[source]#

Builds a single-line tree node with path buttons and hyperlink support.

Parameters:
  • line – Contents of the line.

  • path – Keypath to this node from the root. If provided, copy-path buttons will be added, and this node will be possible to target with hyperlinks.

  • background_color – Optional background and border color for this node.

  • background_pattern – Optional background pattern as a CSS “image”. If provided, background_color must also be provided, and will be used as the border for the pattern.

Returns:

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