StackExchange/pagedown

Backslash character escapes two following characters

GoogleCodeExporter opened this issue · 3 comments

> c.makeHtml('\\.**foo**');
Actual:   '<p>.*<em>foo</em>*</p>'
Expected: '<p>.<strong>foo</strong></p>'

> c.makeHtml('\\***foo**\\*');
Actual:   '<p>**<em>foo</em>**</p>'
Expected: '<p>*<strong>foo</strong>*</p>'

> c.makeHtml('\\[*a*\\](b)');
Actual:   '<p>[*a*](b)</p>'
Expected: '<p>[<em>a</em>](b)</p>'


Tested on c245b9e.

Original issue reported on code.google.com by pkoszulinski on 7 Apr 2013 at 7:30

Hmm yeah, that's because the escape code ends with a letter. I suppose it makes 
sense to end it with a non-letter, at least in most cases.

You can apply the attached patch if you want this fixed quickly, but note that 
it's not extensively tested. I'll also have to make a similar change to 
https://code.google.com/p/markdownsharp/ (the two projects have to be in sync), 
so it may take a bit.

Original comment by b...@stackoverflow.com on 8 Apr 2013 at 6:49

  • Changed state: Accepted

Attachments:

Thanks for quick patch. I'll test it in the meantime.

Original comment by pkoszulinski on 8 Apr 2013 at 9:00

You shouldn't deploy it to a production environment; I later realized it breaks 
in some rather obvious edge cases:

c.makeHtml('~D~')
"<p>~T$T~</p>"

Original comment by b...@stackoverflow.com on 8 Apr 2013 at 12:25