views:

295

answers:

4

Is there a free code to html syntax highlighter written in C#? I am looking for something I can host in an .net mvc app

+1  A: 

If you can access a command line tool, you can get pygments (it is python), but just pipe the output back into your app.

http://pygments.org/

It's has a multitude of output formats.

mikelikespie
+1  A: 

While I haven't open-sourced it yet, you'd be welcome to the formatter I use for the C# in Depth web site. Give it a try, and let me know if you'd like to use it.

Jon Skeet
Thanks for the code!!!
Jamey McElveen
@Jon are you still planning to release the source?
Chris S
@Chris S: At some point, if I ever get time. I have too many other projects on at the moment though.
Jon Skeet
A: 

I wrote a C# syntax highlighter using regex and a mini "state machine" (a few if statements) here, it could be adapted for C, C++ and Java fairly easily. It produces the inline styles by default and a pre tag.

The source is there in C#.

(Cross pollination answer)

Chris S