Bylaw.HTML.Check behaviour (bylaw_html v0.1.0-alpha.2)

Copy Markdown View Source

Behaviour for checks that validate rendered HTML.

Each check receives a small validation context containing the original HTML string and the parsed document term produced for that HTML.

Summary

Types

Validation context passed to an HTML check.

The result returned by an HTML check.

Callbacks

Validates rendered HTML for one check.

Types

context()

@type context() :: %{html: String.t(), document: term()}

Validation context passed to an HTML check.

html is the original rendered HTML string. document is the parsed HTML document term produced for that string.

result()

@type result() :: :ok | {:error, [Bylaw.HTML.Issue.t(), ...]}

The result returned by an HTML check.

Callbacks

validate(context)

@callback validate(context()) :: result()

Validates rendered HTML for one check.