Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A pygments formatter that outputs <fo:inline> tags

Project description

This is a formatter for pygments that produces output marked up with tags with the appropriate colour and other presentational attributes set according to the pygments style in use.

To be useful this must be embeded in a complete xsl-fo document. It was developed for use with asciidoc to produce PDF’s using fop with minimal configuration or extra dependencies.

It is possible that it could be used in more general docbook to pdf tool chains.


Install from pypi:

$ pip install pygments-xslfo-formatter

To install from the from the source distibution. Use any of the normal installation methods from the top directory of the distribution to install.

$ python install   # Usual installation method

$ pip install .             # Using pip

This will install pygments if it is not already installed. You can check that it is working by listing the formatters and checking for the presence of one containing xslfo.

$ pygmentize -L formatters
[... ommitted output ...]
* xslfo, xsl-fo:
    Format tokens as XSL-FO ``<fo:inline>`` tags.


As this just adds a new formatter type to pygments, you just use’ xslfo’ where ever you might, for example, specify ‘html’ as a formatter name.

$ pygmentize -f xslso -l python

You should see lots of tags

To use with asciidoc, which is the initial purpose of this extension look at the example directory which contains a simple but complete example.

Example result

You can see an example pdf file here:[1]

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pygments-xslfo-formatter, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pygments-xslfo-formatter-1.1.2.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page