htmy.renderer
HTMY
HTMY component renderer.
Source code in htmy/renderer.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.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. If |
None
|
Returns:
Type | Description |
---|---|
str
|
The rendered string. |