sphinx-doc / sphinx-doc/sphinx

Customably extend jinja 2 template namespace

Open
#13,477 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:proposal
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'd like to propose a feature to extend the namespace available to jinja2 templates

Currently, the following are available (some only on classes or modules):

name
objname
fullname
objtype
module
class
underline
members
inherited_members
functions
classes
exceptions
methods
attributes
modules

The proposed feature would allow custom extensions of this namespace, base on a extend-autosummary-template-content event. A minimal use case would be the following template.

.. _templates/dataclass.rst

Is this dataclass frozen?
{{ frozen }}

More in the next message (this one was largely edited after further investigation from my side).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file or test is named in the issue. Begin by locating autosummary's template namespace and the proposed extend-autosummary-template-content event; done means a documented, usable way to add custom values such as frozen to the template namespace.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.