WordPress.org

Plugin Directory

WP-GeSHi-Highlight — simple, fast, and reliable syntax highlighting

Syntax highlighting for many languages. Simple usage. Based on GeSHi, an established and rock-solid highlight engine. Valid HTML output.

• Go, have a look at the live demo.

• Plugin highlights:

  • Syntax highlighting for 240 languages.
  • Lightweight and super-simple usage.
  • Mobile-friendly: saves bandwidth and battery (no client-side code execution required, usually only one additional HTTP request). This is much better than using one of these heavy-scripted client-side solutions!
  • High performance, with near-zero additional load on the back-end. Especially in combination with a caching solution this does not affect your page load time at all.
  • Line numbering (only if you want to). No displacements between code line and line number. Numbers are not copied in most browsers.
  • I have tested the default style with more than 20 themes, including Twenty Ten to Fifteen.
  • If you do not like the default style: just provide your on CSS file. Styles are highly & easily configurable.
  • Per-block styles: each code block on a single web page can be designed on its own, if that is something you need to do.
  • Clean, small and valid HTML output. That's super-important!
  • Clean and well-documented source code, using modern WordPress API calls.
  • Well-maintained for several years already, and I'll continue to provide support.
  • This is based on GeSHi, a reliable and well-established PHP highlighting engine, used by popular forum softwares such as phpBB or wiki applications such as Dokuwiki or MediaWiki.
  • Stability, performance and security are inherited from GeSHi. And I'll continue to merge in upstream changes.

WP-GeSHi-Highlight works as a drop-in replacement for WP-Syntax, which does not seem to be maintained anymore. Make the switch, it should just work (let me know how it went)!

• Usage:

Bear in mind: do not use the visual post editor. Use the raw editor instead. There, insert code blocks as canonical pre blocks, and use the lang argument to define the language of the code snippet:

<pre lang="languagestring">
    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>

This is all you need to do. Right, it is that simple! Isn't that cool?

Be sure to 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:

Many websites have used this plugin for years, and it seems to serve its purpose very well. Most issues so far were style-related. 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!

Requires: 3.0 or higher
Compatible up to: 4.2.2
Last Updated: 2015-6-17
Active Installs: 1,000+

Ratings

5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1 100,1,1
0,1,0 100,1,1 100,1,1
100,1,1
100,2,2
100,1,1 100,1,1
100,2,2
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1