mailio_html_text (mailio v0.2.0)

HTML to plain text extraction (pure, total).

Used to derive indexable text and previews from text/html parts. This is not a renderer: it strips tags, drops script/style content, inserts line breaks for block-level elements, decodes character references, and collapses whitespace. Good enough for search and preview, deliberately not a layout engine.

Summary

Functions

First N characters of the extracted text, for Email.preview.

Convert an HTML (UTF-8) binary to collapsed plain text. Input that is not valid UTF-8 is reinterpreted as latin1 so the function is total.

Functions

preview(Html, Max)

-spec preview(binary(), pos_integer()) -> binary().

First N characters of the extracted text, for Email.preview.

to_text(Html)

-spec to_text(binary()) -> binary().

Convert an HTML (UTF-8) binary to collapsed plain text. Input that is not valid UTF-8 is reinterpreted as latin1 so the function is total.