Friday, November 19, 2010

Blogging Tips: Embed code segments in a blog post with SyntaxHighlighter

Have you ever wondered about how to include code segments in your blog post in a clear and neat manner like below? I did.
So I searched about how to achieve it and found that using SyntaxHighlighter is the secret.
public class HelloWorld {
    /**
     * @param args
     */
    public static void main(String[] args) {
        
        System.out.println("Hello World");
    }
}
(Note: Please wait the page is fully loaded to view the above code with syntaxhighlighter)

It takes just a few minutes of configuration to add that feature to your blog as well. I was able to do it using following two references which describes step by step how to add syntaxhighlighter to your blog. Without reposting the same steps, I will share these references with you.
1. http://pleasemakeanote.blogspot.com/2008/06/posting-source-code-in-blogger.html
2. http://timbroder.com/2007/07/howto-post-code.html

Enjoy blogging..!