How to highlight code syntax in WordPress

WP-Syntax is the answer.

For example, this is how I highlight an iPhone’s Objective-C code in this post.

- (void)viewDidLoad   
{    
    [super viewDidLoad];    
    NSString *title = [NSString stringWithFormat:@"My %@ syntax", @"AWESOME"];    
    self.title = title;    
}

 
To use WP-Syntax, simply surround the code with <pre lang=”LANGUAGE”> and </pre>, where LANGUAGE is the programming language.

To find out what to use for LANGUAGE, look under supported languages here.

If you like this, share it:
  • Twitter
  • Facebook
  • MySpace
  • Digg
  • del.icio.us
  • Technorati
  • Google Bookmarks
  • RSS
  • email
blog comments powered by Disqus