Wordpress Code Highlight
While I was writing the last post, I was trying to find a nice code highlighter with this requirements:
- Keep Indentation: I want to code to look nice, but if it’s not indented correctly as I submit it, then it’s garbage
- Support Different Languages: I’m going to be writing post about Javascript, PHP, XHTML and I need all these languages/markups to be highlighted
- Line number/Plain code view: You should be able to switch between plain code view and line number. I couldn’t find specifically what I was looking for but this one had a different approach to solve this problem.
- W3C Compliant: The code produced has to be W3C Compliant.
After like 1 hour of research and testing, I found SyntaxHighlighter Evolved! here is the plugin’s website: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/.
To install it you can go to your Wordpress Admin panel and look for SyntaxHighlighter Evolved and install it.
To use it:[language]…code…[/language]
Example:
[javascript]
$(function() {
var zIndexNumber = 1000;
$('div').each(function() {
$(this).css('zIndex', zIndexNumber);
zIndexNumber -= 10;
});
});
[/javascript]
It’s pretty straight forward, for better details on how to use it, I went to my Wordpress Admin Back-end > Plugins > Installed, then I looked for SyntaxHighlighter Evolved and clicked on Settings, at the bottom of this page you’ll see the details of what parameters you can pass to change the functionality.
Do you know another code highlighter that works better than this one?
