- Head to http://code.google.com/p/google-code-prettify/, click on README link.
- Open blog template and click "Edit HTML". This will open HTML editor.
- Find a closing tag "</head>". Insert the following lines immediately in front of it.
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> <link href='http://google-code-prettify.googlecode.com/svn/trunk/styles/sunburst.css' rel='stylesheet' type='text/css'/>
The first line enables Google's code highlighter Prettify. The second line is an example of how to enable a custom skin.
For Prettify to work, the code in a blog post must be delimited with "<pre class="prettyprint">...</pre>" tags. To do this - compose code samples in "HTML" mode after editing a blog post.
Examples of code highlight:
void arrays2() { int c[3][7]; int **p = c; int v = *(*(p + 3)); double points[3][4] = { {1.0, 2.0, 3.0, 4.0}, {5.0, 6.0, 7.0, 8.0}, {9.0, 10.0, 11.0, 12.0} }; double points2[][] = { {1.0, 2.0, 3.0, 4.0}, {5.0, 6.0, 7.0, 8.0}, {9.0, 10.0, 11.0, 12.0} }; printf("points2[1][1] = %f"); }
- (id) init { return [self initWithSomething:@"something"]; } - (id) initWithSomething: (NSString *) aSomething { if(self = [super init]) { _something = [aSomething copy]; } return self; }