Share the Knowledge
RSS icon Home icon
  • My Favorite WordPress Code Highlighter Plugin

    Posted on July 8th, 2010 webmaster No comments         Print Print

    If you’re wondering what I used for the code highlighter in my previous post, it’s the SyntaxHighlighter Evolved plugin.  It’s just like the Google Syntax Highlighter plugin but much easier to use.  I’ve tried a bunch of other ones such as the WP Advanced Code Editor, Developer Formatter, and WP-Codebox and this one is the best in my opinion.

    To use it you just put your code between these tags: “[language] …code goes here… [/language]” where “language” is the programming language (i.e. python, java, sql, etc.).

    Here are some examples of what the code would look like:

    Python

    import shutil
    
    class Copy:
        '''
        Copy files.
        '''
    
        def __init__(self):
            '''
            Nothing to see here.
            '''
    
        def copyFile(self, src, dst):
            shutil.copy2(src, dst)
            print "I don't know why I'm printing this."
    

    SQL

    SELECT * FROM cool_websites
    WHERE domain = 'calazan.com'
    AND ranking IS NOT NULL
    

    Java

    public class HelloVisitors {
    
    	public static void main(String[] args) {
    		// Just saying hello
    		System.out.println("Hello visitors!");
    	}
    }
    

    Leave a reply