As you might have noticed here, I am using a JavaScript syntax highlighter for showing off my code. If you were wondering what it was and how to set it up with BlogEngine.NET, this post is for you.
The basis for this is taken from this blog by Chris Blankenship, I have taken his extension and modified it a little, so it works not only with posts in BlogEngine.NET, but also with pages as you can see on this site.
Here are step by step instructions on what you need to do.
- Download the latest version of SyntaxHighlighter (1.5.1 as of today)
- Extract and upload the db.SyntaxHighlighter folder into the root of your BlogEngine.NET app (not necessarily the root of your site).
- Download and install Windows Live Writer (a program I heartily recommend for posting to blogs).
- Download and install the SyntaxHighlighter Windows Live Writer Plugin
- Download my modified SyntaxHighlighter BlogEngine.NET extension
- Extract it and upload SyntaxHighlighter.cs into ~/App_Code/Extensions
- When posting to the site with Windows Live Writer, just click on "Insert Code..." on the right toolbar, choose you language and paste the code in the window. This should now be nicely formatted on your blog.