Enabling code syntax highlighting on a SharePoint blog

by Graffen 17. November 2009 14:35

I’ve just spent an hour looking over our Sharepoint site at work and decided that I wanted to implement the same code syntax highlighting plugin as I use on here, namely the SyntaxHighlighter plugin.

To do this was actually pretty straightforward, once I figured it out. The following steps need to be performed on all three “views” that the blog has: Default, Post and Category. What you need to do is as follows:

  1. Put the page in Edit Mode by clicking Site Actions –> Edit Page in the top right corner
    image
  2. Click image  above the “Posts” Web Part
  3. Select image and press Add
  4. On the right side of the Web Part, click Edit and select Modify Shared Web Part
    image
  5. Click the image button
  6. Insert the following code snippet:
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css"/>  
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeDefault.css"/>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCSharp.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushXml.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushSql.js"></script>  
    <script type="text/javascript">  
        SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';  
        SyntaxHighlighter.all();  
    </script> 
  7. To add more brushes, simply add the references you want. To see the list, browse to http://alexgorbatchev.com/pub/sh/2.1.364/scripts/
  8. Next, in the tool panel on the right side of the page, expand the Layout section and select Hidden
    image
  9. Click OK

 

Now all you need to do is use the PreCode Pluginfor Windows Live Writer (or alternatively just use the <pre class=”brush: csharp”> … code … </pre> in the WYSIWYG editor (remember to click the Edit Html button)


image

Happy blogging :-)

Tags: , , ,

Blogging | Utilities and Tools

Testing

by Graffen 18. August 2009 15:06
Just a quick test of blogging from my iPhone. How about geotagging?

Tags:

BlogEngine.NET | Blogging

Byebye DasBlog, Hello BlogEngine.NET

by Graffen 2. March 2009 21:08

After having studied BlogEngine.NET for a few days, I decided to make the switch on my own blog. I googled around a bit to figure out how to migrate my existing blog content to the new platform. I quickly decided to go with the instructions I found on merrill.net.

The only major disadvantage is that trackback links are broken. I’ll try to find a way to fix them :-)

So here it is. Shiny and new, running on this great piece of blogging software. Now I just need to figure out how to get my twitter feed shown on here again.

 UPDATE: Simple - just select the Twitter widget in the administration menu and hey presto! it's there :) 

Tags:

BlogEngine.NET | Blogging

Major service outage

by Jesper Hess Nielsen 4. February 2009 18:40

Okay, so my blog has been down for a couple of days. I’m still to receive a real explanation from Surftown about the reason, but apparently it had something to do with something on my site that MIGHT have caused problems on their servers.

So my whole web hotel has been moved to another server, and I’m now awaiting further explanation as to what exactly caused them to panic and shut me down. They have promised me extensive documentation, so we’ll see.

I’ll keep you guys posted as to any interesting information I get from them.

Tags:

Blogging

Holiday time again and a very short update

by Jesper Hess Nielsen 29. June 2008 07:57
In a few hours I'll be flying to Vienna before heading on to Postojna (Slovenia), Venice, Trieste and ultimately, Amsterdam where I will be taking part in Sensation White. I haven't been blogging much at all lately. Things have been really hectic at work so I haven't really been able to find the time.

I've started working on a new version of my free SubVersion hosting system. The frontend will be done using the new ASP.NET MVC Framework and I hope to get the backend a bit more "enterprise-like" - probably by using message queueing and/or WCF to pass notices between the frontend and backend. We'll see. I haven't decided 100% yet.

Oh - and yesterday I decided to start using Twitter much more actively. I already have a couple of followers but feel free to add me. I've installed Twibble on my N95 8GB, so everywhere I have Internet access I should be able to update.


Tags:

.NET | Blogging | Day to Day | Programming | SubVersion | Vacation

Dropped Vista. Back to XP

by Jesper Hess Nielsen 4. January 2008 22:18

Okay... I installed Windows XP instead. Vista still has too many quirks on my laptop. Maybe after SP1 reaches final, I'll give it another go. Until then, I'm back on Windows XP after several months of being really happy with Ubuntu Linux (Gutsy Gibbon). The reason I'm back to XP is that I found myself really missing Visual Studio for development. MonoDevelop just isn't "there" yet as far as I see it.

Pretty happy to see that Windows Live Writer also exists for XP ;)

Tags:

Blogging

Test post from Windows Live Writer

by Jesper Hess Nielsen 4. January 2008 14:08

I just installed Windows Vista on my laptop and decided to give Windows Live Writer a try for posting blogs. So here's a test post to see how everything works.

Here's a link

And a picture: IMG_7829

So... If this works I might just use this little piece of software to post blogs instead of using the dasBlog web interface.

It even supports tags:

Tags:

Blogging

Happy New Year

by Jesper Hess Nielsen 2. January 2008 07:00

So, we survived. And now it's 2008. I thought I would just write a couple of lines about what's going on in my life. Mostly because it'll be fun reading it next year and seeing how much (if anything) has changed.

Well... I'm still working for Infopaq. I started here last May, as a software engineer. Back in September, I was given more of a project manager type of role, spending most of my time keeping a small team of developers busy as well as shielding them from the rest of the organisation ;-). Anyway, I'm really enjoying it even though it's hard work sometimes. Right now, I'm busy doing a little coding myself, working on a proof of concept for a large potential customer. Hopefully I'll be done in a few days. I'm also hoping that I'll be allowed to hire an extra developer soon.

So what else is going on? Hmm. Well I'm going on a small vacation in March, together with my brothers. We'll be visiting Botswana (where I grew up) for the first time since we left in 1994. The plan is to spend a couple of days in Gaborone and then head north on a week long safari. I'm really looking forward to it. Now I just need to try to save up some money to buy that video camera I've always wanted. I've been looking at a Canon HG10 which records HD-quality video on its built-in 40GB hard drive.

All in all, I'm pretty satisfied with where my life is going at the moment - all i need to do is get around to blogging some more :)

 

Tags:

Blogging | Day to Day

Upgraded DasBlog software

by Jesper Hess Nielsen 28. November 2007 09:08

I just spent some time upgrading my DasBlog installation to the latest version. I also chose to use a new default theme. It'll take a little getting used to, but I think I like it ;-)

The upgrade was pretty easy - but if I missed something or something doesn't work, please let me know!

Tags:

Blogging

Blogging in English

by Jesper Hess Nielsen 30. November 2006 07:35

Lots of people keep asking me why I write my blog in English. Well it's simple, really. Because most of my visitors are from outside Denmark, I thought I'd broaden the audience a little by writing in something other than Danish.

Tags:

Blogging

Copyright © 2009 Jesper Hess Nielsen. This work is licensed under the Creative Commons License.
Powered by BlogEngine.NET 1.5.0.7
Theme by Extensive SEO

About the author

A blog about me, R/C planes, .NET, Twitter and whatever else I feel like writing about.