☑ How to enter code in preformatted text

Holy cow, can someone please explain to me how to enter code in preformatted text with this discourse interface. I’ve been editing my post now for about 10 minutes, and I finally got it to look ok - BUT I still don’t know why or how I should do. :expressionless:

1 Like

It’s explained when you post in a topic (as the default text in the edit area).

Start block with:

```

And end block with:

```

It is weird that triple-` blocks behave differently from button “Preformatted text”, I’ve enabled to do syntax highlight for preformatted text now by default.

So, triple-’ block:

var test = function(hello) {
    return hello * 10;
};

Preformatted block:

var test = function(hello) {
    return hello * 10;
};

Update!

Now if you hit “Preformatted Text” button, it will add blocks:

var test = function(hello) {
    return hello * 10;
};

Yay!: :wink:

Update #2

Now button is renamed to be “Code Highlight”.

var response = function () {
    return "Great, now I get it!.  Triple ``` was the key." + 
        "Before there was just one ` inserted and it didn't really do the trick";
}