I’m pleased to announce the immediate availability of It’s an unofficial API for the Pygments syntax highlighting library. It’s designed to provide syntax highlighting for web applications that don’t have Python installed. You can think of it as an HTTP interface for Pygments.

To use it, simply POST to with “lang” and “code” parameters in the body. You’ll receive pygmentized HTML back, which you can store for later display on your site.

I’m using it so that I can host Flowcoder on Heroku. I was really impressed with the ease of getting this Pygments app running on Google App Engine. GAE is very much like a Python version of Heroku, which means it’s awesome.

I’m hoping that this little project will spike my interest in learning a bit more about Python, which actually doesn’t seem as evil as all my Ruby friends have made it out to be 😛

The source code is on github, in case you’re curious about how this all works.



Published by

Trevor Turk

A chess-playing machine of the late 18th century, promoted as an automaton but later proved a hoax.

6 thoughts on “Pygments”

  1. @Marcelo I would suggest storing the result in your database. So, you'd have a before_save callback or something that would populate a body_with_pygments_highlighting field (or something shorter). Then, you save your record with the pygments formatting and all, so you only have to call the pygments app one time on create.

Comments are closed.