Reputation: 1125
How can I achieve something like this in sphinx?
Creates a `ClassName`_ instance.
.. _ClassName: :class:`~very.long.path.to.ClassName`
I would like to have short links to long class/methods/etc references in order to make my documentation more readable.
Upvotes: 2
Views: 648
Reputation: 1755
I had the same problem, but I finally got things to work using reST Substitutions. Try this:
Creates a |ClassName| instance.
.. |ClassName| replace:: :class:`~very.long.path.to.ClassName`
Upvotes: 3
Reputation: 1125
The best way I've found so far to reduce the length of my python references is to use the current module directive:
.. py:currentmodule:: very.long.path.to.package
This is my :class:`~module_in_package.ClassName`.
Upvotes: 1