How To Colorize Source Code Snippet In WordPress Post

There are lots of WordPress plugins for colorizing source code syntax, and many of them are pretty good.

Two most impressive I found are Crayon Syntax Highlighter and SyntaxHighlighter.

Both are great, and it’s hard to decide which is better. Both probably have more options than common user needs. Finally, I decided to use Crayon because it has slightly better ranking in WordPress plugins directory. Here is one small sample:

Websites hosted on WordPress.com have pre-installed syntax plugin. To place source code in article on blog hosted on WordPress.com, just use [sourcecode] or just [code] tag in text view. For previous code example if your blog is on WordPress.com you, should write something like this:

[code language=”javascript”]
// Hello World in JavaScript
alert(‘Hello World!’);
[/code]

More info about this feature you can find on http://en.support.wordpress.com/code/posting-source-code/

Share on FacebookShare on LinkedInEmail this to someoneTweet about this on TwitterShare on Google+