I think a good way to show code (until we wait for all servers to have Markdown like , at least) is to show a generated code image (from one of several online tools, or screenshot if you must) and add the code as the ALT text/description of the image, as in the quoted toot.

If, as in this case, the code is too long for the ALT text (this will only happen for long code snippets like this) the code could go in an unlisted reply to the toot with the image (or in the same toot, if you prefer/have space)

I think it’s useful to have both a properly-formatted version for those who just want to read code and text which people can copy-paste

gist and other solutions means you need to leave the site - not ideal, I think

Stephen Gruppetta  
Here’s the code for the plot in the previous post - put in your own image file, of course! You can get the text from the images’s ALT text
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.