Adding Syntax Highlighting to WordPress

I Just added syntax highlighting to Wordpress. As a development blog I must be able to show some descent code samples!

I tried the pugin wp-syntax http://wordpress.org/extend/plugins/wp-syntax/, but adding a <pre> element requires me to go to the code pane and editor the code there. (And make me type every special char like & as &)
With this syntax highlighting I’m not very happy because it places the highlighting above a black background.

Another highliger codesnippet-20 Is capable of editing in design time. I just need to place the code between: [code lang='php']Code text[/code]

You can even change the style setting in an options tab of Wordpres
To enable this, just:

There’s just one problem… TinyMCE removes my spaces !! An using a style “white-space: pre” gives me to many newlines because the highlighting adds newlines….

Aaaaaaargh!!!

Well I will look at this later.

Btw. I also found a DokuWiki syntax plugin for Wordpress… That sounds promising, I use dokuwiki for my internal wiki, and this wiki contains a lot of code snippets!

No Comment

No comments yet

Leave a reply