If you’re looking to insert snippets of code into your WordPress site, you might find that the
<pre> tags don’t quite cut the mustard. You could mess around with the CSS and stylise your tags. However the easiest solution is to simply find a nice plugin to use.
My main requirement is that it supports the languages I’m interested in, namely Java, Python and Bash. However, for readability, it is also import to me that long lines of code is sideways scrollable and does not wrap itself onto the next line. I tend not to use the “Visual” mode in WordPress, so I really only cared about “Text” mode support.
I found a lot of plugins but not all were suitable for one reason or another. Take these three, they have all not been updated in over two years. Not ideal!!
Before I noticed it was out-of-date and had not been tested with my version of WordPress, I installed and used SyntaxHighlighter for WordPress. To be fair, it met my requirements and seemed to work fine with version 4.1.1. However, I am not cool with using an out-of-date plugin, so I unistalled it.
The below plugin met my needs and looked really good. From the looks of the screen shots, it appears to let you stylise the
<code> tags from the web interface! Had it not been for the fact I could not be positive it supported the English language and there were zero ratings, I may have considered it more seriously.
Sadly these two plugins do not appear to support Bash.
That leaves me with these three.
In the end I went with SyntaxHighlighter Evolved as, like SyntaxHighlighter for WordPress, it is based on SyntaxHighlighter by Alex Gorbatchev. However, this plugin is updated regularly and looks good.