htmy.renderer.default
Renderer
The default renderer.
It resolves component trees by converting them to a linked list of resolved component parts before combining them to the final string.
Source code in htmy/renderer/default.py
__init__(default_context=None, *, string_formatter=xml_format_string)
Initialization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
default_context
|
Context | None
|
The default context to use for rendering if |
None
|
string_formatter
|
Callable[[str], str]
|
Callable that should be used to format plain strings. By default an XML-safe string formatter will be used. |
xml_format_string
|
Source code in htmy/renderer/default.py
render(component, context=None)
async
Renders the given component.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
component
|
Component
|
The component to render. |
required |
context
|
Context | None
|
An optional rendering context. |
None
|
Returns:
Type | Description |
---|---|
str
|
The rendered string. |