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!

includes jinja templates in a documentation

Project Description


A sphinx extension to include jinja based templates based documentation into a sphinx doc


In your rst doc, you can use the following snippet to use a jinja template to generate your doc

.. jinja:: first_ctx

    {% for k, v in topics.items() %}

    {% endfor %}

In your sphinx file, you can create or load the contexts needed for your jinja templates

extensions = ['sphinxcontrib.jinja']

jinja_contexts = {
    'first_ctx': {'topics': {'a': 'b', 'c': 'd'}}

Available options

  • file: allow to specify a path to Jinja instead of writing it into the content of the directive. Path is relative to the current directory of sphinx-build tool, typically the directory where the file is located.

  • header_char: character to use for the the headers. You can use it in your template to set your

    own title character:

    For example:

    {{ options.header_char * 5 }}

Example of declaration in your RST file:

.. jinja:: approval_checks_api
   :file: relative/path/to/template.jinja
   :header_char: -

Each element of the jinja_contexts dictionary is a context dict for use in your jinja templates.

Running tests

  • pip install tox
  • tox

Release History

This version
History Node


History Node


History Node


History Node


History Node


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
(5.2 kB) Copy SHA256 Hash SHA256
Wheel py2 Aug 14, 2017
(7.0 kB) Copy SHA256 Hash SHA256
Source None Aug 14, 2017

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 DreamHost DreamHost Log Hosting