Rendez-vous sur Arrakis

C'est lorsque nous croyons savoir quelque chose qu'il faut justement réfléchir un peu plus profondément. F. Herbert

txt2tags.js project

Download txt2tags.js

Usage

Developers can use Txt2tags.js to:

Quick Example

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

<body>

<script>
	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);
	
    document.write(myhtml);
</script>

</body>
</html>

For some working examples, see:

Browser Compatibility

Txt2tags.js has been tested successfully with:

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:

This doesn't work at all (yet):

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

Related projects

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.

Credits

This project was forked from https://github.com/coreyti

Showdown Copyright (c) 2007 John Fraser. http://www.attacklab.net/

Showdown maintained by Corey Innis https://github.com/coreyti and others

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

txt2tags.js hacks by Eric Forgeot