WordPress free site: how to format/syntax highlighting your code without any plugin installed

08Mar

WordPress has many plugins to format or highlight your code for almost every modern programming languages such as C, C++, C#, Java, Php, Pyton, Perl, Matlab, Javascript, to list a few.

However, for free WordPress sites which do not have access or control to install plugins, it is very hard to post your code with color syntax highlighted. I have been suffering from this, and resort to capture my code in images, which look nice, but often complained by the readers. For instance, one of my answer at StackOverflow, some coder complained: why image, not code?

Given the code, you copy the source to the aforementioned site as input, and HTML colored, syntax highlighted code will be generated. And you can then copy the HTML to your blog writer, e.g. Windows Live Writer.

Go to the source tab of Live Writer, Copy the HTML code in the right side text block as shown below, paste it to the Source window of Live writer, modify the margin, line spaces etc to customize the code view:

One response to “WordPress free site: how to format/syntax highlighting your code without any plugin installed”

Thank for your suggestion, have you tried this: http://en.support.wordpress.com/code/posting-source-code/. Strangely, it does not seem to work for c# currently – that is how i landed on your page which could be an answer, but i have to admit rather get the builtin tag to work again… 🙂