I finally got tired of dealing with reformatting that Wordpress does in its attempt to be “user friendly”. In general it does the right thing, but when you deal with code snipits inside <code> tags a lot it can quickly become a problem.
In just a few easy steps, the problems can be solved.