funchaku v0.4.0 Funchaku.Checker

Provides methods to validate HTML on the Nu HTML Checker.

Summary

Functions

Validates the given URL on the Nu HTML Checker

Validates the given text on the Nu HTML Checker

Functions

adapt_message_structure(messages)
check(url, options \\ [])

Validates the given URL on the Nu HTML Checker.

Options:

  • Will use by default the validator at http://validator.w3.org/nu/, this can and should be customized to use your own validator, with the checker_url option.

Examples

iex> { :ok, results } = Funchaku.check("http://validationhell.com")
iex> length(results[:messages])
11
iex> length(results[:errors])
11
iex> length(results[:warnings])
0
iex> List.first(results[:errors])["message"]
"The “align” attribute on the “img” element is obsolete. Use CSS instead."
check_text(html, options \\ [])

Validates the given text on the Nu HTML Checker.

Options:

  • Will use by default the validator at http://validator.w3.org/nu/, this can and should be customized to use your own validator, with the checker_url option.

Examples

iex> { :ok, results } = Funchaku.check_text "<!DOCTYPE html><html></html>"
iex> length(results[:messages])
1
iex> length(results[:non_document_errors])
0
iex> length(results[:errors])
1
iex> length(results[:warnings])
0
iex> List.first(results[:errors])["message"]
"Element “head” is missing a required instance of child element “title”."