skillfed

sphinx-jinja

includes jinja templates in a documentation

sphinx-jinja v2.0.2 2.9M downloads/30d#2,842 on PyPI30
Permissive license MIT DORMANT released

What it is and what it does

sphinx-jinja is a Sphinx extension that adds a jinja directive to reStructuredText, allowing you to embed Jinja2 template code directly in your documentation source. At build time, the extension renders these templates using contexts you define in your Sphinx conf.py, producing dynamic RST content that Sphinx then processes normally. You configure contexts, custom filters, tests, globals, and Jinja environment settings in your configuration file, then reference them by name in your RST directives.

The extension is useful when your documentation needs to be generated from data structures, iterate over collections, or apply conditional logic—tasks that plain RST cannot express. You can inline templates in your RST files or load them from separate Jinja files using the file option. It also supports header-level management and debug output to inspect the generated RST before final rendering.

Use it for:

  • Generate API documentation tables or lists by iterating over structured data in conf.py.
  • Conditionally include or exclude documentation sections based on configuration flags.
  • Apply custom formatting to template variables using Jinja filters.
  • Load and render reusable documentation templates from external Jinja files.
  • Maintain DRY documentation by templating repetitive content patterns.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A Sphinx extension that lets you embed Jinja2 templates directly into reStructuredText documentation, generating dynamic content at build time.

Yes, if you need dynamic content generation in Sphinx and are comfortable with dormant maintenance. The package is stable, has no known vulnerabilities, and supports Python 3.6 through 3.10. However, because the last release was in 2022 and the repository has seen no commits since 2023-11-02, do not expect bug fixes or compatibility updates for future Sphinx or Python releases. Suitable for established projects where the feature set is complete; risky for new projects requiring ongoing support.

Install

sphinx-jinja on PyPI

pip

pip install sphinx-jinja

uv

uv add sphinx-jinja

poetry

poetry add sphinx-jinja

Installing sphinx-jinja

Before you install

Low friction install with three stable dependencies. Maintenance is dormant—last release was 2022-07-05 and no commits since 2023-11-02—so expect no active support, though the package remains functional for current Python versions.

License in practice

MIT license is permissive, allowing use in commercial and private projects with minimal restrictions.

Quickstart

pip install sphinx-jinja

In conf.py:
extensions = ['sphinx_jinja']
jinja_contexts = {'ctx': {'items': ['a', 'b']}}

In your .rst file:
.. jinja:: ctx

   {% for item in items %}
   - {{ item }}
   {% endfor %}

Requires Sphinx, Jinja2, and docutils to be installed; Python >=3.6,<4 required.

Verify before relying

  • Whether the package works reliably with recent Sphinx versions beyond 2022.
  • Community activity or third-party maintenance status beyond the original repository.
  • Compatibility with Python versions released after the last package update.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6,<4)
Install friction low — pure-Python wheel
Runtime dependencies 3 — Jinja2, docutils, sphinx
Maintenance dormant — 1,501 days since the last release
Last repo commit
First released
Downloads 2,888,200/month — #2,842 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sphinx_jinja-2.0.2-py3-none-any.whl

Keywords: sphinx, jinja

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

sphinx jinja template extensiondynamic documentation generationjinja in sphinx docstemplate-based rst contentsphinx template directive
template-enginedocumentation-generation

More Sphinx packages

docstring-parser

Parses Python docstrings in ReST, Google,…

permissive · top 1,000 on PyPI

Sphinx

Sphinx generates professional documentation…

permissive · top 1,000 on PyPI

sphinxcontrib-serializinghtml

A Sphinx extension that outputs documentation…

permissive · top 1,000 on PyPI

alabaster

Alabaster is a clean, responsive Sphinx theme…

permissive · top 1,000 on PyPI

sphinxcontrib-htmlhelp

A Sphinx extension that generates HTML help…

permissive · top 1,000 on PyPI

sphinxcontrib-qthelp

A Sphinx extension that converts documentation…

permissive · top 1,000 on PyPI

sphinx-jinja2-compat

Patches Jinja2 v3 to restore compatibility with…

permissive · top 15,000 on PyPI

sphinx-substitution-extensions

Adds substitution support to Sphinx directives,…

permissive · top 15,000 on PyPI

sphinxcontrib.datatemplates

A Sphinx extension that renders…

permissive · top 15,000 on PyPI

sphinx_mdinclude

Sphinx extension that lets you include and…

permissive · top 15,000 on PyPI

Jinja2

Jinja2 is a templating engine that renders…

permissive · top 100 on PyPI

sphinx-markdown-builder

A Sphinx extension that generates Markdown…

permissive · top 15,000 on PyPI

sphinxcontrib-googleanalytics

Adds Google Analytics tracking to…

permissive · top 15,000 on PyPI

sphinxemoji

Sphinx extension that replaces emoji codes…

permissive · top 15,000 on PyPI

sphinxcontrib-video

A Sphinx extension that embeds HTML5 videos…

permissive · top 15,000 on PyPI

sphinx-favicon

A Sphinx extension that injects custom favicon…

permissive · top 15,000 on PyPI