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 text
You can even change the style setting in an options tab of Wordpres
To enable this, just:
- Simply download the plugin from: http://wordpress.org/extend/plugins/codesnippet-20/
- Extract it to the wp-content/plugins directory
- Activate it in the plugins panel
- And off you go.. Formatting code can be done with: [ code lang="LANGUAGE" ]...[ /code]
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!