What is the proper way to include code in a forum reply?
When I format code as preformatted text, it formats the entire post rather than just the selected text.
Thanks
What is the proper way to include code in a forum reply?
When I format code as preformatted text, it formats the entire post rather than just the selected text.
Thanks
Here’s a useful guide: https://meta.discourse.org/t/posting-code-or-preformatted-text/188910
But in summary:
Like `this`
or like this:
```
code line 1
line 2
```
gives
Like this
or like this:
code line 1
line 2
You can also specify the language like this to get coloring
```javascript
let foo = 2;
```
let foo = 2;
You can either just type the three backticks manually or use the </> button in the editor as in the video below:

Thanks to all who replied. 3 back ticks worked.