micromarkdown.js
micromarkdown.js copied to clipboard
http:// links don't have space before and after
In line 249 there should be spaces before and after the link:
str = str.replace(stra[0], ' <a ' + micromarkdown.mmdCSSclass(repstr, strict) + 'href="' + repstr + '">' + repstr + '</a> ');
because the regex captures them and they get removed after replacement:
url2: /[ \t\n]([a-zA-Z]{2,16}:\/\/[a-zA-Z0-9@:%_\+.~#?&=]{2,256}.[a-z]{2,4}\b(\/[\-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)?)[ \t\n]/g
Also, this regex eats up the leading/training space which breaks formatting.
One more bug at lines 190 and 192 in links processing: '\n' sometimes adds unnecessary linebreaks.