The Pygments Markdown Preprocessor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This fragment is a Markdown_ preprocessor that renders source code to HTML via Pygments. To use it, invoke Markdown like so::

from markdown import Markdown

md = Markdown()
md.textPreprocessors.insert(0, CodeBlockPreprocessor())
html = md.convert(someText)

markdown is then a callable that can be passed to the context of a template and used in that template, for example.

This uses CSS classes by default, so use “pygmentize -S <some style> -f html > pygments.css“ to create a stylesheet to be added to the website.

You can then highlight source code in your markdown markup::

some code

.. _Markdown:

:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details.

INLINESTYLES is referenced in 0 repositories