Tuesday, January 13, 2009

Posting source code in blog

One of the main reasons I started my blog was for documentation. With documentation comes posting source code, but I had a hard time finding an easy way I could post code with spacing and syntax highlighting. I found syntaxhighlighter written in JavaScript that I could add to the existing blogger template.

public class HelloWorld()
public static void main(String [] args) {
System.out.println("hello world!");
}
}

I added all of the SyntaxHighlighter.css to the head section of the blogger template. Then under that I add links to the JavaScript files I needed.





The last step is to add the following at the end of the template before the end of the body tag.



All the following around the code to post.


1 comment: