# Add a pinned topic for how to add code?

**URL:** https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408
**Category:** Meta
**Created:** [26 May 2018 10:40 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408 "2018-05-26T10:40:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [26 May 2018 10:40 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408/1 "2018-05-26T10:40:23Z")

</div>

Is it worth adding a pinned topic with a suggestion of how to add code snippets or how to post a flow? Currently the \</\> button adds preformated text, which is handled differently to four spaces indent.

> **[Easy way to change preformatted text (code) button?](https://meta.discourse.org/t/easy-way-to-change-preformatted-text-code-button/16760/41)**
>
> It tends to depend heavily on the audience. I object rather strongly to randomly colorized text, which is what happens when “code syntax highlighting” is applied to random preformatted text. I definitely support a site setting to accommodate either...

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 May 2018 10:47 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408/2 "2018-05-26T10:47:15Z")

</div>

Possibly. It may not be clear that posts are Markdown formatted so the easiest way to add a block of code is with 3 backticks on their own line to start and again to stop the block

```auto
` ` `
like this (but without the spaces between of course)
and this
` ` `

```

You can also indent by 4 spaces which is what the `</>` button does.

In addition, single backticks wrapped around some text give inline code formatting. ```<like><this>``` (but single not double).

The GitGub flavoured markdown help pages are good to understand the possibilities. Discourse is not quite the same but similar.

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [26 May 2018 10:53 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408/3 "2018-05-26T10:53:24Z")

</div>

Unfortunately thats not what the `</>` does for me!  
For me, the `</>` adds a single backtick

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 May 2018 10:59 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408/4 "2018-05-26T10:59:01Z")

</div>

Ah, depends what you’ve `selected` first. If you select a whole line or more (at least one newline), you get the 4 space indent, otherwise you get single backticks. What you’d expect and a nice touch. You get the same in other markdown editors too.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [26 May 2018 11:00 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408/5 "2018-05-26T11:00:48Z")

</div>

Hopefully this is still accurate

> **[Post format reference documentation](https://meta.discourse.org/t/post-format-reference-documentation/19197)**
>
> Is there any documentation on the official reference format Discourse uses for formatting posts? Use Markdown or BBCode to format. I know there’s no official Markdown spec, and the BBCode.org reference documentation leaves much to be desired. Is...

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 May 2018 11:12 UTC](https://discourse.nodered.org/t/add-a-pinned-topic-for-how-to-add-code/408/6 "2018-05-26T11:12:54Z")

</div>

Cool, I learned some things there. Only recently started using discourse because of switching my blog to Hugo.
