Note: John Fraser has independently created Showdown, a better (and actually working) implementation. Use that instead. This page is kept as an historical curiosity.
It is known to produce incorrect output in certain situations, generally involving blocks nested inside lists.
blockquotes inside lists fail especially horribly. For simple documents it should work fine, though the output may not be properly tidied. (Expect some extra whitespace.)
Before you even think of downloading it, note that it is unlikely to work in any non-Mozilla browser. IE, no. Safari, no. Opera, no.
I don't believe that any other browser has the required support for advanced regular expression features (e.g. lookahead).
There's a simple Firefox extension available here. It adds an option to the Firefox right-click context menu to run Markdown on the contents of
[28 Feb 07: John Fraser has independently released his own implementation, Showdown. Use that instead.]
[2 March 06: most of these notes and most of this page is old old old; I wrote an AJAX text suite and an updated version of the script itself, but never got around to finishing either. If you're interested, well, I honestly recommend starting from scratch. But I will get around to it eventually... maybe in April.]
Even Mozilla lacks full regular expression support -- the main reason js-markdown isn't perfect is because it can't use certain special characters (e.g.
\z), atomic matching, or lookbehind.
The kludges I used to replace these missing features tend not to be pretty. I'm not a programmer by trade, nor an expert in any of the technologies involved, so I may have missed simpler and more robust solutions. Anyone looking to solve problems would do best to look for functons in
Markdown.pl that use lookbehind, then fix their equivalents in
markdown.js. Known troublemakers are
If you plan to use this for anything, please note that it is not being actively developed. I'm not even going to port bugfixes from
Markdown.pl, though I probably will port across new features (like any eventual
<dd> support). Until inspiration strikes or some part of it becomes too annoying to ignore, I consider it abandoned.