Discourse has decent code highlighting for sharing code samples. We have set the default language to perl so for most examples you don’t need to explicitly set the language.
To highlight a section with code formatting, add your code, select it, then click the </>
button in the toolbar. This indents the code lines 4 spaces which makes it format as code. You can also just manually indent the lines 4 spaces.
Here is an example:
my $ticket = RT::Ticket->new(RT->SystemUser);
my ($ret, $msg) = $ticket->Load('1');
print "The subject is: " . $ticket->Subject;