ElementorexCms.Renderer (ElementorexCms v0.1.0)

Copy Markdown View Source

Renders documents and nodes with the blocks of a registry.

ElementorexCms.Components.document/1 is the usual entry point in templates; this module is the engine underneath, plus to_html/2 to get a string (emails, caches, the editor canvas).

Every value reaches the blocks cast and sanitized again (see ElementorexCms.Block.assigns/2), and documents are normalized before being rendered, so a stored document cannot inject markup, script or CSS even if it was edited by hand.

Summary

Functions

A render context. Options: :mode, :registry (default ElementorexCms.Registry.default/0) and :data.

Renders one node (and its children) with its block.

HTML of a whole document (its <style> included) or of a single node, as a string.

Functions

context(opts \\ [])

A render context. Options: :mode, :registry (default ElementorexCms.Registry.default/0) and :data.

render_node(node, ctx)

Renders one node (and its children) with its block.

to_html(doc_or_node, opts \\ [])

@spec to_html(ElementorexCms.Document.t() | map(), keyword()) :: String.t()

HTML of a whole document (its <style> included) or of a single node, as a string.

Options: :mode, :registry, :data (like context/1) and, for documents, :class.