# Autocorrect quote marks outside of code blocks

**URL:** https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688
**Category:** Feature
**Tags:** markdown-it-review
**Created:** [December 23, 2016, 3:20am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688 "2016-12-23T03:20:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![sujato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sujato/32/114616_2.png) [@sujato](https://meta.discourse.org/u/sujato)
#### Post date: [December 23, 2016, 3:20am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/1 "2016-12-23T03:20:44Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [December 23, 2016, 3:28am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/2 "2016-12-23T03:28:11Z")

</div>

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

Go [here](https://markdown-it.github.io/) and disable and enable **typographer** to see it in action.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 23, 2016, 3:38am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/3 "2016-12-23T03:38:35Z")

</div>

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/lib/html\_prettify.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/lib/html_prettify.rb)

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.

---

<div class="post-metadata">

### Author: ![sujato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sujato/32/114616_2.png) [@sujato](https://meta.discourse.org/u/sujato)
#### Post date: [December 23, 2016, 3:46am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/4 "2016-12-23T03:46:33Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [December 23, 2016, 4:26am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/5 "2016-12-23T04:26:13Z")

</div>

> [@sam](#):
>
> it would have to be default off

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

---

<div class="post-metadata">

### Author: ![pne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pne/32/121350_2.png) [@pne](https://meta.discourse.org/u/pne)
#### Post date: [December 23, 2016, 5:17am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/6 "2016-12-23T05:17:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sujato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sujato/32/114616_2.png) [@sujato](https://meta.discourse.org/u/sujato)
#### Post date: [December 23, 2016, 8:22am UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/7 "2016-12-23T08:22:18Z")

</div>

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.

> [@pne](#):
>
> looks even more jarring than the straight apostrophe

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

---

<div class="post-metadata">

### Author: ![pne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pne/32/121350_2.png) [@pne](https://meta.discourse.org/u/pne)
#### Post date: [December 23, 2016, 3:13pm UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/8 "2016-12-23T15:13:32Z")

</div>

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”.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [June 27, 2017, 10:03pm UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/10 "2017-06-27T22:03:16Z")

</div>

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

see:

> [@CommonMark testing started here!](https://meta.discourse.org/t/commonmark-testing-started-here/65121/27):
>
> I enabled the typographer here (with the site setting enable\_markdown\_typographer) This means that: (c) (C) (r) (R) (tm) (TM) (p) (P) +- test.. test... test..... test?..... test!.... !!!!!! ???? ,, -- --- "Smartypants, double quotes" and 'single quotes' renders as: © © ® ® ™ ™ § § ± test… test… test… test?.. test!.. !!! ??? , – — “Smartypants, double quotes” and ‘single quotes’ I do not think we will enable it by default, but some communities have expressed interest in it so … here…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [June 27, 2017, 10:03pm UTC](https://meta.discourse.org/t/autocorrect-quote-marks-outside-of-code-blocks/54688/11 "2017-06-27T22:03:23Z")

</div>


