Pygments

I’m pleased to announce the immediate availability of http://pygments.appspot.com. 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 http://pygments.appspot.com with “lang” and “code” parameters in the body. You’ll receive pygmentized HTML back, which you can store for later display on your site.

http://gist.github.com/188359

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 :P

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

Enjoy!

http://pygments.appspot.com

Advertisement

6 Responses to “Pygments”


  1. 1 tejo October 23, 2009 at 9:13 am

    this is really cool, thanks!

  2. 2 Marcelo Silveira February 19, 2010 at 6:03 am

    This is just what I was looking for. And for the same reason. How is performance doing? The HTTP request impacts the page loading too much?

  3. 3 Trevor February 19, 2010 at 6:59 am

    @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.

  4. 4 Marcelo Silveira February 19, 2010 at 2:02 pm

    Thanks Trevor. Good point.

  5. 5 Elliot July 9, 2011 at 10:46 am

    Thanks this was perfect for what I needed!

  6. 6 austinbv August 3, 2011 at 11:39 am

    On Trevorturks suggestion via github I have uploaded a new version of pygments to a new google app. http://pygments-1-4.appspot.com


Comments are currently closed.




Follow

Get every new post delivered to your Inbox.