kramdown icon indicating copy to clipboard operation
kramdown copied to clipboard

Escaping doesn't play well with smart quotes

Open gpakosz opened this issue 7 years ago • 1 comments

irb(main):001:0> require 'kramdown'
=> true
irb(main):002:0> Kramdown::Document.new('"[foo]"', entity_output: 'numeric').to_html
=> "<p>&#8220;[foo]&#8221;</p>\n"

However, when I try to escape the brackets because I want to make sure Kramdown doesn't believe[foo] is a link tag, then I get the opening double quote gets replaced by a curly closing double quote:

irb(main):003:0> Kramdown::Document.new('"\[foo\]"', entity_output: 'numeric').to_html
=> "<p>&#8221;[foo]&#8221;</p>\n"

gpakosz avatar Oct 15 '16 16:10 gpakosz

This problem only occurs at the start of a paragraph, not when there is some text before the quote. I have looked at the code but there is no easy solution to this problem as far as I can see.

I have tried some things to get this to work while not introducing another problem but I didn't find a solution. So to work around this problem make sure there is something at the start of the line before the quote.

Pull requests are welcome!

gettalong avatar Nov 12 '16 08:11 gettalong