You can highlight a section of code in the text box and click the </>
button in the toolbar. This post has a .gif on it: How to get help on the Dynamo forums. You can wrap single line codes with ` ` (tilde key) as well. And @Alban_de_Chasteigner beat me to it.
Important to note that the code will not always be copied and pasted properly. Sometimes double quotation marks (" ") will be changed to "e or whatever the base code for it is and indentations will be removed. Always double check pasted code to make sure it looks correct.