// the find
philss/floki
Floki is a simple HTML parser that enables search for nodes using CSS selectors.
Floki is Elixir's standard CSS-selector-based HTML parser/query library — think BeautifulSoup or Nokogiri but for the BEAM. It's the thing you reach for when scraping pages or asserting on rendered Phoenix templates in tests.
Pluggable parser backends: ships with a pure-Erlang mochiweb_html by default (zero native deps) but lets you swap in html5ever (Rust NIF via Rustler, precompiled so no toolchain needed) or fast_html/lexbor (C) when you need spec-correctness or speed. CSS selector support is genuinely deep — nth-child/nth-of-type family, attribute operators, :has() with multiple simple selectors, combinators — plus pragmatic non-standard additions like :fl-contains for text search. Tests the tokenizer against the actual html5lib-tests suite (vendored as a submodule), which is a real signal of correctness effort beyond "it works on my HTML."
The default parser is explicitly non-spec-compliant and up to 20x slower than the alternatives per their own benchmarks — so the zero-config path is the worst option on both correctness and performance, and you only find that out by reading the README closely. Getting the fast/correct parsers means either a Rust NIF or a C compiler + CMake + Make on the build machine, which is friction for anyone who just wants to parse HTML. Document representation is bare tuples ({tag, attrs, children}) with no struct or typespec wrapping — fine for pattern matching, but no compiler help if you get the shape wrong. Still pre-1.0 after many years (0.38.x), so there's no hard stability guarantee even though it's clearly load-bearing in a lot of production Elixir apps.