%!preproc: 'BASEURLT2T' 'http://wiki.txt2tags.org/demos/'
= txt2tags.js project =
- 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 BASEURLT2T/txt2tagsjs.zip]**
== Usage ==
Developers can use Txt2tags.js to:
- Add in-browser preview to existing Txt2tags apps
Txt2tags.js' output is (almost always) identical to txt2tags.py, 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
== Quick Example ==
For some working examples, see:
- inline: [sample_inline.html sample_inline.html] //(based on showdown)//
- loading external file: [sample_external_file.html sample_external_file.html] //(based on showdown)//
- inline: [sample_marked_inline.html sample_marked_inline.html] //(based on marked)//
- loading external file: [sample_marked_external_file.html sample_marked_external_file.html] //(based on marked)//
You can also look at [txt2tagsjs-gui.html txt2tagsjs-gui.html] for a live renderer on txt2tags.
Furthermore, there is [markdown2txt2tags/markdown2txt2tags.html 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:
% - Safari
% - Opera
% - Internet Explorer
== 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:
- beautifulers (**bold**, //italic//, --strike-- and __underline__)
- Pre-Formatted Text, code
This doesn't work at all (yet):
- 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:
- code: https://github.com/farvardin/t2t-editor/tree/txt2tags (forked from https://github.com/lepture/editor/)
- demo: BASEURLT2T/t2t-editor/
- what is txt2tags
- https://github.com/farvardin/whatistxt2tags (forked from https://github.com/kirkstrobeck/whatismarkdown.com)
- "txt2tags here", a txt2tags converter for rich-form (for thunderbird email client and webmails)
- code: https://github.com/farvardin/txt2tags-here (forked from https://github.com/adam-p/markdown-here)
- download: BASEURLT2T/
- Minimalist Online Txt2tags Editor:
- code: https://github.com/farvardin/MinimalistOnlineTxt2tagsEditor (forked from https://github.com/pioul/MinimalistOnlineMarkdownEditor)
- demo: BASEURLT2T/mote
== 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