Syntax Highlighting is a method for coloring certain words and characters in a text depending on their importance in in an piece of code or snippet. If you are new to WordPress for blogging purpose, you might have seen in some websites, colored texts for PHP, CSS, HTML etc. languages and markups are used. So how these colored things appears and why we basically need them ? To explain this, here is the article on Syntax Highlighting.
Basics of Syntax Highlighting
Syntax highlighting is mainly used in text editors, like we previously we wrote about gedit for editing excellent documents, program and configuration files. Syntax Highlighting is based on language elements.
Syntax highlighting improves the readability and clears the structures in the text separating comments from the actual code and it also indicates typographical mistakes more quickly, because in many cases only typo creates the problem.
---
Wilfred Hansen, in 1969 first used practical Syntax Highlighter in the code editor Emily.
Resources and Information on Syntax Highlighting
Syntax Highlighting in Text Editors
Microsoft Windows, a great malware proof Operating System, has no Syntax Highlighting software shipped by default. However, most free UNIX like Operating System has basic text editors with Syntax Highlighting feature. Even, stripped down server OS versions of Linux has Syntax Highlighting feature, in our recent guide on Installing OpenPanel on Rackspace Cloud Server, we have used nano, a Text Editor which works in Command Line Interface (CLI) :

Gedit is one of the most powerful Syntax Highlighting text Editor.
Syntax Highlighting in web browser
In most modern web browsers, like Opera, Mozilla Firefox, Google Chrome, Safari etc. has very good Syntax Highlighting feature while using the development related tools.
Please do not think that the fastest web browser named Internet Explorer has no Syntax Highlighting feature from the corollary that Microsoft Windows by default has no Syntax Highlighting tool. It has a decade old Syntax Highlighting tool. That is better than having nothing like Notepad.
Syntax Highlighting in Web CMS like WordPress, Joomla!
GeSHi is a PHP based Generic Syntax Highlighter, which has been used in various Plugins. WP-Syntax is an age old WordPress Plugin that uses GeSHi.
Example of Syntax Highlighting
If I write this :
/**
* Example of Syntax Highlighting
*/
if ( !defined(‘WP_LOAD_IMPORTERS’) && !defined(‘DOING_CRON’) )
return;
require_once ABSPATH . ‘wp-admin/includes/import.php’;
require_once ABSPATH . ‘wp-admin/includes/admin.php’;
It is not possible to understand which is code part and which is not. But if I use WordPress default pre
tag, it somewhat looks better :
1 2 3 4 5 6 7 8 9 | <?php /** * Example of Syntax Highlighting */ if ( !defined('WP_LOAD_IMPORTERS') && !defined('DOING_CRON') ) return; require_once ABSPATH . 'wp-admin/includes/import.php'; require_once ABSPATH . 'wp-admin/includes/admin.php'; |
There are advanced Syntax Highlighting plugin and scripts which helps to see the code as plain text, copy in one click or print.