65.9K
CodeProject is changing. Read more.
Home

Syntax Highlighter

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Apr 29, 2015

CPOL
viewsIcon

7634

Syntax highlighter

The Issue

When I wanted to start this blog, I had in mind that this blog will be a technical one, to share what challenges I face and overcome. So obviously I needed a tool/plugin/script whatever to highlight the code I post. So I’ve started a search to find what the best tools are out there and I found the following;

Each one of them has its pros and cons, but what really mattered to me is the support for all of the keywords, for multiple languages, as for example the wordpress plugin did not support the generics, so it ended lower casing any text between the <>.

Another thing I wanted something dynamic as for coloring, font, etc. as if I wanted to transform my code format from Visual Studio to the HTML page.

The One

After testing more than five syntax highlighter plugins, I found a Visual Studio extension that enables you to copy code as HTML as if it is displayed in the Visual Studio.

Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
 
            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }
}

Happy copy and pasting code. ??

The post Syntax Highlighter appeared first on Ghaleb's Blog.