Simple. Fast. 259 languages. Mobile-friendly. Rock-solid (GeSHi).
• Highlights:
WP-GeSHi-Highlight works as a drop-in replacement for WP-Syntax, which does not seem to be maintained anymore (as of 2015). Make the switch, it should just work (let me know how it went)!
• Usage:
WordPress 5 users: for now I have tested this plugin only with the Classical Editor. Gutenberg is not yet supported (it may work though, let me know).
Recommendation: use the “Text” (raw) editor. Do not use the “Visual” editor. Switching between both may corrupt the contents of your code blocks.
In the text editor insert code blocks as pre
blocks, and use the lang
argument to define the language of the code snippet:
<pre lang="language"> CODE </pre>
A short example for the bash
language:
<pre lang="bash"> $ dd if=/dev/zero of=image.ext3 bs=1M count=10000 oflag=append conv=notrunc </pre>
Publish/preview, and have a look at the result!
Also check out the reference documentation for all available options. You can find it on the plugin’s website. Note that more usage examples can be found on the demo website.
• Issues:
A bunch of websites have used this plugin for years, and it seems to serve its purpose well. If you find an issue please let me know: drop a mail or leave a comment.
• Theme compatibility of the default style sheet:
The default style sheet was tested with recent versions of all official themes (Twenty Ten to Twenty Fifteen), and with a large range of non-official themes such as Vantage, Customizr, ColorWay, Zerif Lite, Responsive, Storefront, Virtue, evolve, Make, Sparkling, Spacious, Enigma, Sydney, Point, Interface, SinglePage.
Certain themes might define styles with a high specificity that negatively affect the visual code block appearance. It is difficult to impossible to anticipate all these cases in advance, so I expect this to happen in rare cases (the past has proven that these things happen). So, I need you to look out for these situations, and please report them!
wp-geshi-highlight
directory to the /wp-content/plugins
directory.Please have a look at the plugin’s website.
wp_register_style()
.