vmg / sundown

Standards compliant, fast, secure markdown processing library in C
1.99k stars 385 forks source link

Backslash escapes are ignored #136

Open jgm opened 11 years ago

jgm commented 11 years ago

Sundown does not seem to recognize backslash escapes. This is a bug according to the official markdown syntax description. It also makes it difficult for authors to insert literal symbols when they need to.

http://johnmacfarlane.net/babelmark2/?normalize=1&text=%5C!%5Balt%5D(%2Furl)%0A

http://johnmacfarlane.net/babelmark2/?normalize=1&text=%5C%60not+code%60%0A%0A

http://johnmacfarlane.net/babelmark2/?normalize=1&text=*the+%5C*+character*%0A%0A

etc.

jgm commented 11 years ago

Also title attributes:

http://johnmacfarlane.net/babelmark2/?normalize=1&text=%5Bhi%5D(%2Furl+%22with+title%5C)%22)%0A%0A

jgm commented 11 years ago

And atx headers:

http://johnmacfarlane.net/babelmark2/?normalize=1&text=%23%23+hi%5C%23%23%23%0A

mildsunrise commented 11 years ago

:+1:

@vmg Please fix that! To not recognize backslash escapes is a very grave bug in a Markdown engine.

I can confirm that happens with the latest Sundown source.

PD: Also, look at the icon and your username. There's no space between them! This is a GitHub bug, though.

mildsunrise commented 11 years ago

@jgm About title attributes, I disagree about your example. You don't escape parentheses within an HTML attribute.

This renders correctly:

[Link](http://google.es "me (not you)")
=>  <a href="http://google.es" title="me (not you)">Link</a>

But this doesn't:

[Link](http://google.es "here \"we\" go")
=>  <a href="http://google.es" title="here \&quot;we\&quot; go">Link</a>

Neither does this:

[Link](http://google.es "here \\"we\\" go")
=>  <a href="http://google.es" title="here \\&quot;we\\&quot; go">Link</a>
mildsunrise commented 9 years ago

This should now be fully fixed in Hoedown's master.