A small WordPress stuff – Syntax highlighting using Shortcode

Whenever I tried to post something which contains some Java/Javascript/XML code snippet, I always find it difficult to add the source code with syntax highlighted. I used to put them in <pre> and set the color using <span> . And that was horrible.

But we have a better option of using shortcodes. Just put some special tags on either side of your code block, specify the language and we are done! This is pretty cool! Wow!

Your code goes here

Read more about it:
http://codex.wordpress.org/Shortcode_API
http://faq.wordpress.com/2008/06/18/what-are-the-wordpress-shortcodes/
http://support.wordpress.com/code/

Advertisements