There are a bunch of code/syntax highlighter plugin options for MediaWiki. After playing around with the few I just linked to, I'd like to recommend the basic GeSHi highlighter...it's by far the simplest to install, and works well with both highlighting and spacing.
To steal the commands from the wiki, here's what you do:
1) Browse to your mediawiki extensions folder:
cd /var/www/%mysite%/wiki/extensions
2) Check out the extension with SVN (you do have SVN installed, right?)
svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SyntaxHighlight_GeSHi
3) Add a single line to LocalSettings.php in your mediawiki directory root:
require_once("extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");
That's it! It's great if you do your documentation in MediaWiki...tags will only get you so far.