Highlight Source Pro - A must have Plugin for Code Whores
If you’re like me and occasionally need to post code snippets in your wordpress powered blog posts, then you absolutely adore the highlight source pro plugin by Christian Knoflach. Gone are the days of hard to read and uncopyable code snippets. Highlight Source pro not only displays your code as a preformatted text via the <pre> tag, but it also uses the Geshi color coding system to give your readers properly highlighted code, with no additional effort from you! Just start a block using a <pre> tag in html view and give it the proper language attribute. As an example, for a block of php code, you would enter the following:
-
<pre lang="php">
-
echo("This is a sample of a block of php code.");
-
echo("any code will work here, from php to BASIC to bash.");
-
echo("it will even make sure that the block scrolls without breaking your page template on really long lines like this one.");
-
echo("though you may have to type all of the code with the WYSIWYG editor disabled.");
-
?>
It’s as simple as that (and yes, I’m using the plugin to show you how the plugin works!
The only drawback is that if you’re using the visual editor, you may have to go back and add your code at the end, then save the post from the code editor. This is only a minor annoyance, however, and I think that the pluses definitely outweigh the negatives.
If you’ve got code to share with your eaders, I think this little gem is more than worth the time and effort to use.
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader. If you don't have a feed reader, you can always have these articles delivered to your email inbox every day. Click here to sign up.


No comments yet.
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>