views:

398

answers:

5

Is there a utility that will generate html or css for blocks of code (.net c#) when you post it on a website?

I have seen several websites with very nicely formatted code and I dont believe they do this manually.

Thanks,

Alex

+4  A: 

Google prettify -

http://code.google.com/p/google-code-prettify/

Kev
+1  A: 

CopySourceAsHtml is an add-in for Microsoft Visual Studio 2005 that allows you to copy source code, syntax highlighting, and line numbers as HTML.

http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/

It's highly configurable, and works much better than the download page would make you expect! Don't know if there is something similar for VS 2008

If you don't have the ability to add the google prettifier CSS reference, this would be a better way to go, as what you get is a complete HTML with the required style. I use it all the time on our developers wiki, and loving it.

Torbjørn
+1  A: 

You can get JavaScript syntax-highlighting scripts, such as this one by Dean Edwards.

This is also a jQuery version apparently based on it which looks good.

Phill Sacre
Pagina no contrada :(
JoshJordan
+5  A: 
Rinat Abdullin
A: 

An even better solution, if you don't want to bother installing anything, is to just use the little web app I wrote called BlogTrog CodeWindow:

http://www.blogtrog.com

It's easy to use. Just paste your code and embed the results.

Elmo Gallen