Code highlighters are very useful tools to present code snippets on your blog or website with a professional look and improve the readability of code you provide for your readers. In this post I want to introduce you the best highlighter which I found.
The past two days I search in Google about code highlighters and I saw so much that I’ve got a headache.
I saw posts about:
• SyntaxHighlighter
• Quick Highlighter
• FV Code Highlighter
• Source Code Highlighter
• Highlight.js
• Etc.
There are so much highlighters but no one can’t highlight the source code in way what I want.
A good part of my posts contain source code snippets to illustrate and/or compliment the content. I’m a .NET developer and I write code in Visual Studio. In my posts when I show source code I want it to be formatted as in Visual Studio, with same colors and styles.
After two days research I found one. I think it’s the best one.
Windows Live WriterYou can download it from
here.
The Writer Windows Live Gallery has a growing list of plugins. One of the useful is
Code Snippet plugin for Windows Live Writer.
But the most important to me is:
Paste from Visual StudioIt easily transfer syntax highlighted source code from Visual Studio to elegant HTML in Windows Live Writer.
You can find the plugin
here.
If you have some troubles with installation on vspaste.msi file look this articles
here and here.
I used Windows 7 beta and when I tried to install .msi file I had the error. But with “less msiérables” I could get the plug-in dll and then move it to “...\Program Files\Windows Live\Writer\Plugins”.
How does Paste from Visual Studio work ? Just copy the code from Visual Studio and insert it directly to Windows Live Writer.
The plug-in generates html and in browsers it is look exactly like code in Visual Studio.
public interface IChangeBoxedPoint
{
void ChangeProperties(int x, int y);
}
struct MyPoint : IChangeBoxedPoint
{
public int X { get; set; }
public int Y { get; set; }
public void ChangeProperties(int x, int y)
{
this.X = x;
this.Y = y;
}
public override string ToString()
{
string message = string.Format("X - {0}, Y - {1}", X, Y);
return message;
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="TestCaching._Default" %>
<%@ OutputCache Duration="10" VaryByParam="none" Location="Client" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form" runat="server">
<div>
<%=DateTime.Now %>
</div>
</form>
</body>
</html>
The last that you can do is to delete author’s website link– It never shows up on the page, but it is on the bottom in the generated html.
This was a little disappointed to me, but the plug –in does it great job and the only one disadvantage is the hidden author’s link – which you can delete :)