Home

Awesome

htmgrrrl

Package Version Hex Docs

Gleam bindings to htmerl, the fast and memory efficient Erlang HTML SAX parser.

import htmgrrrl.{Characters}

pub fn main() {
  let take_text = fn(state, _line, event) {
    case event {
      Characters(text) -> [text, ..state]
      _ -> state
    }
  }

  "<p>Hello, Joe!</p><p>Hello, Mike!</p>"
  |> htmgrrrl.sax([], take_text)
  // => Ok(["Hello, Mike!", "Hello, Joe!"])
}

Installation

This package can be added to your Gleam project:

gleam add htmgrrrl

and its documentation can be found at https://hexdocs.pm/htmgrrrl.

What's with the name?

It's a Gleam-y play on "htmerl" that makes a nod to Riot Grrrl.