Documentation

Using Pygments in various scenarios

back to documentation index

Table of contents

PyGtk

Armin has written a piece of sample code that shows how to create a Gtk TextBuffer object containing Pygments-highlighted text.

See the article here: http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-gtk-rendering/

Wordpress

He also has a snippet that shows how to use Pygments in WordPress:

http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-in-wordpress/

Markdown

Since Pygments 0.9, the distribution ships Markdown preprocessor sample code that uses Pygments to render source code in external/markdown-processor.py. You can copy and adapt it to your liking.

Did you like the documentation? Do you have suggestions? Leave your comment here!

waylan@gmail.com wrote on Nov. 1, 2007:

The Markdown extension looks a little old. The API has improved [1] making is easier to add extensions to the Markdown class instance (since markdown v0.6). There is also an extension [2] available that does *not* add in a new syntax for defining codeblocks (simple indented blocks work fine).

[1]: http://www.freewisdom.org/projects/python-markdown/Writing_Extensions
[2]: http://achinghead.com/markdown/codehilite/

Disclaimer: I developed and maintain that extension and was recently added as a core developer to Python-Markdown.

 

Note: comments may be edited or deleted if they are of an offensive or inappropriate nature.