« Multithreading is hard. | Main | Defensive Event Publishing for Remoting »

CopySourceAsHtml

Colin Coller has created a very nice plugin for VS.Net called CopySourceAsHtml that lets you create colorized text by copying source from VS.Net. It produces pure HTML code (not the stuff spat out by Word) using embedded stylesheets:

<style type="text/css">
.csharpcode
{
	font-size: 10pt;
	color: black;
	font-family: Courier New , Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0px; }
.rem { color: #008000; }
.kwrd { color: #0000ff; }
.str { color: #006080; }
.op { color: #0000c0; }
.preproc { color: #cc6633; }
.asp { background-color: #ffff00; }
.html { color: #800000; }
.attr { color: #ff0000; }
.alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0px;
}
.lnum { color: #606060; }
</style>
<div class="csharpcode">
<pre><span class="lnum">   167: </span>    <span class="rem">/// <summary></span></pre>
<pre><span class="lnum">   168: </span>    <span class="rem">/// Creates a new socket server object and optionally starts it listening.</span></pre>
<pre><span class="lnum">   169: </span>    <span class="rem">/// </summary></span></pre>
<pre><span class="lnum">   170: </span>    <span class="rem">/// <param name="name">The friendly name for this socket server.</param></span></pre>
<pre><span class="lnum">   171: </span>    <span class="rem">/// <param name="port">The port to listen on.</param></span></pre>
<pre><span class="lnum">   172: </span>    <span class="rem">/// <param name="startListening">Whether to immediately start listening, or wait for a <see cref="StartListening"/> call.</param></span></pre>
<pre><span class="lnum">   173: </span>    <span class="kwrd">public</span> SocketServer(<span class="kwrd">string</span> name, <span class="kwrd">int</span> port, <span class="kwrd">bool</span> startListening)</pre>
<pre><span class="lnum">   174: </span>    {</pre>
</div>

Which turns out looking like this:

   167:     /// <summary>
   168:     /// Creates a new socket server object and optionally starts it listening.
   169:     /// </summary>
   170:     /// <param name="name">The friendly name for this socket server.</param>
   171:     /// <param name="port">The port to listen on.</param>
   172:     /// <param name="startListening">Whether to immediately start listening, or wait for a <see cref="StartListening"/> call.</param>
   173:     public SocketServer(string name, int port, bool startListening)
   174:     {

It's highly configurable and very cool, so if you intend to post code on the web, check it out!

TrackBack

Listed below are links to weblogs that reference CopySourceAsHtml:

About

This page contains a single entry from the blog posted on October 18, 2004 8:43 AM.

The previous post in this blog was Multithreading is hard..

The next post in this blog is Defensive Event Publishing for Remoting.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.