sphinx
sphinx copied to clipboard
sphinx.ext.autosummary: more customization options.
We are using autosummary
to document our package, and we are feeling limited by the customization options currently available. In particular, we are seeing that:
- Class templating does not provide enough flexibility for us.
- We would like to be able to tweak the display name of the class methods in the tables. For a function
module.submodule.func
we would like to display it assubmodule.func
, but the current functionality only allowsfunc
ormodule.submodule.func
.
For each of the problems, I would like to propose a new entry point for users to customize the behavior:
- Depending on the class, we want to show slightly different documentation. The namespace made available to the template by default however does not allow us to customize the documentation easily inside the template. We have to either design some complex logic inside the jinja template (which looks horrible) or set the global context with the configuration
autosummary_context
and then query the context for the particular class. It would be very nice if there is a config variable to generate a per-object context. I mean, a function that receives the python object and returns the context that should be made available in the template for that particular object. - A config variable to post-process display names in the
Autosummary
directive would be very nice.
I think both suggestions I could easily implement them myself and submit a PR, but I would like to understand if this additions would be welcome. It's my first time trying to contribute to sphinx
so I don't have a sense for how open to changes things are in the package :)
Thanks!