Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!


Project Description

Drop-in replacements for Sphinxcode-block and literalinclude directives. In addition to specifying emphasize-lines, you can specify arbitrary classes to add on a per-line basis.

For example:

.. code-block:: python
   :line-classes: 1(python-def)

   def stay(classy):

Will wrap the function declaration in <span class="python-def">...</span>.

Valid line + class specifiers include:

  • 1(classname)
  • 1-5(classname)

You can separate multiple specifiers with a comma.

You can use both line-classes and emphasize-lines in the same block.


To install, simply install the package:

$ pip install sphinx-classy-code

Then add it to the list of Sphinx extensions in your

extensions = ['classycode']


sphinx-classy-code is made available under a BSD license; see LICENSE for details.



Release date: 16 March 2014

  • code-block supports line-classes option.
  • literalinclude supports line-classes option.
  • line-classes and emphasize-lines work together correctly.

Release History

This version
History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(8.6 kB) Copy SHA256 Hash SHA256
Source None Mar 16, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers