SyntaxHighlighter Extension for BlogEngine.NET

by chris 5/1/2008 11:57:00 PM

I have been struggling with adding code to my blog entries, never really finding anything that just worked.  Yes I know, there are various code formatting solutions out in the wild but I finally found one that has some exceptional features: SyntaxHighlighter. 

image

Several people have blogged about it's capabilities: popup view of plain text, copy to clipboard link, and many other features help to make this an exceptional code formatter. Here's an example of what the result looks like:

image

I found a cool article by Scott Dougherty that outlined how to implement SyntaxHighlighter into BlogEngine.NET and even update and update the tiny_MCE to allow for online editing.  There was just one problem...  I detest adding blog entries using the online editor.  I prefer Windows Live Writer and having to switch over to the HTML view in WLW for adding the necessary tags was not really an viable option.  So after a little looking I ran into the best thing since sliced bread (well, close anyway)...  Enter SyntaxHighlighter for Windows Live Writer

image

With this handy little plug-in you can simply click the menu option, select your code type, and then insert your code!

image

Nothing too fancy, just a simple interface that adds the necessary tags to support the SyntaxHighlighter formatting. 

So what's left?  Well to make life a little easier for everyone I decided to build a quick extension that will add the necessary items to your blog so that it's plug and play...  Just drop this extension into your blog and you don't have to bother adding any of the javascript and style sheet tags on your pages.

So now implementing this is as simple as it could be (is it really?)... Follow these steps:

  1. Download the SyntaxHighlighter code
  2. Copy the folder dp.SyntaxHighlighter into your root folder (ex. ~/dp.SyntaxHighlighter)
  3. Copy the SyntaxHighlighter.cs file into ~/App_Code/Extension folder
  4. That's it!

Let me know if this works out for you or if you have any questions and I will try and help out as best as possible.

UPDATE 7/14/08: After having trouble with the BlogEngine.NET v1.4 Javascript Handler I updated the extension to not use the handler but to serve the script directly.

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
Loading



Powered by BlogEngine.NET Theme by Mads Kristensen Hosted by 1and1 Hosting Sign in
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way. © 2008 Chris Blankenship

Welcome to my blog

Welcome to my site

Villainy wears many masks,
none of which so dangerous as virtue…



Subscribe to comments feed Recent comments exp/col

View Chris Blankenship's profile on LinkedIn   DSCODUC on Technorati

check out my neighbors in meatspace  

Stop Spam Harvesters, Join Project Honey Pot   This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License