# Plugins for writing coding text in the topics

**URL:** https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460
**Category:** Support
**Created:** [June 10, 2020, 11:01pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460 "2020-06-10T23:01:37Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Thamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thamer/32/183183_2.png) [@Thamer](https://meta.discourse.org/u/Thamer)
#### Post date: [June 10, 2020, 11:01pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/1 "2020-06-10T23:01:37Z")

</div>

Hi there,

I would like to know if there is any plugins at Discourse which I can write a topic with codes like in the picture bellow??

With colors, idents and so on.

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/9/996e5d2e5b4e485e1593efcf7bd11a85d0738e25.png)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [June 10, 2020, 11:07pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/2 "2020-06-10T23:07:46Z")

</div>

I may be missing something, but you can already use [code blocks](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code):

```js
console.log("hi");

```

It works the same as Discord which your screenshot was taken from.

---

<div class="post-metadata">

### Author: ![Thamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thamer/32/183183_2.png) [@Thamer](https://meta.discourse.org/u/Thamer)
#### Post date: [June 10, 2020, 11:10pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/3 "2020-06-10T23:10:41Z")

</div>

sorry about my ignorance, but how can I use these code blocks writing a topic?

Exactly the ideia is to copy Discord in this way.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [June 10, 2020, 11:11pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/4 "2020-06-10T23:11:55Z")

</div>

3 backticks + language name (optional):

```js
console.log("hi");

```

---

<div class="post-metadata">

### Author: ![Thamer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thamer/32/183183_2.png) [@Thamer](https://meta.discourse.org/u/Thamer)
#### Post date: [June 10, 2020, 11:21pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/5 "2020-06-10T23:21:07Z")

</div>

I think I got it, but for example in this code, how about the colors for some functions? It is displaying some colors but not as the picture is shown in discord.

The language is python.

```python
input long MagicN = 1234;

CTrade negocio;
CPositionInfo posicao;
bool InseriuParcial = false;

void OnTrade()
{
   ExpiringOrdersPartial(_Symbol, MagicN);
}

void OnTick()
{   
   //....
   
   bool pos = posicao.SelectByMagic(_Symbol, MagicN);
   
   if (pos) && (!InseriuParcial)
   {
      string comment = "[part:" + IntegerToString(posicao.Ticket()) + "]"; 
      if (PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)
      {
         negocio.BuyLimit(1.0, simbolo.Last() -500, _Symbol, 0, 0, orderTypeTime, 0, comment + " Partial");
         negocio.BuyLimit(1.0, simbolo.Last()-1000, _Symbol, 0, 0, orderTypeTime, 0, comment + " Partial");
      }
      else
      {
         //....
      }
      InseriuParcial = true;
   }
   
   //....
}

void ExpiringOrdersPartial(string symbol, long m_magic)
{  
   int total = OrdersTotal();
   for(int i = total - 1; i >= 0; i--)
   {    
      ulong order_ticket = OrderGetTicket(i);
      
      if((OrderGetString(ORDER_SYMBOL) != symbol) || (OrderGetInteger(ORDER_MAGIC) != m_magic))
         return;
      
      string comment = OrderGetString(ORDER_COMMENT);
      string tokenB = "[part:";
      string tokenE = "]";
      
      int posB = StringFind(comment,tokenB);
      if (posB != -1)
      {
         int posE = StringFind(comment,tokenE, posB + StringLen(tokenB));
         if (posE == -1)
            return;
         
         string position_ticketS = StringSubstr(comment, posB + StringLen(tokenB), posE - (posB + StringLen(tokenB)));
         ulong position_ticket = (ulong)StringToInteger(position_ticketS);
         
         if (!PositionSelectByTicket(position_ticket))
            OrderDelete(order_ticket);
      }
   }
}

```

---

<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: [June 10, 2020, 11:32pm UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/6 "2020-06-10T23:32:32Z")

</div>

AFAIK Discord uses the same library for code as we do: [GitHub - highlightjs/highlight.js: JavaScript syntax highlighter with language auto-detection and zero dependencies. · GitHub](https://github.com/highlightjs/highlight.js)

If you want your code to look the same as Discord in a Discourse post, install [Codeblock Theme Picker](https://meta.discourse.org/t/codeblock-theme-picker/146396) and change the theme to Solarized Dark.

---

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://meta.discourse.org/u/EricGT)
#### Post date: [June 11, 2020, 12:31am UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/7 "2020-06-11T00:31:14Z")

</div>

At our site we have a page that demonstrates the different variations enabled.

> **[Language highlighting](https://swi-prolog.discourse.group/t/language-highlighting/2260)**
>
> Highlight.js Discourse has the ability to use highlight.js to do source code highlighting within a post. As this feature is CPU intensive, Discourse has an admin option to select which programming languages can be used with code blocks; see...

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 11, 2020, 12:45am UTC](https://meta.discourse.org/t/plugins-for-writing-coding-text-in-the-topics/154460/8 "2020-07-11T00:45:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
