Customizing autodoc: Shortened names without breaking cross-references

55 views
Skip to first unread message

roshan pradhan

unread,
Mar 18, 2025, 8:16:55 PMMar 18
to sphinx-users
Hey everyone,
I'm customizing Sphinx's autodoc extension to modify how class and function names are displayed. In particular, I want to display a shortened name which can be used for importing instead of a fully qualified name. For example, sympy.sets.sets.Set can be shortened to sympy.Set as it is accessible from the top-level namespace.

The issue is that when I do this, cross-references break, i.e., Sphinx can't find the [source] link to the code on GitHub. Is there a way to modify how autodoc displays names while keeping cross-references working? If anyone has done something similar or knows of a solution, I'd really appreciate some guidance or example code.
Reply all
Reply to author
Forward
0 new messages