Not sure where to start.. First off, you might want to look at this [response as to whether using regexes for parsing markdown is *safe*.][1] Second off, there is [this][2] and [this][3] on github, these parsers are a few hundred lines. You are missing use cases in your 30 lines of code. That is fine for a hobby site, not for a production site. If you have doubts, you can always run [MD tests][4] on your code and see for your self. Other than that; * If you insist on using regexes, at the very least add a line of comment of what you are trying to achieve, ideally add a second line with an example * Modifying standard objects, enough said.. * Single letter variables ( `f = b.substr(0, 2);` ) are very unfortunate * 0 lines of comment together with the previous comment make for terrible code * `html()` -> If you learn 1 thing today, it should be that mere mortals (like you and me) should not write escapers or parsers from scratch, instead we should figure out how smarter people did it and re-use their work. [In jQuery, the authors call the DOM method `.createTextNode()`, which replaces special characters with their HTML entity equivalents.][5] * Assignments in `if` statements are considered bad form: while (typeof(i = find.shift()) == 'string' && typeof(j = replace.shift()) == 'string') t = t.replaceAll(i || '', j || ''); To turn this into good code, you will have to roll this out to something like while ( find.length ){ caterpillar = find.shift(); butterfly = replace.shift(); if( typeof caterpillar != 'string' || typeof butterfly != 'string' ) break; //Turn all caterpillars into butterflies this = this.replaceAll( caterpillar , butterfly ); } All in all, you are re-inventing the wheel. If you want to continue with this code then you have your work cut out.. [1]: http://stackoverflow.com/a/1732454/7602 [2]: https://github.com/evilstreak/markdown-js/tree/master/src [3]: https://github.com/jgm/stmd/tree/master/js [4]: https://github.com/michelf/mdtest/ [5]: http://stackoverflow.com/a/6234808/7602