Code Blocks and Syntax Highlighting

I was adding a post with small blocks of code and some of the code was colored in an odd way. I dug through the discourse website and found a reference to Syntax Highlights. Bingo!

A block of code with Syntax Highlights may look like this:

cd /home/pi/.node-red
npm list -g | grep emoncms
npm list | grep emoncms

 
The same block of code with Syntax Highlights turned off looks like this:

cd /home/pi/.node-red
npm list -g | grep emoncms
npm list | grep emoncms

 
To turn off Syntax Highlights add the word “text” after the three backticks:

```text
cd /home/pi/.node-red
npm list -g | grep emoncms
npm list | grep emoncms
```

 
EDIT:
Sources:
Disable Syntax Highlighting?
Creating and highlighting code blocks
Adding additional languages to highlight.js used by Discourse

2 Likes

A cheatsheat would be handy…

Paul

1 Like

Yes it would! The original title of this post was:
“A cheatsheet to help with creating cheatsheets”

@glyn.hudson - What are the highlighted languages enabled for the OEM discourse forum??

Just the defaults I think. Let me know if you can think of anymore.

in highlights version 9.1.0 there is the language Arduino

Yah, I’ve just added Arduino. Nice :grinning: