There are several types of plain text structuring / formatting syntax out there, for example:

  • MarkDown
  • MediaWiki
  • XWiki
  • HTML

Is there a generic tool (easier / more appropriate than reg-ex) that helps defining and executing conversion rules?

up vote 21 down vote accepted

Pandoc (License: GPL) can import:

  • markdown
  • reStructuredText
  • textile
  • HTML
  • DocBook
  • LaTeX
  • MediaWiki markup
  • OPML
  • Haddock markup

and convert to these and various other formats. (Custom formats can be added with Lua.)

It’s a standalone command-line program and comes with a Haskell library.

You can test it online:

With txt2tags (, you can export to at least 20 different formats, including rtf (rich text format), latex, html, wikipedia, creole, dokuwiki, restructured text, markdown, spip, AsciiDoc...

There is an html importer for txt2tags ( so you can do pretty everything with it.

(edit) To be more complete in my answser, yes I'm using txt2tags for several years (at least 7 or 8).

The only drawback I can think of is it's less known than for example markdown, but it's older (since 2001) and in my opinion better (more customisable, more extendable, more logicial and not fragmented in its syntax).

It has a python 2 implementation for all the exports mentionned above, and a php implementation for html export only.

You can create special export rules either with a new syntax definition module, or with regex. For the first, it is quite easy, for example here is the export rule for bold in the html module:

'fontBoldOpen'         : '<B>'            ,
'fontBoldClose'        : '</B>'           ,

With regex, you can do it in your document or as a configuration file.

For exemple, to use strong instead of b in your html output, you can create this rule:

%!postproc: '<b>' '<strong>'
%!postproc: '</b>' '</strong>'
  • Welcome to Software Recommendations! We favor personal experience in answers, so did you use this tool? What are your experiences? Does it have some drawbacks or tricky parts that should be mentioned? What OS does it run on? See this meta for how to make this answer great:… – Angelo Fuchs Apr 16 '14 at 9:39

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.