I’m looking at Gruber’s original Markdown implementation here and the Showdown implementation here.
I’m comparing the _Detab function in each. I’m giving each the following string
"Where\tis pancakes house?"
The Perl version of the test and output is here. This is 26 characters long.
The JavaScript version of the test and output is here. This is 27 characters long.
123456789012345678901234567
Perl: Where is pancakes house?
JS: Where is pancakes house?
Have I made a mistake? Is it a bug, or is there some other purpose?
There are several bugs in Showdown’s detabber. That’s why for Stack Overflow’s version, I have rewritten it:
It detabs correctly, and if I recall my measurements correctly, this is about as fast (maybe a little slower) as the original in older IE versions, and much faster in newer browsers.
See http://code.google.com/p/pagedown/wiki/PageDown for our full version of Showdown.