Insert Code for Windows Live Writer

code, tech, blogging 0 comments suggest edit

Several pople have asked me recently about the nice code syntax highlighting in my blog. For example:

public string Test()
  //Look at the pretty colors
  return "Yay!";

A long time ago, I wrote about using for converting code to HTML.

But these days, I use Omar Shahine’s Insert Code for Windows Live Writer plugin for, you guessed it, Windows Live Writer. This plugin just happens to use the Manoli code to perform syntax highlighting.


I recommend downloading and referencing the CSS stylesheet from the Manoli site and making sure to uncheck the Embed StyleSheet option in the plugin.

The dropshadow around the code is some CSS I found on the net.

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



12 responses

  1. Avatar for Ryan
    Ryan April 27th, 2007

    You realize of course, that if you do not embed the CSS inline that it does not show in RSS aggregators, right? While the few users that read the actual HTML website will see pretty things, people that use RSS readers will not see anything.

  2. Avatar for Haacked
    Haacked April 27th, 2007

    True. It's the price I pay for seeking out XHTML compliance. ;)

  3. Avatar for Jeff Atwood
    Jeff Atwood April 27th, 2007

    And yet the code is completely colorless in my RSS reader.. that's why I've devolved to old-school embedded FONT tags, which may not be pretty, but they work in every RSS reader on the planet.

  4. Avatar for Filini
    Filini April 27th, 2007
    [...] old-school embedded FONT tags [...]

    But Jeff... that is sooooooooo FrontPage! :P
    In a distant future, browsers will give a real purpose to the tag, using the (deprecated) language attribute... so that, instead of using <pre class="csharpcode"> with many subclasses, you will just write and all the keywords will be handled by the browser...
    oh well... one can dream :)

  5. Avatar for Filini
    Filini April 27th, 2007

    Woops! A piece of code was eaten by some computer imp... my last sentence was:
    [...] you will just write <code language="csharp" and all the keywords will be handled by the browser...

  6. Avatar for Rick Strahl
    Rick Strahl April 28th, 2007

    FWIW, there are a couple of other plug-ins for Live Writer that are maybe easier. Using one of the Visual Studio plug-ins (or Jeff's Macro) to copy VS.NET code to HTML you can use these plug-ins to post HTML code.
    The advantage of this is that it will work with RTF code that Visual Studio understands and with some of the plug-ins you get a bunch of formatting options.
    In fact - I've been meaning to create a plug-in for Paste from RTF (maybe somebody's done that by now) which would be easier yet since you could just copy directly from VS (or any RTF output for that matter).

  7. Avatar for Jeff Atwood
    Jeff Atwood April 28th, 2007

    > you will just write and all the keywords will be handled by the browser...
    You can do that now with JavaScript.
    I've tried both ways, but I prefer embedded HTML using the old-school FONT tag which works literally everywhere.

  8. Avatar for Filini
    Filini April 28th, 2007

    Yes, right now the FONT tag is the best solution for all the different browsers/clients.
    My dream was to need NO solution at all, since HTML provides a nice CODE tag :-)

  9. Avatar for Mads Kristensen
    Mads Kristensen April 29th, 2007

    Font tags are very ugly I think. The best way would be to style the different span tags directly in the HTML. That also works in RSS readers

  10. Avatar for Simone Chiaretta
    Simone Chiaretta May 10th, 2007

    If you use styles directly inside the HTML the size of the post will become huge since every different keyword can have different colors :)

  11. Avatar for Eamon Nerbonne
    Eamon Nerbonne May 13th, 2007

    Well if the choice is a somewhat larger post or color... well... give me the color already! Even if it's 4 times the size, that's definitely my preference.

  12. Avatar for Steve Dunn
    Steve Dunn May 15th, 2007

    I did a plug-in for this a while back. It also supports quick pasting of code from the clipboard. Supports many languages too. Check it out at on my tools page at The direct link is http://stevedunns.googlepag...
    Steve Dunn