Syntax Highlighting. Converting C# (et al) to HTML.

I’ve probably read a hundred or so posts of people looking for a way to syntax highlight source code listings in HTML. Maybe I’m the last to discover this site, but http://www.manoli.net/csharpformat/ is the answer for me so far. Just cut and paste some C#, VB, html/xml/aspx code int the text box and click "format my code" and voila! You get some clean HTML displaying nicely formatted code.

The tool allows you to optionally format the code with alternating line colors and line numbers if you so desire.

public class ThisIsSoCool
{
  ///      /// This is seriously neat.      ///      
  public void YouShouldTryThis()
  {}
}

Let’s try it with line numbers.

   1:  public class ThisIsAlsoCool
   2:  {
   3:    /// 
   4:    /// Look at me ma! I’m using line numbers
   5:    /// 
   6:    public void YouShouldTryThis()
   7:    {}
   8:  }

What others have said

Requesting Gravatar... Daniel Turini Jun 17, 2004 5:17 AM
# re: Syntax Highlighing. Converting C# (et all) to HTML.
I've been using on my blog the SnippetCompiler (http://www.sliver.com/dotnet/SnippetCompiler/), which have a cool feature "Export HTML to Clipboard". :)
Requesting Gravatar... pblah Mar 10, 2005 1:22 PM
# re: Syntax Highlighing. Converting C# (et al) to HTML.
dim obj as object

with obj
.first = "xx"
.last = "yy"
.id =2
end with

obj = nothing
Requesting Gravatar... you've been HAACKED Apr 27, 2007 1:22 PM
# Insert Code for Windows Live Writer
Insert Code for Windows Live Writer
Requesting Gravatar... Community Blogs Apr 27, 2007 1:37 PM
# Insert Code for Windows Live Writer
Several pople have asked me recently about the nice code syntax highlighting in my blog. For example:

What do you have to say?

(will show your gravatar)
Please add 5 and 5 and type the answer here: