Top 3 Syntax Highlighter plugins for WordPress

TOP_3_Syntax_Highlighter_plugins_wordpress2016
Written by Charaf JRA

Your are a blogger passionate about web development, web design, script programming etc. and you share with your readers tutorials, tips, and tricks, then you will need a Syntax Highlighter and this article is for you.
Usually your articles will contain code snippets, and instead of making them looking like in notepad(Windows OS) or in  TextEdit(Mac os x), it’s better to use a code highlighter plugin that will color the code and make it look pretty and easily readable like in an IDE or a Code Editor.
I am one of those bloggers who use a Code highlighting plugins, I tried many WordPress plugins for this purpose, here I will share with you the best ones for me:

Enlighter – Customizable Syntax Highlighter

Enlighter - Customizable Syntax Highlighter
This is the default Syntax Highlighter for this blog, I liked it so much, easy to install, easy to use and makes the code clean in visual mode of TinyMCE WYSIWYG editor of WordPress, no conversion of HTML markups to special characters like its competitors do and preserves very well indentation of code:

Enlighter_TinyMCE_Visual_mode_code_highlighter

Result:

/*
 * @param (string) SQL Query
 * @return multidim array containing data array(array('column1'=>value2,'column2'=>value2...))
 *
 */
function getData($sql){
    global $connection ;//we use connection already opened
    $query = mysqli_query($connection, $sql) OR DIE ("Can't get Data from DB , check your SQL Query " );
    $data = array();
    foreach ($query as $row ) {
        $data[] = $row ;
    }
    return $data;
}

I made the example above by clicking on {…} special icon from TinyMCE, once you click there, a popup window like the following opens, you choose the language, in my case it’s PHP, you choose the mode (Inline display or Block display) and you enter your source code:

Enlighter_add_new_code

It has many themes to choose from (I use Droid theme in this article), it’s configuration is easy, and contains a Theme-Customizer to modify the built-in themes without any CSS knowledge.It also supports the automatic creation of tab-panes to display code-groups together (useful for multi-language examples – e.g. html+css+js) you can check Theme DemoLanguage Examples.
This plugin has also few disadvantages:

  • Usage of Mootools javascript library instead of jQuery, it’s size is about 94kb which can make your page loading a little bit slower.
  • Requires at least PHP 5.3 to work.

Crayon Syntax Highlighter:

Crayon syntax highlighter wordpress plugin
The second best syntax Highlighter for me is Crayon Syntax Highlighter, I chose Enlighter because it’s UI looks modern than Crayon from front office and back office, but in term of basic functionalities and performances, both of them are good.

crayon_wp_plugin_example

Example of Crayon Syntax Highlighter

It’s a Syntax Highlighter built in PHP and jQuery that supports customizable languages and themes. It can highlight from a given URL, or from a post text. It is very user-friendly and all the options can be configured easily from the plugin settings page.
You can choose a specific theme for each code snippet in your page, and it supports also mixed languages in same code snippet (HTML, CSS, and javascript for example)

Syntax Highlighter Evolved:

SyntaxHighlighter_Evolved

From its official description, SyntaxHighlighter Evolved allows you to easily post syntax-highlighted code to your site without losing it’s formatting or making any manual changes.
What I liked in this plugin, is the simple way it integrates the code without any popup window, you choose a language and you make your code in between.

For Example,  echo "Hello world";
I got few problems with this plugin especially with indentation of the code and conversion of HTML to special characters which make the modification of my code snippets very difficult.

All these Syntax Highlighters for WordPress support a large list of programming languages:AVR, Assembly, Generic Assembly, C, CSS, C#, C++, Cython, Diff, Generic HTML, Ini, JSON, Java, Javascript, LUA, MarkDown, Matlab, NSIS, PHP, Python ,RAW, Ruby, Rust, SQL, Squirrel, Shell, VHDL, XML and more.

You know a better Syntax Highlighting plugin for WordPress or have something to add to the existing ones, share your opinion with us in the comment section bellow.

 

About the author

Charaf JRA

I'm a Code enthusiast , Blogger, Geek and Software Engineer. I created this blog to share my inspirations and my new experiences.If you like to contact me , use the contact form above or follow me on twitter

%d bloggers like this: