Readmix.Context behaviour (readmix v0.2.1)

Defines the context behaviour for Readmix contexts.

A context is used to define variables used in Readmix blocks, such as:

<!-- rdmx :app_dep vsn:$my_custom_variable -->
some content
<!-- rdmx /:app_dep -->

To define $my_custom_variable, a context module could be defined like so:

defmodule MyContext do
  @behaviour Readmix.Context

  @impl true
  def get_vars do
    %{my_custom_variable: "1.2.3"}
  end
end

Context can be provided with the :contexts options for Readmix.new/1.

Summary

Types

vars()

@type vars() :: %{optional(atom()) => term()}

Callbacks

get_vars()

@callback get_vars() :: vars()