BaseBoxWithOutline

BaseBoxWithOutline#

class penzai.treescope.foldable_representation.basic_parts.BaseBoxWithOutline[source]#

Bases: RenderableTreePart, ABC

An outlined box, which displays in “block” mode when rendered to HTML.

Outlined boxes ensure that their child appears as a contiguous chunk, instead of having its first line indented, so that it can be fully encapsulated in a box.

When rendered to HTML, this class may or may not insert extra newlines before and after the child, depending on whether this child was already alone on its line. When rendered to text, we always insert extra comments above and below the line.

A specific type of outlined box can be implemented by subclassing this class.

To allow the box to be collapsed separately, consider wrapping it in a foldable node.

Variables:

child (RenderableTreePart) – The child to render.

Inherited Attributes

collapsed_width

The length of this rendering if collapsed in one line, in characters.

newlines_in_expanded_parent

The number of newlines in this rendering if in an expanded parent.

tags_in_this_part

Returns a set of "tag" objects contained in this part.

Methods

__init__(child)

foldables_in_this_part()

html_setup_parts(context)

render_to_html(stream, *[, at_beginning_of_line])

render_to_text(stream, *, expanded_parent, ...)

Attributes

collapsed_width

The length of this rendering if collapsed in one line, in characters.

newlines_in_expanded_parent

The number of newlines in this rendering if in an expanded parent.

tags_in_this_part

Returns a set of "tag" objects contained in this part.

child