html2text(1)
๐ NAME ๐
okay bestie, welcome to the html2text(1) page from the General Commands Manual โ this is the manual for html2text, an advanced HTML-to-text converter โจ. literally the whole vibe is โHTML goes in, readable text comes out,โ and yes, she understood the assignment ๐
.
โจ SYNOPSIS โจ
html2text -help
html2text -version
html2text [ -check ] [ -debug-scanner ] [ -debug-parser ] [ -rcfile path
] [ -width width ] [ -o output-file ] [ -nobs ] [ -from_encoding
encoding ] [ -to_encoding encoding ] [ -ascii ] [ -utf8 ] [ input-file
... ]
๐ DESCRIPTION ๐
So hereโs the tea: html2text reads HTML documents from the input-files, formats each of them into a stream of UTF-8 encoded characters, and writes the result to standard output โ or into output-file, if the -o command line option is used ๐ซถ.
If no input-files are specified on the command line, html2text reads from standard input. A dash as the input-file is an alternate way to specify standard input ๐.
html2text understands all HTML 3.2 constructs, but can render only part of them due to the limitations of the text output format. However, the program attempts to provide good substitutes for the elements it cannot render. html2text parses HTML 4 input, too, but not always as successful as other HTML processors. It also accepts syntactically incorrect input, and attempts to interpret it "reasonably" ๐ญ.
The way html2text formats the HTML documents is controlled by formatting properties read from an RC file. html2text attempts to read $HOME/.html2textrc (or the file specified by the -rcfile command line option); if that file cannot be read, html2text attempts to read /etc/html2textrc. If no RC file can be read (or if the RC file does not override all formatting properties), then "reasonable" defaults are assumed. The RC file format is described in the html2textrc(5) manual page ๐ง.
๐ OPTIONS ๐
-asciiโ By default,html2textuses UTF-8 for its output. Specifying this option, plain ASCII is used instead. Non-ASCII characters are rendered via iconv's transliteration feature. As such this option is an alias for-to_encoding ASCII//TRANSLIT๐ธ.-utf8โ Assume both terminal and input stream are in UTF-8 mode. This is an alias for-from_encoding UTF-8 -to_encoding UTF-8โจ.-from_encodingencoding โ Sets the encoding of the input file or stream to the given encoding. By default,html2texttries to obtain the encoding from the input file and usesISO-8859-1encoding as fallback. You might want to override the detection or fallback using this option. Seeiconv -lfor a list of supported encodings ๐.-to_encodingencoding โ Use the given encoding while writing output, instead of UTF-8. The same set of encodings as for the-from_encodingoption can be used ๐ฆ.-checkโ This option is for diagnostic purposes: The HTML document is only parsed and not processed otherwise. In this mode of operation,html2textwill report on parse errors and scan errors, which it does not in other modes of operation. Note that parse and scan errors are not fatal forhtml2text, but may cause mis-interpretation of the HTML code and/or portions of the document being swallowed ๐.-debug-parserโ Lethtml2textreport on the tokens being shifted, rules being applied, etc., while scanning the HTML document. This option is for diagnostic purposes ๐.-debug-scannerโ Lethtml2textreport on each lexical token scanned, while scanning the HTML document. This option is for diagnostic purposes ๐.-helpโ Print command line summary and exit ๐.-nobsโ By default,html2textrenders underlined letters with sequences likeunderscore-backspace-characterand boldface letters likecharacter-backspace-character, which works fine when the output is piped intomore(1),less(1), or similar. For other applications, or when redirecting the output into a file, it may be desirable not to render character attributes with such backspace sequences, which can be accomplished with this command line option ๐.-ooutput-file โ Write the output to output-file instead of standard output. A dash as the output-file is an alternate way to specify the standard output ๐พ.-rcfilepath โ Attempt to read the file specified in path as RC file ๐๏ธ.-linksโ Tags all external links with a number between brackets ([num]), and produces a numbered list at the end of the document with all link targets ๐.-versionโ Print program version and exit ๐ท๏ธ.-widthwidth โ By default,html2textformats the HTML documents for a screen width of 79 characters. If redirecting the output into a file, or if your terminal has a width other than 80 characters, or if you just want to get an idea howhtml2textdeals with large tables and different terminal widths, you may want to specify a different width ๐.
๐๏ธ FILES ๐๏ธ
/etc/html2textrcโ System wide parser configuration file.$HOME/.html2textrcโ Personal parser configuration file, overrides the system wide values.
๐ CONFORMING TO ๐
HTML 3.2 (HTML 3.2 Reference Specification - http://www.w3.org/TR/REC-html32) ๐
โ ๏ธ RESTRICTIONS โ ๏ธ
html2text was written to convert HTML 3.2 documents. When using it with HTML 4 or even XHTML 1 documents, some constructs present only in these HTML versions might not be rendered ๐.
๐ซถ AUTHOR ๐ซถ
html2text was written up to version 1.2.2 by Arno Unkrig <arno@unkrig.de> for GMRS Software GmbH, Unterschleissheim โจ.
Up to version 1.3.2a, the maintainer was Martin Bayer <mbayer@zedat.fu-berlin.de> ๐.
This version of html2text comes from https://gitlab.com/grobian/html2text. Please use the GitLab page to file issues and improvements ๐ ๏ธ.
๐ธ SEE ALSO ๐ธ
html2textrc(5), less(1), more(1) ๐
and thatโs the whole html2text(1) page from the General Commands Manual, dated 2020-04-15 โ go forth and convert, bestie ๐ฆโจ
๐ฆ where this page comes from
- alpine 3.24: html2text-doc 2.4.0-r0 ยท GPL
- nixos 26.05: html2text 2.4.0
- nixpkgs unstable: html2text 2.4.0
- ubuntu resolute: html2text 2.4.0-1 ยท GPL-2.0-or-later
- ubuntu stonking: html2text 2.4.0-1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms