I was looking forever for the solution. I finally found this plugin which actually does a lot of things. But i only used the option to add a HTML button to the row of buttons which lets you edit post/page html with CodeMirror highlighting.



I am using SyntaxHighlighter Evolved by Viper007Bond, works great! http://wordpress.org/extend/plugins/syntaxhighlighter/

After I gave this answer yesterday, I read a recent post by Konstantin Kovshenin over at theme.fm, which gives you all the different possibilities on how to add syntax into your Posts/Pages: http://theme.fm/2011/07/working-with-code-in-wordpress-posts-985/


I found a shortcode by @Bainternet in Ohad Raz weblog that can help you to build your sintax highlight own plugin, or just type it into your functions.php file theme.

function bainternet_highlight($atts, $content = null) {
extract(shortcode_atts(array(
    'color' => 'yellow',
    'font' => '#000000'
  ), $atts));
  return "<FONT style=\"BACKGROUND-COLOR: $color; color: $font\">$content</font>";
}
add_shortcode('highlight','bainternet_highlight');

Usage: [ highlight ] this text is highlighted [/highlight]

Now, if you are searching for a MCE syntax highlightter, the best plugin I have found is the Advanced code Editor

Hope that helped with your question.


I've used Power Code Editor in the past it has syntax highlighting. It's been awhile since I've used it, but it seemed to work fine then.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.