This will be a short post. I just installed Ryan McGeary’s WP-syntax plugin for Wordpress. Let’s see a few examples…

<body>
<?php
echo $javascript->link('prototype_1.6.0');
echo $javascript->link('scriptaculous_1.8.0/scriptaculous');
echo $javascript->link('home');
echo $scripts_for_layout;
?>
</body>
1
2
3
4
5
class Example
   def example(arg1)
      return "Hello: " + arg1.to_s
   end
end

That looks pretty good. I did find a bug when using this plugin with WP 2.3.3. When I go back to edit the post some of the code tags are converted to html entities. The format is also not preserved (spacing and newlines). I should note that the WP-syntax plugin only says it is compatible with WP up to 2.2.2, so my version (which WP has actually released another update for) isn’t technically supported yet. Ryan got back to me (see comment below) that the plugin does in fact work with WP 2.3.3 (as well as 2.5 too).

I also noticed a funky bug that occurs when I toggle between visual and code view in the WP editor. It seems as though the javascript is tinkering with it. I’ll try to investigate and do a follow post on that another time.

Update: I really wanted to avoid modifying the core WP files because it would be a pain when I wanted to upgrade again. I decided to upgrade to WP 2.5 and see what I can do. As it turns out, ver 2.5 remembers the last editor you were using. In my case it happens to be HTML, so it brings that up initially. The code text isn’t modified and everything is great! Note: I could’ve also turned off the visual editor, but then I wouldn’t have that editor for other posts and I didn’t want to impose that limit on myself.