Using code syntax highlighter with Windows Liver Writer and BlogEngine.NET
I just got the code syntax highlighter for Windows Liver Writer working together with BlogEngine.NET. I thought I’d throw together a post that lists the steps to get this working!
I use BlogEngine.NET for my blog. Which blog platform you choose is up to you. It must, however, have API-support for Windows Live Writer.
Windows Live Writer – this is probably the best thing since sliced bread. It’s so easy to edit content through this application and upload it to your blog. I love Microsoft, I really do.
Finally there’s the PreCode Snippet plugin for Windows Live Writer which is the plugin that utilizes the Syntax Highlighter 2.0 files.
Let’s throw these ingredients together!
Install Windows Live Writer and the PreCode Snippet plugin if you haven’t already.
Here’s a post about setting up WLW with BlogEngine.NET (it’s super easy):
Upload the Syntax Highlighter 2.0 files to your website.
Important: Make sure the path is preceded by “/” else the files won’t be referenced when you head down the website structure. The browser will try to look for the files in <folder>/style/ and <folder>/scripts/!
Install the PreCode snippet plugin for Windows Live Writer and then update your theme. You might have to clear the browser cache before doing this. Just hit the F12 key in Internet Explorer and then Ctrl+R. This will effectively clear your browser cache.
Here’s how it looks when you add code with the PreCode Snippet:
[PageDefinitionTypePlugIn(DisplayName="Select my cool pages")]
public class PropertyFaqItemSelect : MultiPageSelectBase
public override PageDataCollection GetPages()
// Your implementation of retrieving pages of a specific type
return Toolbox.GetPagesOnPageTypeID(0, PageReference.StartPage, true);