Marco Luthe Online! » WordPress Stuff » Syntax Highlighting For Code Snippets On Your Blog
Syntax Highlighting For Code Snippets On Your Blog
Recently, I thought it would be nice to have a syntax highlighting feature if you present code snippets – you might know this behaviour from your code editor. I found two WordPress plugins, but unfortunately, I did not quite manage to make them work in the right way:
- “Highlight.js”: softwaremaniacs.org/soft/highlight/en/
This solution is based on JavaScript in combination with CSS. There is also a WordPress plugin available, but I somehow didn’t succeed to integrate it into my own stylesheet – it just wouldn’t look right. - “WP-Syntax”: wordpress.org/extend/plugins/wp-syntax/
This WordPress plugin uses GeSHi, the “Generic Syntax Highlighter” which is based on PHP. It works OK when you have the WordPress visual editor deactivated – otherwise, it will replace “<”, “>” and “&” with the HTML-entities which does not look nice in a code snippet.
I must admit: I didn’t try TOO hard, because the amount of code snippets in my blog keeps within reasonable limits.
Filed under: WordPress Stuff · Tags: code, highlighting, plugin, snippet, syntax, wordpress











