2 Easy Steps to Add Source Code into Your Blog
WordPress is a great blogging software. I am very happy with it except that it does not have nice built-in support to include source code, which an absolutely needed feature for me.
Given the rich set of plug-ins WordPress has, I know there must be some plug-in there already. Today I spent a little time on research. After trying several plug-ins, I decided to use Google Syntax Highlighter for WordPress. You can check out how it looks like as follows.
Time to learn how to "Google" and manage your VMware and clouds in a fast and secureHTML5 App
Thinking many other folks may be interested in having this in their blogs, I decide to share it. It’s also a reminder for me later on for adding source code.
The installation is pretty simple. First, click on the Plugins and then Add New. On the page, type in Google Syntax Highlighter for WordPress. You will get it as the first item in the result list. Just click on the install link at the end of the item. It’s pretty straight forward and I don’t need to repeat it here.
After you install it, you can see a little link “usage directions.” You can find much information and discussion there. Here is what I used for my post:
1. Add the following part with source code into the post editor HTML mode.
... Your Source COde ...
2. Add the following part at the end of the HTML source.
It should be working after you save the page.
The trick part is the name attribute in part 1. Somehow after I saved it, I could not find it later. It might be caused by the switching of visual mode and HTML mode. In the end, I switched to HMTL mode and made sure the name attribute there for sure before I saved it. The highlighting doesn’t work if the name attribute is missing. So pay a little attention there.