I’ve been playing with the best way to display code snippets, and came across an amazing little plugin called SyntaxHighlighter Evolved by Viper007Bond.

This is a sample usage of the syntax highlighter:
wrap your code within
[xml]
<html  xmlns =”http://www.w3.org/1999/xhtml”
xmlns:C=”http://mynamespace.swengsol.com/contacts”>
<head><title>Contacts sorted by organization<title><head>
<body>
<C:organization>

[/xml]
which displays:

<html  xmlns =”http://www.w3.org/1999/xhtml”
 xmlns:C=”http://mynamespace.swengsol.com/contacts”>
 <head><title>Contacts sorted by organization<title><head>
 <body>
 <C:organization>
 ...

In particular, note the JavaScript magic when you hover over the pretty syntax layout.

I’m getting more and more impressed with the WordPress architecture the more time I spend with it!

And, to think that all this is being done with PHP!

I’m definitely looking forward to teaching PHP and MySQL in my course on Internet Application Development over at Metro State in the fall.

For more information on this plugin – see http://en.support.wordpress.com/code/posting-source-code/.

Quick tip:

In WordPress, do any pasting of source code within the HTML view. Pasting code into the Visual editor does not seem to work well. Once you have the code pasted as

[sourcecode language=”java”]… source code here …[/sourcecode]

you can then switch to the Visual editor to complete your edits.