First things first

Since I’m planning on using a fair bit of code snippets in my posts, I needed to know how to do syntax highlighting in a blog hosted on WordPress.com (i.e. when installing plugins is not an option).

Fairly easy to do, switch to the HTML editor (top right, next to “Visual”), and paste your code between [code] tags, and specify the programming language of the code snippet.

If it was Java code, for example, this is what it would look like in the HTML editor.

[code language=’java’]
…your Java code goes here…
[/code]

This is what actual Java code would look like formatted using the method above.

public static void main(String[] args){
   System.out.println("Hello, World!");
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s