Autocorrect quote marks outside of code blocks

markdown-it-review

(sujato) #1

True typography geeks like myself loathe the use of “faux quotes”. At the same time, I’m often too lazy to actually insert “typographically correct quotes”, not to mention trying to enforce this on others.

May I propose that Discourse enables autocorrect for this. Possibly other typographic features could be included (dashes, ellipses …).

Obviously this would have to be disabled in code, whether inline or block. And not all communities are going to want it, so it should be opt-in. But I am trying to encourage quality writing on my site, so I would really appreciate this little bit of polish.

Any takers?


(Rafael dos Santos Silva) #2

This is an option in the new markdown library Discourse will adopt.

Go here and disable and enable typographer to see it in action.


(Sam Saffron) #3

This was discussed in the past and @codinghorror’s call was to stay away from using smartypants in topic bodies.

As it stands we have a class capable of this stuff, in fact, topic titles get this treatment discourse/html_prettify.rb at master · discourse/discourse · GitHub

It would not be a huge change to add a site setting that forces cooked markdown through a prettifier, but it would have to be default off and I worry about edge cases.


(sujato) #4

My apologies, obviously I didn’t do my research well enough. Anyway, thanks for the swift response, and mark me down to support this as an opt-in.

Markdown-it is looking awesome!


(Mittineague) #5

Yes please, curly quotes and code don’t play nice together. (we have a fair share of copy and paste members)


(Philip Newton) #6

I’m not sure whether an automatic “prettifier” is necessarily a net gain, especially because apostrophe is used for both single quote and apostophe – if it’s programmed to turn ‘this’ into ‘this’, it’s also likely to turn things such as '97 (year numbers) into ‘97 (with opening single quote), which at least to me looks even more jarring than the straight apostrophe. Similarly with other word-initial apostrophes such as ‘tis.

Quora’s autoprettifier seems to have a list of words that take special treatment, which of course will only work well for English-language text.


(sujato) #7

Yes, this problem is, it seems, inescapable; it’s not possible to fully automate quote correction. But the cases where autocorrect gets it wrong are rare, and you can just fix them manually, so I think it’s worth it.

On the system I use, it takes three keystrokes to fix such a case with autocorrect, and four to insert a correct quote mark directly, so it’s still a win!

Languages other than English is a more complex problem, I’m no expert there.

This is a good thing. Then you’re motivated to fix it, instead of imagining that’s how it’s meant to be.


(Philip Newton) #8

While we’re at it, I hope that backticks also get autocorrected? Those bug me even more.

i.e. when people type things such as “I`m not feeling well and won`t be coming tonight”.


(Sam Saffron) #10

Typographer “™” is a site setting in the new engine:

see:


(Sam Saffron) #11