redcarpet icon indicating copy to clipboard operation
redcarpet copied to clipboard

Smartypants converts --> into en dash if comment contains HTML

Open lord opened this issue 8 years ago • 3 comments

@mbuttler found a (slightly esoteric) bug in https://github.com/lord/slate/issues/715, and I think Smartypants might be causing the problem? Here's a minimal example:

require "redcarpet"
puts Redcarpet::Render::SmartyPants.render("Oh SmartyPants, you're so crazy...")
# output: Oh SmartyPants, you’re so crazy…
puts Redcarpet::Render::SmartyPants.render("<!-- Oh SmartyPants, you're so crazy... -->")
# output: <!-- Oh SmartyPants, you're so crazy... -->
puts Redcarpet::Render::SmartyPants.render("<!-- <p>Oh SmartyPants, you're so crazy...</p> -->")
# output: <!-- <p>Oh SmartyPants, you&rsquo;re so crazy&hellip;</p> &ndash;>

Even though the last example is just one giant HTML comment, it seems like the HTML tags inside put Smartpants back into converting-mode, which makes the enclosing comment never end? Let me know if I can provide any additional information!

(As an aside, since I'm not sure I've came in here and said it: thanks for the excellent markdown parser, thousands of Slate users have loved and enjoyed the extensive features you support! ❤️ )

lord avatar Mar 06 '17 16:03 lord

Oh, and the above code was run with Redcarpet 3.4.0.

lord avatar Mar 06 '17 16:03 lord

Hi !

Thank you very much for the kind words and detailed report and sorry for the delay ! I will try to look into this very soon ! :-)

robin850 avatar May 04 '17 22:05 robin850

Yea, no rush! It's not the most impactful bug. :)

lord avatar May 04 '17 22:05 lord