Behaviour for mapping Quillon tokens onto CSS classes.
Quillon.HTML calls class/2 once per node and once per layout or styling
token on that node, then joins whatever comes back into a single class
attribute. Returning nil contributes nothing.
defmodule MyApp.DocClasses do
@behaviour Quillon.HTML.Classes
@impl true
def class(:node, :blockquote), do: "doc-quote"
def class(:align, :center), do: "u-center"
def class(_property, _value), do: nil
end
Quillon.HTML.to_html(doc, classes: MyApp.DocClasses)The property is :node for the node type itself, :mark for a mark type,
and otherwise the attribute name - :align, :spacing, :color and the rest
of the token vocabulary in Quillon.Types. A mapper is called for custom node
and mark types too, so define a catch-all clause.
See Quillon.HTML.Tailwind for a complete implementation.
Summary
Callbacks
Return the classes for one token, or nil for none.