Copy Source As HTML

0 comments suggest edit

My main man Colin is on fire with his latest version of CopySourceAsHtml add-in.

As this utility catches on, I think you’ll see a huge proportion of .NET bloggers using it to post source code snippets on their blogs. It now uses VS.NET’s own syntax highlighting to highlight the code. Thus whatever settings you have in VS.NET are used by the add-in. It’s also much more configurable with word-wrapping, ability to add extra styling options, etc… Here’s a couple of snippets as a demonstration.

According to the example’s on Colin’s site, it even works with aspx and css files. Unfortunately, that’s not working for me right now as I don’t see the context menu on those pages.

Nice job Colin!

    9 ///

   10 /// This just rocks my world!

   11 ///

   12 public class HtmlSourceTest

   13 {

   14     public void ThisMethodKicksButt()

   15     {

   16         //Yep. It does.

   17         Console.Write(“Hello World”);

   18     }

   19 }

///

/// This just rocks my world!

///

public class HtmlSourceTest

{

    public void ThisMethodKicksButt()

    {

        //Yep. It does.

        Console.Write(“Hello World”);

    }

}

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

One response

  1. Avatar for Colin
    Colin November 3rd, 2004

    Phil,



    CopySourceAsHtml only adds commands to the "Code Window" context menu. If you want to copy ASP.NET, HTML, CSS, XML, etc, you have to add the commands to your menus or toolbars through Tools > Customize... > Commands > Addins. See



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



    The next version will add commands to all relevant context menus. I just need to decide which context menus are relevant, and what their names are.



    Colin