Friday, December 5, 2008

How to insert colorized code to any blog including Blogger, code to html converter

I recently started blogging about my experience with bloated, messy and mainly standards based programming language - Java. So I needed a way to paste my Java, XML and other programming language codes in more readable and colored way. So after a little research I found an online HTML generator. You can paste your code and it will generate colored version of your code in HTML. Than you can switch to HTML version in your editor paste the code and wua la:

package messy.java;
public class SomeClass {
private static final Integer myVar;
static {
try {
// Some comment
myVar = new Integer();
} catch (Throwable ex) {
System.err.println("Error:" + ex);
throw new ExceptionInInitializerError(ex);
}
}
}

If you are using Windows Live Writer to post your entries, than you are lucky, there is a plugin for you and for those who does not there is a stand alone version as well.

Happy blogging :)

No comments: