russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.42k stars 598 forks source link

Double quotes become ", even with smartpants disabled #549

Open ghost opened 5 years ago

ghost commented 5 years ago

If I have a document that looks like this:

"Hello"

I get: "Hello%quot;

Even inside codeblocks with three backticks. Happens with smartpanys on or off.

Is this intentional? I don't quite see the purpose.

Thank you!

jmafc commented 5 years ago

I presume that what you get is: "Hello". AFAICT, this is unrelated to Smartypants (aside:horrible name and horrible feature IMHO), but rather is because blackfriday (BF) escapes ampersands, angle brackets (greater than/less than signs) and double quotes (see esc.go in v2). This "feature" is annoying if you have lots of normal text that uses normal quotes around certain words or phrases (as I just did) and you want to compare the BF output to something like python.markdown. It's not a good solution, but I had to convert the BF output to string and then pass it to html.UnescapeString(). That bit me on another side because the latter converted some & in URLs to single character ampersands.

ghost commented 5 years ago

My bad! Yes, you're right, I meant "Hello".

I understand, thank you for explaining. Do you think it'd be worth having an option to turn this off and leave on the greater than/less than, or to just leave it as-is?

jmafc commented 5 years ago

It'd be great to have an option to turn it off or better yet not have it be the default. I thiink the principle of least surprise is a very good guide. If your text says You won't like it, you'll be surprised when it gets rendered as won"t (and even worse if it gets rendered won&rsquot;t--I'm no typographer but I think the so-called "smart" quotes are supposed to be paired, not arbitrarily used to replace a plain apostrophe obviously used for contractions).

ghost commented 5 years ago

Agreed! Alright. Not sure if I will be able to get around to doing this or not, but I'll at least keep it open in the meanwhile.