Parse HTML 5 in Elm. See https://www.w3.org/TR/html5/syntax.html
run : String -> Result (List Parser.DeadEnd) (List Node)
Run the parser!
run "<div><p>Hello, world!</p></div>"
-- => Ok [ Element "div" [] [ Element "p" [] [ Text "Hello, world!" ] ] ]
An HTML node. It can either be:
( String, String )
An HTML attribute. For instance:
( "href", "https://elm-lang.org" )
If you are building a parser of your own using elm/parser
and
you need to parse HTML... This section is for you!
node : Parser Node
Parse an HTML node.
You can use this in your own parser to add support for HTML 5.
nodeToString : Node -> String
Turn a parser node back into its HTML string.
For instance:
Element "a"
[ ( "href", "https://elm-lang.org" ) ]
[ Text "Elm" ]
|> nodeToString
Produces <a href="https://elm-lang.org">Elm</a>
.