Calling the method at runtime

Aug 18, 2009 at 9:46 PM

I'm builing a code-building program.

I want users to preview the code, using html in a browser.

Can I call into your assembly to do this (send code and get back html code)?

If so, can you give sample?

What reference do I add to my project?


If not, I will just factor out what I need from your source files,

but I'd rather not have to. Thanks.

Aug 20, 2009 at 3:32 PM

CopySourceAsHtml doesn't have its own syntax highlighting library.  It simply calls on Visual Studio to copy the selected text with syntax highlighting as RTF, converts the RTF to HTML, and applies some transformations to remove indentation, add line numbers, alternate line colors, etc.  If you're looking for a general purpose syntax highlighting library that will work outside of Visual Studio, I'd look at Alex Gorbatchev's SyntaxHighlighter:

Scott Hanselman blogged about SyntaxHighlighter here, and the comments have links to some other tools that might work for you: