Posts: 3 | Comments: 9 | TrackBacks: ?

My Links

Recent Posts

Archives

Categories

Search

October 13, 2004

CopySourceAsHtml

Brad Abrams, Jay Bazuzi, Roy Osherove, and what seems like the majority of .NET bloggers use Word, Word macros, or Visual Studio macros that use Word in some way to format their code. A few use Jean-Claude Manoli's CSharpFormat tool. Each solution has drawbacks (opening Word, opening another browser window, copying and pasting, extra steps, terrible HTML, etc), and formatting code is still painful, so I've written a simple Visual Studio add-in that allows you to copy source as HTML suitable for pasting into blogs:

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

After you install CopySourceAsHtml, "Copy Source As HTML..." will appear in the code window's context menu:

When you click "Copy Source As HTML...", you'll be asked for language and formatting preferences. "Language", "Number From", and "Tab Width" are taken from the document. "Line Numbers", "Alternate Line Background", and "Embed Stylesheet" are stored in the registry.

When you click "OK", the source will be formatted according to your preferences and copied to the clipboard, ready to be pasted into your blog.

CopySourceAsHtml extends CSharpFormat, and I'm grateful to Jean-Claude for his excellent work. If you find CopySourceAsHtml useful, find a bug, see room for improvement, or know of an existing add-in that provides the same functionality, please let me know.

Thanks,

Colin

04:40 PM | Colin

TrackBacks

# VS.NET Add-In For Source Code Formatting as HTML

07:07 PM | you've been HAACKED

# CopySourceAsHTML

This is definitely one of the easiest to use tools to turn source code into syntax colored HTML. It's a...

11:21 AM | The .NET Guy

# Yet another awesome IDE Plug-in

01:16 PM | who IS jake?

# 100, CopySOurceAsHtml, SPs versus SQL e mais vergonhas

03:42 PM | LA.Net

# CopySourceAsHtml

Interested in copying source code as HTML? Well for Visual Studio users it can be done. Thanks to a little add on program located here, you can make this happen with a lot less effort that you might think. One...

04:45 PM | Lockergnome's Web Developers

# HTML Formatted Source Code

One of the cooler VS.NET addins that I've come accross. The CopySourceAsHTML addin allows you to copy source code in VS.NET as syntax-highlighted HTML. I've always used a tool I made to convert the code to formatted HTML - but this makes so much more s...

05:21 PM | { public virtual blog

# CopySourceAsHTML

CopySourceAsHTML

05:29 PM | David Boschmans' Weblog

# Syntax Highlighting

07:34 AM | t4rzsan's blog

# Code to HTML Formatter

01:43 PM | overflow

Comments

# RE: CopySourceAsHtml

Dude, this is awesome. Thanks for letting me know about it. I posted it on my blog to get the word out.

05:58 PM | Haacked

# RE: CopySourceAsHtml

p.s. my post suggests some improvements.

http://haacked.com/archive/2004/10/13/1344.aspx

05:58 PM | Haacked

# RE: CopySourceAsHtml

The only reason I couldn't use this is because it uses pre tags, that's a big advantage of the 'filtered word' approach, it uses lots of extra bits but does retain formatting without using pre tags - this is important if you're trying to retain page width for example...

07:21 AM | Scott Galloway

# RE: CopySourceAsHtml

It would be great if there was a way to assign a keystroke within VS.Net to automatically execute this with the default options...

02:52 PM | Eric

# RE: CopySourceAsHtml

Found you on Larkware. Very, very nice.

11:11 AM | AddOnUser

# RE: CopySourceAsHtml

I've updated CopySourceAsHtml since the last comment was posted. See:

http://www.jtleigh.com/people/colin/blog/archives/2004/10/copysourceashtm_1.html

06:55 PM | Colin

Post Comment

Name
Email
Url

Remember Me?