Discourse natively supports syntax highlighting, using highlight.js by default.
If your code isnโt highlighting correctly, you can force the language you want to use within the code block, like this:
``` ruby
3.times do |stuff|
stuff.do
end
```
Which renders as:
3.times do |stuff|
stuff.do
end
The language you set must be available on the platform. You can check the language settings on your Discourse site by looking at the highlighted_languages configuration option.
If your posts still donโt display correctly, youโll need to contact your site administrator.
Discourse usually displays syntax highlighting with its default installation.
No Syntax Highlighting
If you donโt want any syntax highlighting for your code, you can type the characters โtextโ after the code block:
``` text
Your text to NOT highlight here
```
Your text to NOT highlight here
As shown above.
Please refer to the original article iSharkFly - ้ฃ้ฒจ for more information.
Thanks to the official support.
