CopySourceAsHtml (CSAH)

Introduction

CopySourceAsHtml is an add-in for Microsoft Visual Studio 2008 that allows you to copy source code, syntax highlighting, and line numbers as HTML. CSAH uses Visual Studio's syntax highlighting and font and color settings automatically. If Visual Studio can highlight it, CSAH can copy it, and your source should look the same in your browser as it does in your editor.

Visual Studio .NET:

Ugly Background Colors

HTML:

   32     #region Configuration Class Definitions

   33     #region Enum Definitions

   34     /// <summary>

   35     /// Enum containing the mode options for the exceptionManagement tag.

   36     /// </summary>

   37     public enum ExceptionManagementMode

   38     {

   39         /// <summary>The ExceptionManager should not process exceptions.</summary>

   40         Off,

   41         /// <summary>The ExceptionManager should process exceptions. This is the default.</summary>

   42         On

   43     }

Latest Release

CopySourceAsHtml 3.0

CopySourceAsHtml 3.0 Installer (389 KB) (built and tested on Microsoft Visual Studio 2008)

CSAH 3.0 is the first official release of CopySourceAsHtml for Microsoft Visual Studio 2008. This release also adds support for saving files as HTML (Save As HTML), fixes a number minor defects, and marks a return to active development of CSAH.

Scott Mitchell, Guy Burstein, Andreas Erben, Dustin Campbell, Jeff Kwak, and the many other bloggers and developers who've helped keep CSAH relevant and useful in the long stretch between 2.0 and 3.0, thank you for your efforts. They're much appreciated.

Earlier Releases

CopySourceAsHtml 2.0.0

CopySourceAsHtml 2.0.0 Installer (163 KB) (built and tested on Microsoft Visual Studio 2005)
CopySourceAsHtml 2.0.0 Source (91 KB) (now includes build and installer scripts)

CSAH 2.0.0 is the first official release of CopySourceAsHtml for Microsoft Visual Studio 2005. This release has a leaner, meaner, refactored codebase that fixes a few minor defects and takes advantage of new features in Visual Studio 2005 and .NET 2.0. Derick Bailey and Jason Haley, thank you both for releasing your port in a much more timely fashion.

CopySourceAsHtml 1.2.4 (original announcement)

CopySourceAsHtml 1.2.4 Installer (280 KB) (built and tested on VS.NET 2003)
CopySourceAsHtml 1.2.4 Source (38 KB)

CSAH 1.2.4 allows you to copy single-byte, double-byte, and Unicode characters from VS.NET. Previous versions only allowed you to copy single-byte and Unicode characters, and converted multi-byte characters to question marks. The new version should work properly for any DBCS codepage. Much of the credit for the new version goes to Qingbo Zhou for his suggestions, help debugging, and testing.

CopySourceAsHtml 1.2.3 (original announcement)

CopySourceAsHtml 1.2.3 Installer (280 KB) (built and tested on VS.NET 2003)
CopySourceAsHtml 1.2.3 Source (38 KB)

I've released CopySourceAsHtml version 1.2.3, but it's a bit of a step backward, and you might not want to upgrade.

CSAH 1.2.3 generates heavier HTML than CSAH 1.2.2. I'm releasing 1.2.3 now because at least two popular blog engines (dasBlog and Blogger) introduce spaces, line breaks, and other formatting errors when converting the lighter 1.2.2-produced HTML to XHTML for their feeds. If you're experiencing these errors, you should upgrade to 1.2.3. If not, you should wait for 1.2.4.

CopySourceAsHtml 1.2.2 (original announcement)

CopySourceAsHtml 1.2.2 Installer (287 KB) (built and tested on VS.NET 2003)
CopySourceAsHtml 1.2.2 Source (36 KB)

I've released CopySourceAsHtml version 1.2.2 with changes suggested by Daniel Moth.

CSAH now generates lighter HTML in all cases and much, much, much lighter HTML if word wrapping is disabled. I also fixed a few minor bugs that nobody reported.

CopySourceAsHtml 1.2.1 (original announcement)

CopySourceAsHtml 1.2.1 Installer (284 KB) (built and tested on VS.NET 2003)
CopySourceAsHtml 1.2.1 Source (33 KB)

