Copy As HTML
This is a lightweight tool that allows you to copy code from the Code Window and convert it into HTML while preserving syntax highlighting, indentation, background colour and font face.
Sample:
Code Snippet
-
using System;
-
using System.Windows.Forms;
-
using System.Drawing;
-
-
namespace WindowsFormsApplication1
- {
-
///
<summary>
-
///
Class summary.
-
///
</summary>
-
public
partial
class
Form1 : Form
- {
-
///
<summary>
-
///
Constructor summary.
-
///
</summary>
-
public Form1()
- {
- InitializeComponent();
- }
- }
- }
To copy code in HTML format:
- In the Code Window, highlight the code that you want to copy.
- Right-click on the selected code.
- Click on "Copy As HTML..." on the context menu.
- Select the options you want in the settings dialogue.
- Optionally click "Save As Defaults" so that the Add-in remembers them.
- Click on OK.
The code will then be copied to the Clipboard in two formats: HTML format and text format. These two formats cater for the two views you typically get in a blog editor: WYSIWYG view and HTML code view. Note: You can also access the Add-in from the Menubar –> Edit –> Copy As HTML...
Options:
- Max Height
- Title Block
- Alternating Lines
- Line Numbers
- Wrap Lines
- Un-indent
- Background Colour
-
Copy As HTML Source
- HTML Encode. Converts the HTML source code to encoded HTML.
- Syntax Highlighting. Applies full syntax highlighting to the HTML-encoded HTML source code.
-
Use Class Names
Your custom colours are left intact because it converts the RTF, outputted by Visual Studio, into HTML.
Line numbering is produced by making use of HTML ordered list; this produces far more efficient HTML code than span tags cluttering up your webpage. This approach requires co-operation from the accompanying style sheet. The example below assumes the default class name is being used:
.le-cah-container
li
{
list-style-image:
none;
list-style-position:
outside;
list-style-type:
decimal;
}
Also, empty span tags are removed; something that many RTF to HTML converters leave behind in the conversion process.
Change History:
Version |
Date |
Description |
2.1 |
9 Apr 2015 |
Re-enabled the option to choose the background colour because it now uses an improved algorithm to obtain the background colour set in Visual Studio.
Updated localisations.
|
2.0 |
11 Mar 2015 |
Updated installer for VS2013.
Added functionality to preserve font family. Defaults to Consolas.
Improved option Copy As HTML Source with Syntax Highlighting.
Changed indentation character to  .
Disabled the option to choose the background colour because it now uses the background colour set in Visual Studio.
|
1.9 |
24 May 2013 |
Updated installer for VS2012. |
1.8 |
— |
Not released. |
1.7 |
9 Aug 2011 |
Added start line number.
Improved Unicode conversion.
|
1.6 |
13 May 2011 |
Updated MSI for VS2010. |
1.5 |
19 Dec 2009 |
Added support for negative Unicode characters in the RTF. |
1.4 |
26 Oct 2009 |
Added the control to more context menus to support the following file types: .asax (VB), .asax (C#), .ashx, .asmx, .css, .js, .wsf, .xaml |
1.3 |
12 Oct 2009 |
Outputs quotation marks as named HTML character entities to prevent some blog editors from converting straight quotes to smart quotes.
Copy As HTML Source: Uses HTML Encode instead of replacing angle brackets.
|
1.2 |
24 Sep 2009 |
Corrected line number margin for code snippets with less than ten lines of code. |
1.1 |
23 Sep 2009 |
Added control to context menus for ASPX, ASP and HTML windows.
Added option: Copy As HTML Source.
Added option: Use Class Names.
Changed to ems for line number margin to allow for variable font sizes.
|
1.0 |
16 Sep 2009 |
Original. |