Version: 3.5
Author: Amit Gupta (Contact Me)
Plugin URI: http://blog.igeek.info/wp-plugins/igsyntax-hiliter/
Bug Reports & Support: http://wordpress.org/support/topic/10533
License: GNU GPL
1. INTRODUCTION
-----------------------------------------------------------------------------------------
This is a WordPress plugin(for versions 1.5 and above) for syntax hiliting of your code. This is an update to v3.1.1. It hilites
ActionScript, ASP, C, C++, C#, CSS, Delphi, HTML, Java, JavaScript, MySQL, Perl, PHP, Python, Ruby, Smarty, SQL, Visual Basic, VB.NET, XML languages by default but supports all languages supported by GeSHi. This release has a new improved GeSHi Core(v1.0.7.6).
As from the v3.0, you don't have to open up the plugin file & mess with the settings if you want to configure the plugin. The iG:Syntax Hiliter is ready to go as soon as you activate the plugin. If you want to change the settings etc., then you will now have a new admin panel under the OPTIONS menu of your WP administration, so you can now configure iG:Syntax Hiliter in a GUI.
A new & much vaunted feature that has been added to this release is the ability to hilite the code in the comments. The readers of your blog can leave code in the comments using the same code tags and it will be hilited the same way you hilite the code in your posts. You can Enable/Disable this feature from the admin GUI of iG:Syntax Hiliter. For more on features, see the Changelog.
iG:Syntax Hiliter has not been tested for versions below WP1.5 & is in no way backwards compatible. If you are using an older version of WordPress(older than v1.5), then you are better off using the older version of iG:Syntax Hiliter. This version is not for you.
You are required to be a Level 8(or have an 'Administrator' role assigned in WordPress 2 and above) or above USER to Install & Configure iG:Syntax Hiliter.
2. WHAT's NEW
-----------------------------------------------------------------------------------------
v3.5
~~~~~~~~~~~~
v3.1
~~~~~~~~~~~~
v3.0
~~~~~~~~~~~~
v2.01
~~~~~~~~~~~~
v2.0 Final
~~~~~~~~~~~~
v2.0 Preview
~~~~~~~~~~~~
v1.1
~~~~~~~~~~~~
v1.0
~~~~~~~~~~~~
3. INSTALLATION
-----------------------------------------------------------------------------------------
Installation is fairly easy. Just follow the steps:-
4. UPGRADING
-----------------------------------------------------------------------------------------
Upgrading from an old version? No problem, its as easy as popping a candy in your mouth.
UPGRADING from v3.x
~~~~~~~~~~~~~~~~~~~~
Just deactivate your plugin, delete the
syntax_hilite.php file & ig_syntax hiliter plugin directory and follow the INSTALLATION process again. That's quite easy!!
UPGRADING from v2.1 or lower
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DEACTIVATE the iG:Syntax Hiliter plugin from the plugin management page & then REMOVE THE FOLLOWING FILES & DIRECTORY:-
5. CONFIGURATION
-----------------------------------------------------------------------------------------
Configuring iG:Syntax Hiliter is a piece of cake. No more the painful way of opening the plugin file in a text-editor & changing the variable values. Just log on to your WP Admin section & make way to the Options page. There you'll see the tab called iG:Syntax Hiliter in the sub-menu.
CAUTION:- You need to be a Level 8(or above) user(or have the "Administrator" role assigned to you if you are using WordPress 2 or above) to access the iG:Syntax Hiliter configuration page.
When you click the iG:Syntax Hiliter configuration page, you are offered 9 configuration settings which you can set to your liking, but lets go through each of them.
6. QUICKTAGS
-----------------------------------------------------------------------------------------
This is optional & not required to use the plugin, but to make your life easier,
you can use the iG:Syntax Hiliter Quicktags.
edButtons[edButtons.length] =
new edButton('ed_shAS'
,'ActionScript'
,'[as]'
,'[/as]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shASP'
,'ASP'
,'[asp]'
,'[/asp]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shC'
,'C'
,'[c]'
,'[/c]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shCPP'
,'C++'
,'[cpp]'
,'[/cpp]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shCSHARP'
,'C#'
,'[csharp]'
,'[/csharp]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shCSS'
,'CSS'
,'[css]'
,'[/css]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shDELPHI'
,'DELPHI'
,'[delphi]'
,'[/delphi]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shHTML'
,'HTML'
,'[html]'
,'[/html]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shJAVA'
,'JAVA'
,'[java]'
,'[/java]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shJS'
,'JavaScript'
,'[js]'
,'[/js]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shMySQL'
,'MySQL'
,'[mysql]'
,'[/mysql]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shPERL'
,'PERL'
,'[perl]'
,'[/perl]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shPHP'
,'PHP'
,'[php]'
,'[/php]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shPYTHON'
,'PYTHON'
,'[python]'
,'[/python]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shRuby'
,'RUBY'
,'[ruby]'
,'[/ruby]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shSMARTY'
,'SMARTY'
,'[smarty]'
,'[/smarty]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shSQL'
,'SQL'
,'[sql]'
,'[/sql]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shVB'
,'Visual Basic'
,'[vb]'
,'[/vb]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shVBNET'
,'VB.NET'
,'[vbnet]'
,'[/vbnet]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shXML'
,'XML'
,'[xml]'
,'[/xml]'
,''
);
edButtons[edButtons.length] =
new edButton('ed_shCode'
,'CODE'
,'[code]'
,'[/code]'
,''
);
7. USAGE
-----------------------------------------------------------------------------------------
Using this syntax highlighter is fairly easy. There are basically 19 sets of tags(by default).
[as] & [/as]
[asp] & [/asp]
[c] & [/c]
[cpp] & [/cpp]
[csharp] & [/csharp]
[css] & [/css]
[delphi] & [/delphi]
[html] & [/html]
[java] & [/java]
[js] & [/js]
[mysql] & [/mysql]
[perl] & [/perl]
[php] & [/php]
[python] & [/python]
[ruby] & [/ruby]
[smarty] & [/smarty]
[sql] & [/sql]
[vb] & [/vb]
[vbnet] & [/vbnet]
[xml] & [/xml]
[code] & [/code]
The [as] & [/as] tags are for hiliting ActionScript Code. You have to place your
ActionScript code in between them.
The [asp] & [/asp] tags are for hiliting ASP Code.
The [c] & [/c] tags are for hiliting C Code.
The [cpp] & [/cpp] tags are for hiliting C++ Code.
The [csharp] & [/csharp] tags are for hiliting C# Code.
The [css] & [/css] tags are for hiliting CSS Code.
The [delphi] & [/delphi] tags are for hiliting Delphi Code.
The [html] & [/html] tags are for hiliting HTML Code.
The [java] & [/java] tags are for hiliting JAVA Code.
The [js] & [/js] tags are for hiliting JavaScript Code.
The [mysql] & [/mysql] tags are for hiliting MySQL specific SQL.
The [perl] & [/perl] tags are for hiliting Perl Code.
The [php] & [/php] tags are for hiliting PHP Code.
The [python] & [/python] tags are for hiliting Python Code.
The [ruby] & [/ruby] tags are for hiliting Ruby Code.
The [smarty] & [/smarty] tags are for hiliting Smarty Code.
The [sql] & [/sql] tags are for hiliting SQL Code.
The [vb] & [/vb] tags are for hiliting Visual Basic Code. TIP:- You can use the [vb] & [/vb] tags for hiliting VBScript Code too.
The [vbnet] & [/vbnet] tags are for hiliting VB.NET Code.
The [xml] & [/xml] tags are for hiliting XML Code.
The [code] & [/code] tags are for hiliting generic Code that isn't one of the
already mentioned ones.
Suppose following is your PHP Code:
Similarly, you can use other tags.
You can specify the number from which the Line Numbering of your code should start.
This is specifically helpful when you are pointing out a code snippet from a larger module. So how do you specify the number to start the numbering from?? Its easy, you just set the value of the num attribute in a code tag.
So, if my PHP code is
and I'll get the Line Numbers from 23 instead of 1. You can use this attribute in all the tags. But remember, do not enclose the number in quotes.
NEW FEATURE:-
COMMENT CODE HILITING: The code in comments can now be hilited the same way it is in posts. You can turn this option on or off as per your wishes, see Configuration for more details.
PLAIN TEXT OPTIONS: The Plain Text code can now be displayed in two ways, either in the codebox itself or in a new window. This is configurable in the admin interface of the plugin, see Configuration for more details.
COLOUR PICKER: You don't have to remember the hexadecimal colour codes to set the line colours. A colour picker is now available that lets you choose a colour of your choice and lets you set its colour depth etc.
8. IMPORTANT
-----------------------------------------------------------------------------------------
Do not forget to close the tags, as your code will not be hilited if you don't
close your tags. Also, DON'T NEST TAGS. Nesting of tags don't work, so don't try
it. It'll ruin your output.
Also, this plugin has problems when you are using it with text-formatting plugins like Textile 1 & 2 or Markdown etc. So be careful when you use them along with this plugin.
Also a WYSIWYG editor(like the one bundled with WP2.x) will probably mess up your code when you paste it in the editor. So if you are having that issue, then please don't report it as a bug or anything, its not a bug on the part of this plugin.
NOTE:- For fast results & less load on your server, you can try out the WP-Cache plugin by Ricardo Galli which caches the WP output to a file, so that WP doesn't hit the database on every page load, thus increasing your website's performance.
KNOWN ISSUES:-
Due to the way WordPress handles the excerpts, if you don't specify an excerpt for your posts, then any code in the excerpts generated by WordPress will not be hilited but it'll have the language name(if you have it enabled in the configuration) and it'll have the Plain Text link(if you have it enabled in the configuration) which won't work. So it does look like a bit screwed up. There are only 2 ways out of this at present, either you don't use excerpts on any page, like archives, search, category pages etc. or you specify the excerpt of posts which have any code in them.
That's all of the important stuff. Enjoy!!