C²S Consulting logo
C²S Consulting | Primers | txt2tags

txt2tags - a simply wonderful markup tool

txt2tags is an absolutely gem of a tool. I came across it recently on recommendation by Marco Fioretti at the Free Technology Academy. How I have not come across it before I cannot imagine.

Install the relevant packages

Install the following packages:


$ sudo apt-get install python
$ sudo apt-get install txt2tags

Convert to target type


$ txt2tags --targets

adoc	AsciiDoc document
art	ASCII Art text
creole	Creole 1.0 document
dbk	DocBook document
doku	DokuWiki page
gwiki	Google Wiki page
html	HTML page
lout	Lout document
man	UNIX Manual page
mgp	MagicPoint presentation
moin	MoinMoin page
pm6	PageMaker document
pmw	PmWiki page
sgml	SGML document
tex	LaTeX document
txt	Plain Text
wiki	Wikipedia page
xhtml	XHTML page

$ txt2tags --target html test.txt
$ txt2tags --target docbook test.txt

Markup example

Create in a text file and save with a .t2t extension:



= Heading 1 =

A __paragraph__ with **bold** and //italic//.

Today is %%date(%d %m %Y).

Here is a nice pic: [txt2tags.jpg].

Here is a nice webpage: [txt2tags http://txt2tags.org].

== Heading 2 ==

  | John |  33  |    Male |
  | Mary |  19  |  Female |

=== Heading 3 ===

  || Name |  Age |  Gender  |
  | John  |  33  |  Male    |
  | Mary  |  19  |  Female ||

==== Heading 4 ====

+ Numbered Line 1
  + Numbered line 1.1
    - Bullet
      - Bullet


===== Heading 5 =====

**Code**

``$ sudo apt-get install python``

``$ sudo apt-get install txt2tags``

Output will look like this



Heading 1

A paragraph with bold and italic.

Today is 03 04 2014.

Here is a nice pic: txt2tags.jpg

Here is a nice webpage: txt2tags.

Heading 2

John33Male
Mary19Female

Heading 3

NameAgeGender
John33Male
Mary19Female

Heading 4

  1. Numbered Line 1
    1. Numbered line 1.1
      • Bullet
        • Bullet
Heading 5

Code

$ sudo apt-get install python

$ sudo apt-get install txt2tags

 

 


pandoc

pandoc is another very useful markdown tool. It is fantastic for converting between formats. For example to turn a HTML document into a OpenDocumentText document simply:

$ pandoc -f markdown -t odt -o webpage.html webpage-in-odt.odt

Copyright © 2024 C²S Consulting