Md.Listener behaviour (md v0.3.0) View Source

The listener behaviour to attach to the parser to receive callbacks when the elements are encountered and processed.

Link to this section Summary

Link to this section Types

Specs

attributes() :: nil | %{required(element()) => any()}

Specs

branch() :: {element(), attributes(), [leaf() | branch()]}

Specs

context() ::
  :start
  | :break
  | :linefeed
  | :whitespace
  | :custom
  | {:substitute, {binary(), binary()}}
  | {:esc, binary()}
  | {:char, binary()}
  | {:tag, {binary(), element()}, atom()}
  | :finalize
  | :end

Specs

element() :: atom()

Specs

leaf() :: binary()

Specs

parse_mode() ::
  :idle
  | :finished
  | :raw
  | :skip
  | :comment
  | :magnet
  | :md
  | {:linefeed, non_neg_integer()}
  | {:nested, element(), non_neg_integer()}
  | {:inner, :raw}
  | {:inner, element(), non_neg_integer()}

Specs

state() :: %Md.Parser.State{
  path: [trace()],
  mode: [parse_mode()],
  ast: [branch()],
  listener: nil | module(),
  bag: %{indent: [non_neg_integer()], stock: [branch()], deferred: [binary()]}
}

Specs

trace() :: branch()

Link to this section Callbacks

Specs

element(context(), state()) :: :ok | {:update, state()}