Module

renderers.protocol

ASTRenderer protocol — stable interface for AST renderers.

Any renderer that implementsrender(node) -> strconforms to this protocol. The built-inHtmlRendereris the reference implementation.

Example:

from patitas.renderers.protocol import ASTRenderer

def render_page(renderer: ASTRenderer, doc: Document) -> str:
    return renderer.render(doc)

Classes

ASTRenderer 1
Protocol for AST renderers. Implementations must accept a Document and return a rendered string. T…

Protocol for AST renderers.

Implementations must accept a Document and return a rendered string. The built-inHtmlRendererconforms to this protocol.

Methods

render 1 str
Render a Document AST to a string.
def render(self, node: Document) -> str
Parameters
Name Type Description
node

The document AST to render.

Returns
str Rendered string output.