# Difficulty using the code tag \</\>

**URL:** https://meta.discourse.org/t/difficulty-using-the-code-tag/31075
**Category:** Feature
**Created:** [July 15, 2015, 9:54am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075 "2015-07-15T09:54:27Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 15, 2015, 9:54am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/1 "2015-07-15T09:54:27Z")

</div>

Hi

On [discuss.phpList.org](http://discuss.phpList.org) our users are having issues with the code tag. There seem to be two methods of using it

1. paste in your code, select it, and click the code tag - that works fine
2. Click the code tag and paste your code - this does not work

First of all, clicking the code tag says “indent preformatted text by 4 spaces” which is selected, persumably so if you paste it replaces it? This is very counter-intuitive, perhaps “paste your code” could be more helpful? Secondly, when you then paste the code, the formatting seems to be wiped anyway, so the code tag does not work. Perhaps I am misunderstanding something here?

method 1) is quite cumbersome, so I assumed method 2 was the intended use.

Anyway, there has been a long served forum mod who has struggled with this some much he just stopped modding 😕

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 15, 2015, 10:05am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/2 "2015-07-15T10:05:14Z")

</div>

Yeah people seldom seem to get it right. If that button made a section

```plaintext

```

paste your code here

```plaintext

```

i.e. triple backtick fencing with the sentence in the middle selected, that would be more foolproof.

---

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 15, 2015, 11:27am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/3 "2015-07-15T11:27:11Z")

</div>

Do you know what the exact method for 2) is supposed to be? Is it actually supposed to work that way?

a  
x

---

<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: [July 15, 2015, 11:28am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/4 "2015-07-15T11:28:40Z")

</div>

This needs to be a switch, desirable on programming communities

---

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 15, 2015, 11:59am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/5 "2015-07-15T11:59:11Z")

</div>

so, what, switch it on, paste code, switch it off?

---

<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: [July 15, 2015, 12:04pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/6 "2015-07-15T12:04:33Z")

</div>

A site setting that admins enable on programming communities that changes the way `</>` behaves, on your php community it should insert.

````plaintext
```
paste code
```
````

Of course to make all this happen someone needs to hack up the editor and add the site setting, but we are totally open for a PR there

---

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 15, 2015, 12:43pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/7 "2015-07-15T12:43:09Z")

</div>

Unfortunately we don’t have the skills for that, or at least, not if it’s in Ruby. How much would it cost to pay Discourse core staff to implement it?

---

<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: [July 15, 2015, 12:45pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/8 "2015-07-15T12:45:06Z")

</div>

If you sign up for our standard hosting I will build the feature for you 😇

---

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 15, 2015, 12:58pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/9 "2015-07-15T12:58:37Z")

</div>

Ah, we are all hosted already buddy (we have a full time sys-admin so he does all that stuff). We are not against paying for custom work when we can afford it though - especially if it keeps our mods happy 🙂

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [July 15, 2015, 2:05pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/10 "2015-07-15T14:05:58Z")

</div>

I know it doesn’t fit with the current business model but there **is** a case to be made for a bug/feature bounty marketplace, particularly for those of us who self-host. 😉

---

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 16, 2015, 8:49am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/11 "2015-07-16T08:49:55Z")

</div>

As a community manager my advise is this: do it or someone else will do it somewhere else and less well. That someone else gets to dictate the business model, you lose a chunk of your community and the much of the power to guide the way your community works.

Just look at WordPress, how much have they lost out to the theme and plugin stores etc. By the time they added a “donate” button to the .org themes store it was far too late, many of the serious developers had moved on already. They have ended up with a lot of questionable business models dominating the way their community works. Who ever thought we would see the nasty old licence activation key back in Open Source? And freemium themes that fill peoples installs with ugly adds and malware.

If they had added a variety of appealing ways for developers to make some money and users to pay for some work earlier on, everyone would have benefited.

If you think that the need for some kind of paid development mechanism is on the rise in discourse, then you have a window of a nice few years to get ahead of the curve before the community carpet baggers come in 😉 😄

---

<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: [July 21, 2015, 1:49am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/12 "2015-07-21T01:49:25Z")

</div>

One of the easiest ways to sponsor first party development is to take a hosting contract with us. At the Business and (more so) the Enterprise level we can build new features or feature enhancements for our customers, as long as they are useful to lots of other Discourse instances.

---

<div class="post-metadata">

### Author: ![gingerling](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gingerling/32/42360_2.png) [@gingerling](https://meta.discourse.org/u/gingerling)
#### Post date: [July 21, 2015, 8:45am UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/13 "2015-07-21T08:45:20Z")

</div>

Will follow this [https://meta.discourse.org/t/how-to-sponsor-3rd-party-development-on-discourse-core/31228](https://meta.discourse.org/t/how-to-sponsor-3rd-party-development-on-discourse-core/31228) instead

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [June 26, 2016, 7:58pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/14 "2016-06-26T19:58:08Z")

</div>

This is now done via:

> [@Easy way to change preformatted text (code) button?](https://meta.discourse.org/t/easy-way-to-change-preformatted-text-code-button/16760/42):
>
> Okay, we now have a site setting for this: code formatting style Setting code formatting style to code-fences will default code button in composer to use fenced/code blocks. Example: [https://github.com/discourse/discourse/commit/83309752ae0fc224fadc73cd410dc682e7e54b3c](https://github.com/discourse/discourse/commit/83309752ae0fc224fadc73cd410dc682e7e54b3c)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [June 26, 2016, 7:58pm UTC](https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/15 "2016-06-26T19:58:15Z")

</div>


