treescope.rendering_parts#
Parts and builders for Treescope’s intermediate output format.
The functions exposed here can be used to construct a tree of parts that can be rendered to text or to interactive HTML. Node handlers and the __treescope_repr__ method can use them to render custom types.
Note that the internal definition of RenderableTreePart
is considered an
implementation detail, and is subject to change. To build renderable tree parts,
you should instead use the functions exposed here (or higher-level wrappers in
treescope.repr_lib
).
Classes
Abstract base class for a formatted part of a foldable tree. |
|
Groups a main renderable with some line comments. |
|
Enum for expand states. |
|
alias of |
Functions
Concatenates tree parts and appends their line comments at the end. |
|
Returns an empty part. |
|
Wraps a child so that selections outside it don't include it. |
|
|
Builds a part that renders differently when collapsed or expanded. |
|
Wraps a child into an outlined box. |
|
Builds a IndentedChildren instance, supporting annotations and delimiters. |
|
Builds a part that renders its children on separate lines. |
|
Builds a part that renders differently in roundtrip mode. |
|
Combines siblings that may have annotations, aggregating separately. |
|
Builds a Siblings part from inline arguments. |
|
Builds a part that renders depending on combination of roundtrip/collapsed. |
|
Builds a one-line text part. |
|
Returns a vertical space with the given height in HTML mode. |
|
Returns a part that marks its child for layout purposes. |
|
Builds a copy-path button, if |
|
Builds a custom foldable tree node with path buttons. |
Builds a foldable tree node with path buttons. |
|
|
Builds a single-line tree node with path buttons. |
Formats the name of a type so that it is qualified in roundtrip mode. |
|
|
Returns a wrapped child in a color for non-roundtrippable abbreviations. |
|
Returns a wrapped child in a color for comments, but only when expanded. |
|
Returns a wrapped child in a color for comments. |
|
Returns a wrapped child that renders in a particular CSS color. |
|
Returns a wrapped child in italics to indicate a deferred placeholder. |
|
Returns a wrapped child in red to indicate errors / problems during rendering. |
|
Returns a wrapped child in a small font to indicate a qualified name. |
|
Returns a wrapped child with a custom CSS style. |
|
Renders a set of fields/attributes into a list of comma-separated children. |
Renders the constructor for a dataclass, including the open parenthesis. |
|
|
Returns a wrapped child in a color for non-roundtrippable abbreviations. |