Skip to content

Releases: fuelen/html2text

v0.3.0

04 Apr 16:20

Choose a tag to compare

What's new

convert_rich/2 — annotated rich text output

Returns structured {text, [annotation]} tuples instead of plain text, enabling custom renderers (ANSI terminal, Slack, Discord, etc.).

HTML2Text.convert_rich("<p>Hello <strong>world</strong></p>")
#=> {:ok, [[{"Hello ", []}, {"world", [:strong]}]]}

Annotations: :strong, :emphasis, :strikeout, :code, {:link, url}, {:image, src}, {:preformat, bool}, {:colour, {r, g, b}}, {:bg_colour, {r, g, b}}.

CSS colour extraction supported via use_doc_css: true and css: "..." options.

HTML2Text.HTML — inspectable HTML container

A struct that renders HTML as formatted text with ANSI styles when inspected in IEx. Bold, italic, clickable links (OSC 8), CSS true color, and more — directly in your terminal.

%{body: HTML2Text.HTML.new("<p>Hello <strong>world</strong></p>")}
# In IEx: %{body: #HTML2Text.HTML<Hello **world**>}

empty_img_mode option

Controls how images without alt text are rendered: :ignore (default), {:replace, text}, or :filename.

Other changes

  • Update html2text Rust crate from 0.15.1 to 0.16.7 (rowspan support, <noscript> fix, <b> tag support, various bug fixes)
  • Add HTML2Text.Error custom exception for bang functions
  • Enable css feature for colour extraction

v0.2.0

24 Jun 19:34

Choose a tag to compare

Breaking: add options, bump version to `v0.2.0`

v0.1.1

16 Jun 20:52

Choose a tag to compare

Add DirtyCpu flag, closes #1

v0.1.0

14 Jun 09:26

Choose a tag to compare

Specify targets and nif versions