Login

Tag "code"

Snippet List

Pygmentation

Usage: (if you save it as pigmentation.py as I did) {% load pigmentation %} {% autoescape off %} {{ somevariable|pygmentize }} {% endautoescape %} There already a few of this code around, but this one is pretty clean, and includes css. It also works in both the development server and Dreamhost (python2.4 in my django config) without any unicode problems.

  • filter
  • tag
  • templatetag
  • pygments
  • code
  • colorize
  • color
Read More

Pygments Rendering Template Filter

Finds all ``<code></code>`` blocks in a text block and replaces it with pygments-highlighted html semantics. It tries to guess the format of the input, and it falls back to Python highlighting if it can't decide. This is useful for highlighting code snippets on a blog, for instance.

  • template
  • filter
  • pygments
  • highlighting
  • code
Read More

2 snippets posted so far.