# protocol

URL: /patitas/api/renderers/protocol/
Section: renderers
Description: ASTRenderer protocol — stable interface for AST renderers.

Any renderer that implements ``render(node) -> str`` conforms to this protocol.
The built-in ``HtmlRenderer`` is the reference implementation.

Example:
    from patitas.renderers.protocol import ASTRenderer

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

---

> For a complete page index, fetch /patitas/llms.txt.

Open LLM text
(/patitas/api/renderers/protocol/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Frenderers%2Fprotocol%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Frenderers%2Fprotocol%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Frenderers%2Fprotocol%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Frenderers%2Fprotocol%2Findex.txt)

Module

#
`renderers.protocol`

ASTRenderer protocol — stable interface for AST renderers.

Any renderer that implements`render(node) -> str`conforms to this protocol.
The built-in`HtmlRenderer`is the reference implementation.

Example:

```
from patitas.renderers.protocol import ASTRenderer

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

1Class

## Classes

`ASTRenderer`

1

▼

Protocol for AST renderers.

Implementations must accept a Document and return a rendered string.
T…

Bases:

`Protocol`

Protocol for AST renderers.

Implementations must accept a Document and return a rendered string.
The built-in `HtmlRenderer` (/patitas/api/renderers/html/#HtmlRenderer) conforms 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.
