micromarkdown.js icon indicating copy to clipboard operation
micromarkdown.js copied to clipboard

http:// links don't have space before and after

Open ershov opened this issue 8 years ago • 2 comments

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

ershov avatar Jun 24 '16 06:06 ershov

Also, this regex eats up the leading/training space which breaks formatting.

ershov avatar Jun 24 '16 06:06 ershov

One more bug at lines 190 and 192 in links processing: '\n' sometimes adds unnecessary linebreaks.

ershov avatar Jun 24 '16 06:06 ershov