Finance and operations

X++ syntax highlighting for WordPress

X++ syntax highlighting for WordPress

I’m still setting up the blog and was looking for a syntax highlighter plugin for X++. I tried a few highly rated syntax highlighters. Most does not have X++ support, so I tried using C++ and Java. All of the plugins formatted the code nicely and made the comments green, but of course did not make X++ keywords like select and while blue.

I consider X++ to be a niche, so I was surprised to find WP-GeSHi-Highlight that has support for X++. It’s highly customizable with arguments and CSS.

The plugin uses GeSHi highlight system, a .php library for formatting syntax on the web. I saw two other WordPress plugins based on GeSHi, but haven’t tried them yet:
Developer Formatter

It displays X++ code in WordPress like this:

Here’s the same code in the MorfX editor in 2012:
X++ code example

I’m going to try it and see how it goes. I’ll probably also make a few changes to the CSS to see if I can make it look more like the MorfX editor. I’ve noticed that it does not make integers red or comments italics, as you can see above.

UPDATE: I changed the CSS so that it looks a bit more like the MorfX editor. You can download the updated CSS at the end of this post.

Leave a Reply

Your email address will not be published. Required fields are marked *