redcarpet
redcarpet copied to clipboard
Not every ASCII punctuation character can be escaped
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>!\"#\$\%&\'()*+\,-.\/:\;<=>\?\@[\]^_`{|}~</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>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~</p>
For now simply leaving the aforementioned characters out of the escaping process works.