Syntax Highlight Code On Any Page Using Google Code Prettify

| Posted by watashii | Filed under Programming, Web

prettify00

The Google Code Prettify is a JavaScript module that allows syntax highlighting of any code snippets on a HTML page.  Setting this up on any web page is a simple 3 step process, and is supported on most common browsers.

[Demo]   (Based on:  prettify-21-May-2009.zip)
[Download Source Files]

Read the rest of this entry »

Tags: , , , ,

Wordpress Syntax Highlighter

| Posted by watashii | Filed under WordPress

While trying to find a way to syntax highlighting / autoformat programming code on WordPress, I came across this.  After a while, I realised it only works for WordPress hosted page.  To enable syntax highlighting on a self hosted WordPress blog,  you need to install the Google Syntax Highlighter plugin.

Here are the installation steps:

1) Download the plugin zip file.
2) Extract plugin into /wp-content/plugins directory.
3) Activate the plugin.
4) When posting, use the HTML editor and insert the following code:
<pre name="code" class="sql">
select * from tab;
</pre>

5) Hopefully looks like:

select * from tab;

The google documentation for using the syntax highligher is available here.

Tags: , , , , ,