GeSHi WordPress Sample with Javascript

The WP-Syntax plugin allows easy insertion of code in blog posts, using GeSHi (Generic Syntax Highlighter). It supposedly supports over one hundred programming languages, including including PHP, HTML, CSS, Java, C, Lisp, XML, Perl, Python, and assembly.

For example:

   <pre lang="html" line="1" escaped="true">
   </pre>

The line=”1″ directive tells WP-Syntax to insert line numbers. For this example, to nest xml inside xml, set escaped=”true”, and use html entities.

Here is another example, this time using “javascript” for the selected language. In this case, the code is indented. WP-Syntax converts real spaces into HTML space entities, which allows you to intend code.