Home > .NET, Blogging, Wordpress > Code Syntax Highlighting in WordPress

Code Syntax Highlighting in WordPress

March 22nd, 2007

Since this blog is of a technical nature I plan to be posting more code snippets as time goes on. I obviously want the source code to appear pretty on my blog with all the syntax highlighting that one is used to in modern IDEs (including Visual Studio .NET 2003/2005). I run this blog using WordPress and I have just installed a plugin to take care of the Syntax highlighting called WP-dp.SyntaxHighlighter. It supports many languages and I’ll be interested mainly in the .NET languages. Below is an example of a code snippet in C#

using System; 

public class ReverseArraySort
{
   public static void Main()
   {
      string[] strings = {"beta", "alpha", "gamma"};
      Console.WriteLine ("Array elements: ");
      DisplayArray  (strings);
      Array.Sort    (strings); // Sort elements
      DisplayArray  (strings);
   }
 
   public static void DisplayArray (Array array)
   {
      foreach (object o in array)
      {
         Console.Write ("{0} ", o);
      }
      Console.WriteLine();
   }
}
Categories: .NET, Blogging, Wordpress Tags:
Comments are closed.