Kjosev / pagedown

Automatically exported from code.google.com/p/pagedown
Other
0 stars 0 forks source link

Backslash character escapes two following characters #55

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
> 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

GoogleCodeExporter commented 9 years ago
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

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for quick patch. I'll test it in the meantime.

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

GoogleCodeExporter commented 9 years ago
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