git.iko.soy/typeable/html-parse
on b426b3e help sign in
14 lines 709 B history raw
1# html-parse
3`html-parse` is an efficient, reasonably robust HTML tokenizer based on the
4HTML5 tokenization
5[specification](https://html.spec.whatwg.org/multipage/syntax.html#tokenization).
6The parser is written using the fast `attoparsec` parsing library and can
7exposes both a native `attoparsec` `Parser` as well as convenience functions for
8lazily parsing token streams out of strict and lazy `Text` values.
10For instance,
11```haskell
12>>> parseTokens "<div><h1>Hello World</h1><br/><p class=widget>Example!</p></div>"
13[TagOpen "div" [],TagOpen "h1" [],ContentText "Hello World",TagClose "h1",TagSelfClose "br" [],TagOpen "p" [Attr "class" "widget"],ContentText "Example!",TagClose "p",TagClose "div"]
14```