CopySourceAsHtml: Html Source Formatting Utility
Last week I posted about a cool ASP.NET syntax highlighter that Wilco built that allows you to easily publish ASP.NET source online. This works great for cases where you want to point to live source to generate syntax, although there are also sometimes needs to statically capture source formatting and embedd it in things like blog postings.
One question I've received a few times since then is what my "secret" is for generating source in some of my longer, code-intensive, blog posts. Unfortunately my secret so far has been fairly lame -- I just use MS Word and copy/paste from VS into it (this preserves the color coding). When I'm done, I then just copy/paste everything from Word into the rich-text control for my blog (which is based on .Text) and it preserves it. The benefit of using Word is that it provides spell-checking (something I like to rely on), and it is pretty easy to use. The downside is that Word generates some pretty ugly and verbose html.
In researching things more tonight, I can across Douglas Rohm's blog about source formatting options. He pointed to a CopySourceAsHtml source formatting addin for VS 2005 that Jason Haley has written an installer for that you can download and use with VS 2005 here. This is based on the origional VS 2003 based implementation done by Colin Coller.
I'm planning on trying this out for some future blog posts and thought I'd pass it along to others who might find it useful.
Hope this helps,
Scott