I've released CopySourceAsHtml version 1.2.1 with a change suggested by Jonathan Greensted and with a lot of little fixes for myself.

CSAH now has a "Remove Indentation" checkbox on the "General" tab. If it's checked, CSAH will remove unnecessary indentation from the copied code, leaving it flush against the left border. CSAH now also:

CopySourceAsHtml 1.2.0 (original announcement)

CopySourceAsHtml 1.2.0 Installer (283 KB) (built and tested on VS.NET 2003)
CopySourceAsHtml 1.2.0 Source (32 KB)

I've released CopySourceAsHtml version 1.2.0 with changes suggested by Scott Galloway, Phil Haack, Rick Lobrecht, Geoff Appleby, and others.

The biggest change in this release is that CSAH uses VS.NET's syntax highlighting and VS.NET's font and color settings automatically. If VS.NET can highlight it, CSAH can copy it, and your code should look the same in your browser as it does in your editor.

Other changes:

CopySourceAsHtml 1.1.0 (original announcement)

This version is no longer available for download.

CopySourceAsHtml 1.0.0 (original announcement)

This version is no longer available for download.

Announcements, News

CopySourceAsHtml announcements and news are posted to my blog. Feel free to make suggestions or report defects in comments on appropriate posts.

License

CopySourceAsHtml was written by Colin Coller and was released by J.T. Leigh & Associates Inc. under the following license:

A License to use this software, including any accompanying documentation 
("Software"), is provided to you by J.T. Leigh & Associates Inc. J.T. Leigh & 
Associates Inc. owns all rights, title, and interest in and to the Software. The 
user assumes the entire risk as to the accuracy and the use of the Software.

COPYRIGHT NOTICE. Copyright © 2008 J.T. Leigh & Associates Inc. All rights 
reserved.

NO WARRANTY. THE SOFTWARE AND INFORMATION INCLUDED THEREIN IS PROVIDED "AS-IS," 
WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR 
OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, J.T. LEIGH & 
ASSOCIATES AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER 
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND 
CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, 
AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.

J.T. LEIGH & ASSOCIATES DOES NOT WARRANT THAT THE FUNCTIONS FOR THE LICENSED 
SOFTWARE OR CODE CONTAINED IN THE SOFTWARE WILL MEET YOUR REQUIREMENTS, OR THAT 
THE OPERATION OF THE LICENSED SOFTWARE OR CODE WILL BE UNINTERRUPTED OR ERROR-
FREE, OR THAT DEFECTS IN THE LICENSED SOFTWARE OR CODE CAN BE CORRECTED. 
FURTHERMORE, J.T. LEIGH & ASSOCIATES DOES NOT WARRANT OR MAKE ANY 
REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF THE LICENSED 
SOFTWARE, CODE OR RELATED DOCUMENTATION (IF ANY) IN TERMS OF THEIR CORRECTNESS, 
ACCURACY, RELIABILITY, OR OTHERWISE. NO ORAL OR WRITTEN INFORMATION OR ADVICE 
GIVEN BY J.T. LEIGH & ASSOCIATES OR ITS AUTHORIZED REPRESENTATIVES SHALL CREATE 
A WARRANTY OR IN ANY WAY INCREASE THE SCOPE OF THIS WARRANTY. SHOULD THE 
LICENSED SOFTWARE OR CODE PROVE DEFECTIVE AFTER J.T. LEIGH & ASSOCIATES HAS 
DELIVERED THE SAME, YOU, AND YOU ALONE, SHALL ASSUME THE ENTIRE COST ASSOCIATED 
WITH ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN 
NO EVENT SHALL J.T. LEIGH & ASSOCIATES OR ITS SUPPLIERS BE LIABLE FOR ANY 
SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, 
WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, 
LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE 
USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF J.T. LEIGH & ASSOCIATES HAS 
BEEN ADVISED OF THE POSSIBLITY OF SUCH DAMAGES. BECAUSE SOME STATES AND 
JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR 
CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY. J.T. 
LEIGH & ASSOCIATES'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY UNDER THIS 
AGREEMENT SHALL NOT EXCEED FIVE DOLLARS (US$5.00).