I came across a post about syntax highlighting for code in WordPress on Thomas Roach’s blog who in turn saw it on Tyler Muth’s blog. There is a plugin called syntax highlighter which does all the beauty. Use is very simple:
Download it from here.
Upload to your blog’s plugins folder and extract it over there.
Now (on WordPress) go to Plugins page and activate the plugin.
To use it wrap your code like
and you are done.
Wanna see, how does it look like 😉
Isn’t beautiful 😉