# Disable Code Formatting for inappropriate 4 space indent?

**URL:** https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161
**Category:** Feature
**Created:** [March 20, 2019, 4:36pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161 "2019-03-20T16:36:46Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![outofthebox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/outofthebox/32/83708_2.png) [@outofthebox](https://meta.discourse.org/u/outofthebox)
#### Post date: [March 20, 2019, 4:36pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/1 "2019-03-20T16:36:46Z")

</div>

Hi,

In my community, no one should ever post code. It would always be off-topic.

However, sometimes people do have their posts formatted as code by accident.

Is it possible to disable everyone from applying the ‘code’ format to content in their post?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [March 20, 2019, 4:53pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/2 "2019-03-20T16:53:24Z")

</div>

> [@outofthebox](#):
>
> Is it possible to disable everyone from applying the ‘code’ format to content in their post?

How do they use a code by mistake? By clicking the `code` button in the editor? Or simply leaving 4 spaces at the beginning of the line?

You can try to hide the code button with CSS using:

```css
.code.btn {
    display: none;
}

```

You can also change the site setting `code formatting style` from the default `4-spaces-indent` to `code-fences`. If users can leave 4 blanks spaces before a line (maybe because they use emails?) it is difficult for them to use ``` by mistake.

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [March 20, 2019, 4:55pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/3 "2019-03-20T16:55:56Z")

</div>

In my case it’s always the user’s email app adding an indent at the first line in a paragraph. Their posts by email are jumbled up as a result.

More here:

> [@Disable indent code block for emails](https://meta.discourse.org/t/disable-indent-code-block-for-emails/93707):
>
> Many posts in my forums are created via email. They do not contain code. Would appreciate a setting to turn off the four-character code-block feature of Markdown when the post originated from an email. That is to prevent many email paragraphs being turned into code blocks due to paragraph indents.

---

<div class="post-metadata">

### Author: ![outofthebox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/outofthebox/32/83708_2.png) [@outofthebox](https://meta.discourse.org/u/outofthebox)
#### Post date: [March 20, 2019, 5:05pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/4 "2019-03-20T17:05:31Z")

</div>

Hi @dax,

Those are great ideas - I’ve implemented both. Thank you!

I do think it is because they add four spaces to the start of a line. I wonder if this was a typing convention in some schools or something? Or it is entered via their email program? It seems to happen a couple of times a week.

---

<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: [March 20, 2019, 5:19pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/5 "2019-03-20T17:19:26Z")

</div>

> [@outofthebox](#):
>
> I wonder if this was a typing convention in some schools or something?

That is/was the standard way to create a paragraph when writing on paper:

> **[First-line indents | Butterick’s Practical Typography](https://practicaltypography.com/first-line-indents.html)**
>
> Butterick’s Practical Typography

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [March 20, 2019, 5:21pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/6 "2019-03-20T17:21:41Z")

</div>

I doubt they insert manually 4 space. I think instead that they write the posts via email. You should be able to determine this by looking at the post itself. If you see an envelope icon the post has been submitted by email.

![image](https://global.discourse-cdn.com/meta/optimized/3X/6/6/66d54e612cd71a2efb8eb981ceef98844dfee514_2_345x36.png)

Or they simple copy paste the text from an another program where they use the Tab to create new paragraphs,

---

<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: [March 20, 2019, 7:08pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/7 "2019-03-20T19:08:51Z")

</div>

> [@dax](#):
>
> I doubt they insert manually 4 space. I think instead that they write the posts via email.

You would be surprised! I had hundreds of users, in a instance where reply by email was disabled, putting the four spaces because they were mimicking pen and paper standards. They also did the same when using a word processor or email.

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [March 20, 2019, 8:40pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/8 "2019-03-20T20:40:36Z")

</div>

> [@dax](#):
>
> I doubt they insert manually 4 space.

The Thunderbird email client does it automatically for some of my users. 😒

---

<div class="post-metadata">

### Author: ![outofthebox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/outofthebox/32/83708_2.png) [@outofthebox](https://meta.discourse.org/u/outofthebox)
#### Post date: [January 16, 2020, 1:47pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/9 "2020-01-16T13:47:02Z")

</div>

> [@dax](#):
>
> You can also change the site setting `code formatting style` from the default `4-spaces-indent` to `code-fences` . If users can leave 4 blanks spaces before a line (maybe because they use emails?) it is difficult for them to use ``` by mistake.

Dax, I’ve noted that even with this setting set as ‘code-fences’, the system still translates four spaces into a code formatting. Is there a way/option to disable the four spaces = code markdown/formatting globally on a site?

I ask because a couple of times a week a participant accidentally posts their comments in the code format, making it difficult to read. I think it is because this convention still prevails among some people:

> [@Falco](#):
>
> You would be surprised! I had hundreds of users, in a instance where reply by email was disabled, putting the four spaces because they were mimicking pen and paper standards. They also did the same when using a word processor or email.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 17, 2020, 2:54pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/10 "2020-01-17T14:54:11Z")

</div>

> [@outofthebox](#):
>
> Is there a way/option to disable the four spaces = code markdown/formatting globally on a site?

No, there is not any way to do that.

---

<div class="post-metadata">

### Author: ![outofthebox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/outofthebox/32/83708_2.png) [@outofthebox](https://meta.discourse.org/u/outofthebox)
#### Post date: [January 17, 2020, 3:03pm UTC](https://meta.discourse.org/t/disable-code-formatting-for-inappropriate-4-space-indent/112161/11 "2020-01-17T15:03:32Z")

</div>

Fair enough!

Please consider this a feature request.

I wonder what percentage of Discourse forums have a need for code blocks? It seems to me that might be the distinct minority of communities?
