Thursday, May 24, 2007

Syntax-Highlighted Code from Visual Studio as HTML

Maybe you wondered about syntax-highlighted code in this blog but blogger.com does not provide any tool for this. If you use Visual Studio, just try this CopySourceAsHtml add-in.

CopySourceAsHtml generates HTML source of your syntax-highlighted code in VS. You can select and copy your code as HTML to clipboard, so your syntax-highlighted code can be placed anywhere.

Here are my settings of CopySourceAsHtml add-in:


My "File Style" is:

border:1px solid black;

padding: 8pt;

width: 94%;

overflow: auto;

background-color: #F0F0F0;


Here is an example output:

using System;

 

class HelloWorld

{

  static void Main()

  {

    Console.WriteLine("Hello, World!");   

  }

}



kick it on DotNetKicks.com

5 comments:

starecml said...

oooooh! Thanks a lot! I was looking for this for a long time!

starecml said...

Hey, Angwin, I was just testing this tool on VS 2005 and it works fine. I would like to ask you, if exists something similar for Microsoft Web Developer 2005 Express, because I'm developing in ASP.NET mostly...

About Me said...
This comment has been removed by the author.
David Chen said...
This comment has been removed by the author.
Bambi said...

Good post.