Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not every ASCII punctuation character can be escaped #697

Open
TheDeepestSpace opened this issue Oct 21, 2020 · 0 comments
Open

Not every ASCII punctuation character can be escaped #697

TheDeepestSpace opened this issue Oct 21, 2020 · 0 comments

Comments

@TheDeepestSpace
Copy link

TheDeepestSpace commented Oct 21, 2020

Hello. Thank you for a great gem.

When escaping semantically-insignificant characters like ", $, %, ', ,, /, ;, ?, @ using a backslash, that backslash character is kept in the output:

markdown = Redcarpet::Markdown.new Redcarpet::Render::HTML
puts markdown.render '\!\"\#\$\%\&\\\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~'
<p>!\&quot;#\$\%&amp;\&#39;()*+\,-.\/:\;&lt;=&gt;\?\@[\]^_`{|}~</p>

While this kind of makes sense, CommonMark specification suggests that all punctuation characters should be allowed to be escaped: https://spec.commonmark.org/0.29/#backslash-escapes. So the output of the above code should be

<p>!&quot;#$%&amp;'()*+,-./:;&lt;=&gt;?@[\]^_`{|}~</p>

For now simply leaving the aforementioned characters out of the escaping process works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant