When I try to paste code into Trello I get very weird formatting after saving but it seems it does format code, I just can't get it to work right. Currently I'm just putting links to Gist, but I would prefer to just paste it straight in there.
Finally found the answer here:
using markdown is outdated, its not as easy as just using Gist haha, think I'll keep that route... they should really work on their tools.
I know that the subject is a bit old, but I found myself faced with this problem.
I wrote an userscript if anyone is interested in it. It works with triple backslash with line feed and allows syntax highlighting, according to the indicated language.
In 2020, wrapping a code block in ``` (triple backticks) in Trello still drops newlines, etc.
I have to add 4 spaces before each line to get it display lines and indentation properly. Thanks @GiH for leading me to the source docs.