Thursday, February 19, 2009

Using SyntaxHighlighter with Live Writer

After trying some other Windows Live Writer plug-ins without much success (as you can see from my previous post) I finally found the SyntaxHighlighter which is really great. The new version has support for blogger through the bloggerMode setting and is also kindly hosted by Alex (the creator of SyntaxHighlighter) so that you do not need to host it yourself. An excellent blog post that explains how you can enable SyntaxHighlighter for your Blogger blog can be found here.

There is also a  plug-in for WLW named Precode that has excellent support for SyntaxHighlighter and also looks quite nice:

precode

EDIT: It seems that the Precode plug-in does not have support for the latest version of SyntaxHighlighter and I has to manually edit the generated HTML and add “brush: ” before c#  in the pre tag.

So I can finally have my snippets here beautifully formatted like this:

[TaskCapabilities(IsSpecial = true)]
[ExportMetadata("IsSpecial", true)]
[Export(typeof(ITask))]
public class AnotherTask : ITask
{
#region ITask Members

public bool Process(string input)
{
Console.WriteLine("Another task");
return true;
}

#endregion
}

May the syntax-highlighter be with you!

No comments: