Skip to content

Templating Reference

view.templates

__all__ = ('template', 'render', 'markdown') module-attribute

ViewRenderer

parameters = parameters instance-attribute

__init__(parameters: dict[str, Any])

render(content: str) -> str async

markdown(name: str | Path, *, directory: str | Path | None = _ConfigSpecified, app: App | None = None) -> HTML async

Convert a markdown file into HTML. This returns a view.py HTML response.

render(source: str, engine: TemplateEngine = 'view', parameters: dict[str, Any] | None | _CurrentFrameType = _CurrentFrame, *, app: App | None = None) -> str async

Render a template from the source instead of a filename. Generally should be used internally.

template(name: str | Path, directory: str | Path | None = _ConfigSpecified, engine: TemplateEngine | None = _ConfigSpecified, frame: Frame | None | _CurrentFrameType = _CurrentFrame, app: App | None = None, **parameters: Any) -> HTML async

Render a template with the specified engine. This returns a view.py HTML response.