Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Use Syntax Highlighter With Open Live Writer

DZone's Guide to

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 (like plugins—which are planned to come later) and adding others. If you're like me, you may have used the PreCode syntax highlighter plugin... luckily, you don't have to stop. Let me show you how it's done.

· Web Dev Zone
Free Resource

Prove impact and reduce risk when rolling out new features. Optimizely Full Stack helps you experiment in any application.

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.

precode-syntax-highlighter

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

preCode-code-manager-syntaxhighlighter

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

precode-code-manager-syntaxhighlighter-with-code

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.

source-code-plugin

Then paste the code like below.

sourc-code-source

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!

With SDKs for all major client and server side platforms, you can experiment on any platform with Optimizely Full Stack.

Topics:
syntax ,highlight

Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}