Jeremiah Sturgill

code etc.

Pygments for WordPress

This plugin adds cached, server-side Pygments syntax highlighting to your blog. Pygments has a lot going for it: it’s simple to use, simple to theme, and it supports a billion programming languages. Because it formats everything server-side, your visitors never see anything but perfectly formatted code–no delays, no hiccups, and no strange JavaScript or browser compatibility issues.

But there are at least two other WordPress plugins that add Pygments syntax highlighting. Why make another one?

  1. This plugin lets you choose whether to use an external webservice or run Pygments on your own server.
  2. This plugin caches its results, so that the markup only has to be generated one time.

The plugin adds a shortcode that you can use to bracket blocks of code in your blog posts. The rest is automagic.

Shortcode

[code language="php"]<?php echo 'hello, world!';?>[/code]

Result

<?php echo 'hello, world!';?>
  • PHP
  • CSS
  • WordPress
  • Pygments