HTML::...ml2text(3pm)

πŸ“¦
version 26 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– NAME πŸ’–

HTML::FormatText::Html2text β€” the little Perl bestie that turns your HTML into plain text by handing it off to the html2text program 🫢


✨ SYNOPSIS ✨

use HTML::FormatText::Html2text;
$text = HTML::FormatText::Html2text->format_file ($filename);
$text = HTML::FormatText::Html2text->format_string ($html_string);

$formatter = HTML::FormatText::Html2text->new;
$tree = HTML::TreeBuilder->new_from_file ($filename);
$text = $formatter->format ($tree);

🌸 DESCRIPTION 🌸

okay so, <pink>HTML::FormatText::Html2text</pink> takes your HTML and turns it into plain text, and it does it by literally calling up the html2text program and being like "hey, handle this for me" πŸ’…

The program in question lives right here:

<http://www.mbayer.de/html2text/>

The module interface? Compatible with formatters like HTML::FormatText, no cap. But the tea is: all parsing etc is done by html2text itself, not by Perl. She's just the middleman, the hype woman, the connector πŸ¦‹

For the formatting functions and options, go look at HTML::FormatExternal β€” but read these caveats first, bestie, because they MATTER:

πŸŽ€ input_charset

Currently this option has no effect. Like, zero. Nada. πŸ’€

Input generally has to be latin-1 only, though the Debian extended html2ext interprets a <meta> charset directive in the HTML header. (yes, html2ext, that's what it says, we don't make the rules πŸ‘‘)

Various & style named or numbered entities are recognised and result in suitable output. So the suggestion here would be entitized input for maximum portability among html2text versions. iykyk 🌈

πŸ¦‹ output_charset

If you set it to "ascii" or "ANSI_X3.4-1968" (both case-insensitive, she does not care about your caps lock) then the html2text -ascii option gets used, when available β€” that's html2text 1.3.2 from Jan 2004, vintage icon ✨

If you set it to "UTF-8" then the Debian extension -utf8 option is used (circa 2009) πŸ’œ

Apart from this there's no control over the output charset. That's it. That's the whole vibe check.


πŸ‘‘ SEE ALSO πŸ‘‘


🌈 HOME PAGE 🌈

<http://user42.tuxfamily.org/html-formatexternal/index.html>

πŸ’œ LICENSE πŸ’œ

Copyright 2008, 2009, 2010, 2013, 2015 Kevin Ryde

HTML-FormatExternal is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

HTML-FormatExternal is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with HTML-FormatExternal. If not, see <http://www.gnu.org/licenses/>.


and that's the whole page, bestie πŸ₯° this was HTML::...ml2text(3pm) from perl v5.36.0, dated 2022-11-19 β€” mwah, go forth and format πŸ’…πŸŽ€

πŸ“¦ where this page comes from