render_to_text_as_root

render_to_text_as_root#

treescope.lowering.render_to_text_as_root(root_node: rendering_parts.RenderableTreePart, roundtrip: bool = False, strip_trailing_whitespace: bool = True, strip_whitespace_lines: bool = True) str[source]#

Renders a root node to text.

Parameters:
  • root_node – The root node to render.

  • roundtrip – Whether to render in roundtrip mode.

  • strip_trailing_whitespace – Whether to remove trailing whitespace from lines.

  • strip_whitespace_lines – Whether to remove lines that are entirely whitespace. These lines can sometimes be generated by layout code being conservative about line breaks. Should only be True if strip_trailing_whitespace is True.

Returns:

Text for the rendered node.