Syntax Highlighting
Here at Automattic we’re allllll about sharing source code. #
WordPress.com recently rolled out some very cool tools for posting source code, yet, ironically, considering the first sentence of that post, quoted above, the code hasn’t [yet] been released for WordPress users not on the shared hosting service.
Viper007Bond to the rescue. Once I saw what WordPress.com users were able to use, I grew envious and began to hunt for my own solution. Then Viper posted news of his own implementation to the mailing list, and after a bit of searching on the plugins site I found his SyntaxHighlighter plugin. Allow me to demonstrate:
<?php // Demonstrating syntax highlighting. print "This is some PHP code."; ?>
It automatically only loads the JavaScript files you need, and deals with encoding < characters, so it makes it extremely easy to post source code. Very well done, Viper.
Oh, and for those who don’t use WordPress, the code uses a JavaScript library by Alex Gorbatchev, SyntaxHighlighter.
No Comments, Comment or Ping
Reply to “Syntax Highlighting”