How to have Code coloration?

When I post code on this forum, how do I make it so that I have syntaxic coloration? It seems preformated text is not enough.

Heya — I couldn’t find docs for Discourse specifically, but it works the same way as Github: Creating and highlighting code blocks - GitHub Docs

In short, after the three backticks at the beginning of your preformatted text, add the file extension to indicate which syntax highlighter you want to use).

This would produce:

```js

// Formatted Javascript Code! console.log(‘hello’);

```

This:

// Formatted Javascript Code!
console.log('hello');