CopySourceAsHtml is a godsend for those developers who need to display source code in HTML format. (Blogs, online documentation, and developer forums all come to mind as reasons you need to display code as well-formated HTML.) A version compatible with VS 2005 was just released. To understand why you need this VS add-in, take a look at Hello World as copied and pasted using Edit… Copy… Paste…
using System;
namespace JamesKovacs.Examples {
/// <summary>
/// Summary description for HelloWorld
/// </summary>
static class HelloWorld {
public static void Main() {
Console.WriteLine(“Hello, World!”);
}
}
}
With CSAH, you get:
using System;
namespace JamesKovacs.Examples {
/// <summary>
/// Summary description for HelloWorld
/// </summary>
static class HelloWorld {
public static void Main() {
Console.WriteLine(“Hello, World!”);
}
}
}
CSAH is highly configurable with options to display line numbers, change fonts, override tab size, etc. If you have Consolas installed on your system, the above code snippet will be displayed in it. Otherwise, I configured a fallback to Courier then sans-serif by overriding the font list. (If you don’t override it, it uses whatever your current editor font is set to.) Awesome VS add-in!!!