Wiki - how to post code on this forum

This thread is intended as a short help file for all those struggling to post formatted code on the forum.

Code block formatting

Posting formatted code on the forum (and most others) is as simple as selecting the code and pressing the </> button. It works the same as applying Bold or Italic styles to your document. It preserves indentation and applies syntax highlighting.

How to post code

Note that all the </> button does is add three backticks ``` on the line before the code block and another ``` on the line after. If you wish you can type these rather than use the button.


Inline code formatting

Enclose the code snippet in single backticks, `...`.
Inline code formatting


Collapsing code / hide details

Code can also be collapsed using the Hide Details feature. This can tidy up a thread with multiple code blocks and provides a ready-made index within the post.

Hide details

Editing posts to fix them

You can edit your post to fix the code formatting by clicking the icon pencil icon:
Forum edit post

(There is a separate pencil icon if you just want to fix the title / tags.)

17 Likes