Table Of Contents

This Page

sphinxcontrib.jinjadomain — Documenting jinja templates

This contrib extension, sphinxcontrib.jinjadomain, provides a Sphinx domain for describing jinja templates.

In order to use it, add sphinxcontrib.jinjadomain into extensions list of your Sphinx configuration file (

extensions = ['sphinxcontrib.jinjadomain']

Basic usage

There are several provided directives that describe jinja templates.

.. jinja:template:: /etc/network/interfaces

   Template for network config

   :param hostname: your computer's hostname
   :type hostname: str
   :param ip: your computer's ip
   :type ip: str

will be rendered as:

TEMPLATE /etc/network/interfaces

Template for network config

  • hostname (str) – your computer’s hostname
  • ip (str) – your computer’s ip


.. jinja:template:: path

Describes an jinja template.

Resource Fields

Inside HTTP resource description directives like get, reStructuredText field lists with these fields are recognized and formatted nicely:

param, parameter, arg, argument
Description of URL parameter.

sphinxcontrib.autojinja.jinja — Creates jinja

It generates jinja reference documentation from a start comment in jinja template. Basicly it just takes docstring betwene {# and #} and inserts it where you specified autojinja directive.

In order to use it, add sphinxcontrib.autojinja.jinja into extensions list of your Sphinx configuration ( file:

extensions = ['sphinxcontrib.autojinja.jinja']

To make everything work you also have to specify relative or absolute path to your templates. If this option is not specified templates won’t be displayed in your documentation. You can do this by setting jinja_template_path in your Sphinx configuration ( file.

For example:

.. autojinja:

will be rendered as:


This is a sample template

  • param1 (str) – This is sample input parameter to this template

Author and License

The sphinxcontrib.jinjadomain and sphinxcontrib.autojinja, parts of sphinxcontrib, are written by Jaka Hudoklin and distributed under BSD license.

The source code is mantained under the common repository of contributed extensions for Sphinx (find the jinjadomain directory inside the repository).

$ git clone git://
$ cd jinjadomain
$ python install

This package is also avalible on PyPI as sphinxcontrib-jinjadomain