---
name: "txt2html"
section: "1"
platform: "linux"
package: "txt2html"
version: "1.28-5"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/txt2html"
---

# txt2html(1)

a text to HTML converter

## NAME

txt2html - a text to HTML converter

## SYNOPSIS

**txt2html \[OPTIONS\]**

## DESCRIPTION

This manual page was written for the Debian GNU/Linux distribution because the original program does not have a manual page.

**txt2html** is a Perl program that converts plain text to HTML. It supports headings, lists, simple character markup, and hyperlinking, and is highly customizable. It recognizes some of the apparent structure of the source document (mostly whitespace and typographic layout), and attempts to mark that structure explicitly using HTML. The purpose for this tool is to provide an easier way of converting existing text documents to HTML format. txt2html can also be used to aid in writing new HTML documents, but there are probably better ways of doing that.

## OPTIONS

- **-t, --title \<title\>**

  You can specify the title of the HTML file. Otherwise a blank one will be used.

- **-tf, +tf, --titlefirst, --notitlefirst**

  Use / don't use the first non-blank line as the title.

- **-dt \<doct\>, +dt, --doctype \<doctype\>, --nodoctype**

  This gets put in the DOCTYPE field at the top of the document, unless it's 0. Default: "-//W3C//DTD HTML 3.2 Final//EN".

- **-l \<dictfile\>, +l, --link \<dictfile\>, --nolink**

  Should we try to link anything?

- **-H \<regexp\>, --heading \<regexp\>**

  Add a regexp for headings.\
   Header levels are assigned by **regexp** in order seen. When a line matches a custom header regexp, it is tagged as a header. If it's the first time that particular regexp has matched, the next available header level is associated with it and applied to the line. Any later matches of that regexp will use the same header level. Therefore, if you want to match numbered header lines, you could use something like this: *-H '^ \*+. 240.+. 240.+.+. 0* Then lines like\
   **1. Examples**\
   **1.1 Things**\
   **4.2.5 Cold Fusion**\
   would be marked as H1, H2, and H3 (assuming they were found in that order, and that no other header styles were encountered). If you prefer that the first one specified always be H1, the second always be H2, the third H3, etc, then use the **-EH/--explicit-headings** option.

- **-EH, +EH, --explicit\_headings, --noexplicit\_headings**

  Don't try to find any headings except the custom one specified. Also, the custom headings will not be assigned levels in the order they are encountered in the document, but in the order they are specified on the command line.

- **-a \<file\>, --append \<file\>**

  - **+a, --noappend**

  - **-ab \<file\>, --append\_body \<file\>**

  - **+ab, --noappend\_body**

  - **-ah \<file\>, --append\_head \<file\>**

  - **+ah, --noappend\_head**

  If you want something appended by default, put the filename here. The appended text will not be processed at all, so make sure it's plain text or decent HTML, i.e. do not have things like:\
   Seth Golub \<seth@cs.wustl.edu\>\
   but instead, have:\
   Seth Golub &lt;seth@cs.wustl.edu&gt;

- **-pp \<file\>, --prepend\_body \<file\>**

  - **+pp, --noprepend\_body**

  Same sort of thing, but goes before the processed body text, rather than after.

- **-ec, +ec, --escapechars, --noescapechars**

  Turn & \< \> into &amp; &gt; &lt;

- **-8, +8, --8-bit-clean, --no-8-bit-clean**

  Disable Latin-1 character entity naming.

- **-e, +e, --extract, --noextract**

  Extract Mode (suitable for inserting).

- **-c \<n\>, --caps \<n\>**

  Minimum sequential CAPS for an all-caps line.

- **-ct \<tag\>, --capstag \<tag\>**

  Tag to put around all-caps lines.

- **-m, +m, --mail, --nomail**

  Deal with mail headers & quoted text.

- **-u, +u, --unhyphen, --nounhyphen**

  Enables unhyphenation of text.

- **-ul \<n\>, --ulength \<n\>**

  How much longer or shorter can underlines be and still be underlines?

- **-uo \<n\>, --uoffset \<n\>**

  How far offset can underlines be and still be underlines?

- **-tw \<n\>, --tabwidth \<n\>**

  How many spaces equal a tab?

- **-iw \<n\>, --indent \<n\>**

  Indents this many spaces for each level of a list.

- **-s \<n\>, --shortline \<n\>**

  Lines this short (or shorter) must be intentionally broken and are kept that short.

- **-p \<n\>, --prewhite \<n\>**

  Minimum number of consecutive whitespace characters to trigger preformatting. NOTE: Tabs are now expanded to spaces before this check is made. That means if $tab\_width is 8 and this is 5, then one tab may be expanded to 8 spaces, which is enough to trigger preformatting.

- **-pb \<n\>, --prebegin \<n\>**

  How many lines of preformatted-looking text are needed to switch to \<PRE\>:\
   \<= 0 : Preformat entire document\
   1 : one line triggers\
   \>= 2 : two lines trigger

- **-pe \<n\>, --preend \<n\>**

  How many lines of unpreformatted-looking text are needed to switch from \<PRE\>:\
   \<= 0 : Never preformat within document\
   1 : one line triggers\
   \>= 2 : two lines trigger

- **-r \<n\>, --hrule \<n\>**

  Minimum number of ---s for an HRule.

- **-LO, +LO, --linkonly, --nolinkonly**

  Do no escaping or marking up at all, except for processing the links dictionary file and applying it. This is useful if you want to use txt2html's linking feature on an HTML document. If the HTML is a complete document (includes HTML,HEAD,BODY tags, etc) then you'll probably want to use the --extract option also.

- **-db \<n\>, --debug \<n\>**

  Debug mode for link dictionaries. Bitwise-Or what you want to see:\
   1: The parsing of the dictionary\
   2: The code that will make the links\
   4: When each rule matches something

- **-pm, +pm, --preformat-marker, --nopreformat-marker**

  Turn on preformatting when encountering "\<PRE\>" on a line by itself, and turn it off when there's a line containing only "\</PRE\>".

- **-h, --help**

  Show summary of options.

- **-v, --version**

  Show version of program.

## SEE ALSO

[**html2text**(1)](/html2text/1.md).

## AUTHOR

This manual page was written by Uwe Hermann \<uwe@debian.org\>, for the Debian GNU/Linux system (but may be used by others).
