How to Use Syntax Highlighter With Open Live Writer


Microsoft has open sourced Windows Live Writer as "Open Live Writer" and it is now part of the .NET Foundation. It was a great move, but as a part of modernizing the Windows Live Writer they have started removing some functionalities and adding other new ones. Eventually, they are going to add plugins but right now there is no support for that. I have been using Windows Live Writer for more than 5 years now and was using syntax highlighter for highlighting code on this blog. If you are not familiar with syntax highlighter, you can find more information about it in the following link.

http://alexgorbatchev.com/SyntaxHighlighter/

It is a fully functional, self-contained code syntax highlighter developed in JavaScript. Since Open Writer does not support plugins for the time being, I have to find another solution to write blog posts and do some syntax highlighting. So, I have found a way to do this and would like to share it with you. In this blog post, we are going to learn how we can use syntax highlighter another way.

I was using the PreCode syntax highlighter plugin. It’s an open source plugin and provides a great syntax highlighter.

http://precode.codeplex.com/

But as Open Live Writer does not support plugins, there is no way to directly integrate that plugin. Fortunately, precode syntax highlighter plugin comes with a desktop application, so you can run it by finding it on windows 10 like below.

Once you run the preCode Code manager desktop app, It will run the application like following.

Here, you can write your code and choose your settings on the right side like below.

Then, just click on "Copy to Clipboard and Close". It will copy the syntax highlighter code in the memory.  Now, click on source tab at the bottom of the open live writer window like below.

Then paste the code like below.

And now, publish your post and it will look like below.

function helloWorld{     
  alert("hello world"); 
}

That's it. It is very easy to use PreCode code manager with Open Live Writer. Hope this was helpful. Stay tuned for more!