Syntax Coloring in WordPress

I have been looking to install a syntax coloring plug-in into my WordPress blog. Browsing through the official plug-in repository, I have found SyntaxHighlighter Plus, SyntaxHighliter and WP-Syntax.

All three plug-ins seems to be easy to use, for installation being required to copy the plug-in folder to wp-content/plugins folder and to activate them via the admin interface.

But I had to have only one choice, so this is … WP-Syntax. It is based on a distinct project GeSHi, Generic Syntax Highlighter, freely available under GPL license and supports syntax highlighting for a wide variety of popular languages. GeSHi is included in numerous blogs, wikis and content management systems like Dokuwiki, phpbb, Mambo or WikkaWiki.

And now, let’s see and example, Hello World written in C programming language.

1
2
3
4
5
6
7
#include <stdio.h>
#include <stdlib.h>
 
int main(void) {
    printf("Hello world!\n");
    return EXIT_SUCCESS;
}

This is achieved by including the source code under <pre lang=”C” line=”1″> and </pre> mark-up tags.

One Response to “Syntax Coloring in WordPress

Leave a Reply

Twitter Comments message