tags:

views:

334

answers:

9

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.

+6  A: 

The GeSHi text highlighter is pretty awesome. If you're using WordPress, there's a plugin for you already

Glenn Slaven
Add me in as a GeSHi fan.
Chris Charabaruk
+1 GeSHi. It is so simple to use.
goths
This looks great. Thanks!
Nick Gerakines
+1  A: 

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.

Geoff
Yeah, Yahoo/Google search both gave good results. I'm asking more along the lines of what do you use and why.
Nick Gerakines
Reading up on this one, performance doesn't look hot if you have a lot of code to display.
Ethan Post
+1  A: 

Syntax Highlighter is used by wordpress and produces nice results.

Romain Verdier
+1  A: 

Copy Visual studio code as HTML http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/

Jobi Joy
+1  A: 

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

Dror Helper
+1  A: 

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
Cd-MaN
+1  A: 

Personally, I use this website to do it for me: http://puzzleware.net/codehtmler/default.aspx

Jim Burger
A: 

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.

PhiLho
A: 

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).

Ray Vega