The behavior of a rendering target (spec/10 §2.2), visualize's Visualize.Backend:
what Macaw.Draw.Render.render/3 dispatches a path, a node and a list of nodes to.
Each callback answers {:ok, output} or {:error, faults}, a fault {path, reason}
with the path the child indexes from the root (spec/10 §2.5); a target never raises on a
scene. wrap_root/2 is optional: a target that writes a document around a list of nodes
implements it.
Summary
Callbacks
A node and everything under it.
A path written alone, with the target's options.
A list of nodes, a whole scene.
Written output wrapped in the target's document.
Types
@type error() :: {:error, [Macaw.Base.Fault.t()]}
A refusal: faults with their paths.
A target's output: markup, a command list, a byte stream.
Callbacks
@callback render_node(Macaw.Draw.IR.Element.t(), keyword()) :: {:ok, output()} | error()
A node and everything under it.
@callback render_path(Macaw.Draw.IR.Path.t(), keyword()) :: {:ok, output()} | error()
A path written alone, with the target's options.
@callback render_scene([Macaw.Draw.IR.Element.t()], keyword()) :: {:ok, output()} | error()
A list of nodes, a whole scene.
Written output wrapped in the target's document.