Specifying targets for intersphinx links to numpy, scipy, and matplotlib

Where can I find instructions on how to specify targets for :ref:s and :term:s in numpy, scipy, and matplotlib? I have a Gist with a handful of intersphinx mappings, which now includes all of numpy, scipy and matplotlib. You should be able to use these entries directly in intersphinx_mapping, within your conf.py. If anyone has … Read more

How would I cross-reference a function generated by autodoc in Sphinx?

You don’t need to add labels. In order to refer to a Python class, method, or other documented object, use the markup provided by the Python domain. For example, the following defines a cross-reference to the mymethod method: :py:meth:`mymodule.MyClass.mymethod` Or even simpler (since the Python domain is the default): :meth:`mymodule.MyClass.mymethod` The documentation of TextWrapper.wrap that … Read more

How can I link/reference another reST file in the documentation?

To create links between different reStructuredText (.rst) files you can use the inline markup provided by sphinx. See the documentation under the heading Cross-referencing documents on top of the file you define its label .. _my-reference-label: then you can link to it from other documents using :ref:`my-reference-label`. I do not believe you need to use … Read more

Format text in a link in reStructuredText

This construct: Here you have |optparse.OptionParser|_. .. |optparse.OptionParser| replace:: “optparse.OptionParser“ documentation .. _optparse.OptionParser: http://docs.python.org/library/optparse.html produces this HTML (some linebreaks added): <p>Here you have <a class=”reference external” href=”http://docs.python.org/library/optparse.html”> <tt class=”docutils literal”><span class=”pre”>optparse.OptionParser</span></tt> documentation</a>. </p> I realize that this is not exactly what you asked for, but maybe it’s close enough. See also http://docutils.sourceforge.net/FAQ.html#is-nested-inline-markup-possible.

Sphinx error: Unknown directive type “automodule” or “autoclass”

The same thing happened to me! To fix it, go to the line in conf.py that says something like this: extensions = [‘sphinx.ext.todo’, ‘sphinx.ext.viewcode’] Yours will probably look different. Anyway, add ‘sphinx.ext.autodoc’ to the list. e.g. extensions = [‘sphinx.ext.todo’, ‘sphinx.ext.viewcode’, ‘sphinx.ext.autodoc’] If it was: extensions = [] then you’d change it to: extensions = [‘sphinx.ext.autodoc’] … Read more