1html2text(1)                General Commands Manual               html2text(1)
2
3
4

NAME

6       html2text - an advanced HTML-to-text converter
7

SYNOPSIS

9       html2text -help
10       html2text -version
11       html2text  [ -unparse | -check ] [ -debug-scanner ] [ -debug-parser ] [
12       -rcfile path ] [ -style ( compact | pretty ) ] [ -width width  ]  [  -o
13       output-file ] [ -nobs ] [ -ascii ] [ input-url ...  ]
14

DESCRIPTION

16       html2text  reads  HTML  documents  from the input-urls, formats each of
17       them into a stream of plain text characters, and writes the  result  to
18       standard  output (or into output-file, if the -o command line option is
19       used).
20
21       Documents that are specified by a  URL  (RFC  1738)  that  begins  with
22       "http:"  are retrieved with the Hypertext Transfer Protocol (RFC 1945).
23       URLs that begin with "file:" and URLs that do not contain a colon spec‐
24       ify local files. All other URLs are invalid.
25
26       If  no  input-urls  are  specified on the command line, html2text reads
27       from standard input. A dash as the input-url is  an  alternate  way  to
28       specify standard input.
29
30       html2text understands all HTML 3.2 constructs, but can render only part
31       of them due to the limitations of the text output format. However,  the
32       program attempts to provide good substitutes for the elements it cannot
33       render.  html2text parses HTML 4 input, too, but not always as success‐
34       ful  as  other HTML processors. It also accepts syntactically incorrect
35       input, and attempts to interpret it "reasonably".
36
37       The way html2text formats the HTML documents is controlled  by  format‐
38       ting  properties  read  from  an  RC  file.  html2text attempts to read
39       $HOME/.html2textrc (or the file specified by the -rcfile  command  line
40       option);  if  that  file  cannot  be  read,  html2text attempts to read
41       /etc/html2textrc.  If no RC file can be read (or if the  RC  file  does
42       not override all formatting properties), then "reasonable" defaults are
43       assumed. The RC file format is described in the  html2textrc(5)  manual
44       page.
45

OPTIONS

47       -ascii By default, html2text uses ISO 8859-1 for the output. Specifying
48              this option, plain ASCII  is  used  instead.  To  find  out  how
49              non-ASCII characters are rendered, refer to the file "ascii.sub‐
50              stitutes".
51
52       -check This option is for diagnostic purposes:  The  HTML  document  is
53              only  parsed and not processed otherwise. In this mode of opera‐
54              tion, html2text will report on parse  errors  and  scan  errors,
55              which  it  does not in other modes of operation. Note that parse
56              and scan errors are not fatal for html2text, but may cause  mis-
57              interpretation  of the HTML code and/or portions of the document
58              being swallowed.
59
60       -debug-parser
61              Let html2text report on the tokens being  shifted,  rules  being
62              applied,  etc., while scanning the HTML document. This option is
63              for diagnostic purposes.
64
65       -debug-scanner
66              Let html2text report on each lexical token scanned, while  scan‐
67              ning the HTML document. This option is for diagnostic purposes.
68
69       -help  Print command line summary and exit.
70
71       -nobs  By  default, html2text renders underlined letters with sequences
72              like "underscore-backspace-character" and boldface letters  like
73              "character-backspace-character",  which works fine when the out‐
74              put is piped into more(1), less(1), or similar. For other appli‐
75              cations,  or  when redirecting the output into a file, it may be
76              desirable not to render character attributes with such backspace
77              sequences,  which  can  be  accomplished  with this command line
78              option.
79
80       -o output-file
81              Write the output to output-file instead of  standard  output.  A
82              dash as the output-file is an alternate way to specify the stan‐
83              dard output.
84
85       -rcfile path
86              Attempt to read the file specified in path as RC file.
87
88       -style ( compact | pretty )
89              Style pretty changes some of the default values of  the  format‐
90              ting parameters documented in html2textrc(5).  To find out which
91              and how the formatting parameter defaults are changed, check the
92              file "pretty.style". If this option is omitted, style compact is
93              assumed as default.
94
95       -unparse
96              This option is for diagnostic purposes:  Instead  of  formatting
97              the  parsed  document, generate HTML code, that is guaranteed to
98              be syntactically correct. If html2text has  problems  parsing  a
99              syntactically  incorrect HTML document, this option may help you
100              to understand what html2text thinks that the original HTML  code
101              means.
102
103       -version
104              Print program version and exit.
105
106       -width width
107              By  default,  html2text  formats the HTML documents for a screen
108              width of 79 characters. If redirecting the output into  a  file,
109              or  if your terminal has a width other than 80 characters, or if
110              you just want to get an idea  how  html2text  deals  with  large
111              tables  and different terminal widths, you may want to specify a
112              different width.
113

FILES

115       /etc/html2textrc
116              System wide parser configuration file.
117
118       $HOME/.html2textrc
119              Personal parser configuration file, overrides  the  system  wide
120              values.
121

CONFORMING TO

123       HTML  3.2 (HTML 3.2 Reference Specification - http://www.w3.org/TR/REC-
124       html32),
125       RFC 1945 (Hypertext Transfer Protocol - HTTP).
126

RESTRICTIONS

128       html2text provides only a basic implementation of the Hypertext  Trans‐
129       fer  Protocol (HTTP). It requires the complete and exactly matching URL
130       to be given as argument and will not  follow  redirections  (HTTP  301/
131       307).
132
133       html2text was written to convert HTML 3.2 documents. When using it with
134       HTML 4 or even XHTML 1 documents, some constructs present only in these
135       HTML versions might not be rendered.
136

AUTHOR

138       html2text   was   written   up   to   version   1.2.2  by  Arno  Unkrig
139       <arno@unkrig.de> for GMRS Software GmbH, Unterschleissheim.
140
141       Current maintainer and primary download location is:
142       Martin Bayer <mbayer@zedat.fu-berlin.de>
143       http://userpage.fu-berlin.de/~mbayer/tools/html2text.html ⟨⟩
144

SEE ALSO

146       html2textrc(5), less(1), more(1)
147
148
149
150                                  2004-01-14                      html2text(1)
Impressum