This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
An HTML parser written in Elm using the elm-tools/parser parsing library.
version 1.1.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 2.0.0
Committed At 2018-02-27 20:09:20 UTC
elm-tools/parser 2.0.1 <= v < 3.0.0 2.0.1
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1

README

elm-parse-html

An HTML parser in Elm using the elm-tools/parser library. This library takes some ideas from jinjor/elm-html-parser, and implements something similar, but with a focus on getting more specific information when parsing fails, and without the querying capabilities that library provides.

import ParseHtml exposing (parseDocument)

parseDocument "<!DOCTYPE html><html></html>"
  == Ok (Element "html" [] [])

parseDocument "<!DOCTYPE html><html><head></head><body><h1>I am a document!</h1><!--I'm a comment!--></body></html>"
  == Ok
    (Element "html"
        []
        [ Element "head" [] []
        , Element "body"
            []
            [ Element "h1" [] [ TextNode "I am a document!" ]
            , Comment "I'm a comment!"
            ]
        ]
    )

TODO

  • Slashless self-closing tags like <br>, <hr>, etc.
  • Escape characters?

Note

For any who may have read my reasons for not using GitHub, this project is hosted on GitHub because the Elm package management system currently only integrates with GitHub. If integrations are implemented for other code hosting sites, I plan to relocate this project somewhere else.