Txt2tags is a command line document conversion tool which helps you generate multiple file formats from a single text file with minimal markup.
You can convert your text file to the following 9 file formats using
txt2tags command line tool.
- Man page
- Magic point
txt2tags file structure can be broadly divided into three namely – Header, Settings, and Body. The Header and Settings are optional.
txt2tags file has a very easy to use syntax for the body. If you have used Wiki syntax, you will be perfectly at home with the txt2tags syntax as well. The following is a subset of the syntax used in txt2tags file.
= words =
- Numbered Title
+ words +
- Numbered list
- Verbatim line
- Verbatim area
``` <linebreak> lines <linebreak>```
| cell1 | cell2 | cell3
The following are a few examples of how txt2tags command line document convertor is used to convert a text file to multiple file formats.
Convert to HTML
$ txt2tags -t html filename.t2t
The output will be an html file of the same name (filename.html).
Include Table of Contents in your HTML file
$ txt2tags -t html --toc filename.t2t
--toc option will automatically include a table of contents in the HTML file. Please note that you have to include the macro
%%toc somewhere within your txt2tags file for the table of contents to be inserted in that location.
Convert to PDF
There is no direct way to convert to PDF. A roundabout way is to convert the
txt2tags file to latex and then use the
pdflatex tool to convert the LaTeX file to PDF as shown in the following example.
$ txt2tags -t tex filename.t2t $ pdflatex filename.tex
How to install txt2tags
Most Linux distributions contain txt2tags in their repositories. For example, you can install txt2tags in Ubuntu Linux as follows :
$ sudo apt-get install txt2tags python-tk
If you have installed the Python TKinker extension (python-tk) , then you can start the txt2tags GUI as follows :
$ txt2tags --gui
The txt2tags GUI allows you to do all the things you can do using the txt2tags command line tool.
txt2tags is no doubt a very useful tool that converts your text files to a variety of file formats. It is released under GPL and is Free.