What libraries and/or packages have you used to create blog posts with code blocks? Having a javascript library that would support line numbers and indentation is ideal.
The GeSHi text highlighter is pretty awesome. If you're using WordPress, there's a plugin for you already
A simple Google query reveals http://code.google.com/p/syntaxhighlighter/
From initial looks it seems pretty good. Entirly JS based so can be implemented independent of the server side language used.
Syntax Highlighter is used by wordpress and produces nice results.
Copy Visual studio code as HTML http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/
I use Live Writer and I use VS addin that copies source code as html to copy the code and then I change into HTML view in Writer and paste the result
you can download the addin at:http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/11/21/copy-source-as-html-copysourceashtml-for-visual-studio-2008-rtm.aspx
Some time ago I've done some research on this topic and came to the conclusion that using GeSHi is the way to go. However recently I've been looking to some more alternatives:
- Using Windows Live Writer with a syntax highlighter plugin (there are several available)
- Using the syntaxhighlighter library or the google code prettify library. Both are written in JS and I think the second one is used on stackoverflow
- Use some intermediate process, where I write the posts in Markdown for example and let a program generate the final HTML
Personally, I use this website to do it for me: http://puzzleware.net/codehtmler/default.aspx
If that's my own code, I would just use SciTE's export to HTML and paste it.
Otherwise (highlighting code like it is done here), I would prefer to do it on server side: JS highlighting (as seen, for example, on JavaLobby) happens after the page have been displayed in default mode (so there is a sudden change of look, not very nice), and is often slow, plus JS can be disabled.
Actually, such task can be done once, after user input, it doesn't need to be done over and over on each page served to visitor.
I usually use this free online tool that formats C# code. Along with C#, it also formats code for VB, HTML, XML, T-SQL and MSH (code name Monad).