hecrj/html-parser/2.1.0

NOTE: the latest version is 2.4.0

Html.Parser

run : String -> Result (List DeadEnd) (List Node)

Run the parser!

run "<div><p>Hello, world!</p></div>"
-- => Ok [ Element "div" [] [ Element "p" [] [ Text "Hello, world!" ] ] ]
type Node
= Text String
| Element String (List Attribute) (List Node)
| Comment String

An HTML node. It can either be:

  • Text
  • Element (with its tag name, attributes and children)
  • Comment
type alias Attribute =
( String, String )

An HTML attribute. For instance:

( "href", "https://elm-lang.org" )