Boxart.Diagram behaviour (Boxart v0.3.2)

Copy Markdown View Source

Behaviour for specialized diagram renderers.

Each renderer implements render/2 which takes a diagram-specific struct and render options, returning a string.

Built-in renderers

Implementing a custom renderer

defmodule MyDiagram do
  @behaviour Boxart.Diagram

  defmodule Model do
    defstruct [:data]
  end

  @impl true
  def render(%Model{} = diagram, opts) do
    # return a string
  end
end

Summary

Callbacks

Renders the diagram as a string.

Types

opts()

@type opts() :: keyword()

Callbacks

render(diagram, opts)

@callback render(diagram :: term(), opts()) :: String.t()

Renders the diagram as a string.