Premailex.HTMLParser behaviour (Premailex v1.0.0)

Copy Markdown View Source

Behaviour for HTML parsing.

By default, Premailex prefers LazyHTML, then Floki, then Meeseeks, falling back to the built-in Premailex.HTMLParser.Xmerl if none are loaded. The active parser can be configured:

config :premailex, html_parser: Premailex.HTMLParser.LazyHTML

Summary

Callbacks

Parses an HTML string into a Premailex.html_tree/0.

Converts a Premailex.html_tree/0 into an HTML string.

Callbacks

parse(html)

@callback parse(Premailex.html()) :: Premailex.html_tree()

Parses an HTML string into a Premailex.html_tree/0.

Adapters raise ArgumentError when the input cannot be parsed.

to_html(html_tree)

@callback to_html(Premailex.html_tree()) :: Premailex.html()

Converts a Premailex.html_tree/0 into an HTML string.