Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.


txt2tags.js project

  • txt2tags.js: a txt2tags parser in javascript.
  • markdown2txt2tags.js: an online quicker & dirty converter from markdown to txt2tags. (both based on showdown)
  • marked.js: a fork of marked.js, which can parse and convert txt2tags file to html.

It was not "rebranded", so it can be easily integrated into other projects already using marked. Note: we have also produced an automatically exported version of showdown.js from txt2tags.js so you can also integrate it into projects initially set up for markdown.

Download `txt2tags.js <>`_


Developers can use Txt2tags.js to:

  • Add in-browser preview to existing Txt2tags apps

Txt2tags.js' output is (almost always) identical to, so the server can reproduce exactly the output that the user saw. (See below for exceptions.)

  • Add Txt2tags input to programs that don't support it

Any app that accepts HTML input can now be made to speak Txt2tags by modifying the input pages's HTML. If your application lets users edit documents again later, then they won't have access to the original Txt2tags text. But this should be good enough for many uses -- and you can do it with just a two-line onsubmit function!

  • Add Txt2tags input to closed-source web apps

You can write bookmarklets or userscripts to extend any standard textarea on the web so that it accepts Txt2tags instead of HTML. With a little more hacking, the same can probably be done with many rich edit controls.

  • Build new web apps from scratch

A Txt2tags.js front-end can send back text in Txt2tags, HTML or both, so you can trade bandwidth for server load to reduce your cost of operation. If your app requires JavaScript, you won't need to do any Txt2tags processing on the server at all.

Quick Example

  <title>Txt2tagsjs - Txt2tags in Javascript</title>
  <script type="text/javascript" src="txt2tags.js"></script>
  <link rel="stylesheet" href="txt2tagsjs.css" />


      var text = "== Title ==\n **bold**, __underline__, //italic//.
                \n- list item 1\n- list item 2";
      var converter = new Txt2tags.converter();
      var myhtml = converter.makeHtml(text);



For some working examples, see:

You can also look at txt2tagsjs-gui.html for a live renderer on txt2tags.

Furthermore, there is markdown2txt2tags/markdown2txt2tags.html which can convert from markdown to txt2tags syntax. (work in progress, it's also based on showdown, a js port of markdown)

Browser Compatibility

Txt2tags.js has been tested successfully with:

  • Firefox
  • Chromium
  • Konqueror
  • Midori

In theory, Txt2tags.js will work in any browser that supports ECMA 262 3rd Edition (JavaScript 1.5). The converter itself might even work in things that aren't web browsers, like Acrobat. No promises.

Known Differences in Output

In most cases, Txt2tags' output is identical to that of Python Txt2tags v2.6. What follows is a list of all known limitations. Please file an issue if you find more.

This should work correctly:

  • headings
  • beautifulers (bold, italic, strike and underline)
  • Pre-Formatted Text, code
  • lists
  • comments

This doesn't work at all (yet):

  • macros
  • preprocessor (preproc / postproc)
  • 3 lines header

This could be improved (soon, we hope):

  • in blockquote txt2tags marks are converted to html (yet the html code is not rendered, which is correct at least)
  • Tables (especially in txt2tags.js, the marked.js version should work most correctly)
  • definition lists (partial support)
  • links (some errors when multiple links are on the same line)
  • images (centering images)
  • some ordered sublists will be turned to unordered lists when you mix both types (txt2tags.js only)

Basically, the marked.js version should be slightly better.

Related projects

  • t2t-editor, a txt2tags text editor based on showdown and codemirror:
  • what is txt2tags
  • "txt2tags here", a txt2tags converter for rich-form (for thunderbird email client and webmails)
  • Minimalist Online Txt2tags Editor:

Tests (TODO: not yet)

A suite of tests is available which require node.js. Once node is installed, run the following command from the project root to install the development dependencies:

npm install --dev

Once installed the tests can be run from the project root using:

npm test

New test cases can easily be added. Create a txt2tags file (ending in .t2t) which contains the txt2tags to test. Create a .html file of the exact same name. It will automatically be tested when the tests are executed with mocha.


This project was forked from

Showdown Copyright (c) 2007 John Fraser.

Showdown maintained by Corey Innis and others

Marked.js Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)

txt2tags.js hacks by Eric Forgeot


Render txt2tags syntax with javascript (based on showdown and marked). Online editor for t2t files.



No releases published


No packages published
You can’t perform that action at this time.