fuelen
June 14, 2025, 10:12am
1
HTML2Text provides a simple and efficient way to extract readable plain text from HTML content. It leverages the power of Rust’s html2text crate to deliver fast HTML parsing and text extraction while maintaining the logical structure and readability of the content.
HTML to text via Rust NIF
9 Likes
fuelen
June 24, 2025, 7:51pm
2
html2text v0.2.0 released — breaking changes and a cleaner API!
This version introduces a new, more consistent API with proper error handling and an optional keyword list for configuration.
What changed
Before (v0.1.x
):
HTML2Text.convert(html, width)
# => returns plain string
The second argument was required and only accepted a width (integer
or :infinity
)
Errors (like width too narrow) would raise directly
Now (v0.2.0
):
HTML2Text.convert(html, opts)
# => {:ok, result} | {:error, reason}
HTML2Text.convert!(html, opts)
# => result (raises on error)
convert/2
now returns {:ok, text}
or {:error, reason}
convert!/2
is a new function that raises on error (for convenience)
The second parameter is now an optional keyword list of options
1 Like