Skip to content

parameter types should be rendered as references #110

Closed
@anntzer

Description

@anntzer

Consider
pkg/__init__.py

class C:
    """Some class.
    """


def func(x):
    """Some function.

    Parameters
    ----------
    x: C
        The x.
    """

pkg.rst

pkg package
===========

Module contents
---------------

.. automodule:: pkg
    :members:
    :undoc-members:
    :show-inheritance:

In the parameter list of func, numpydoc ultimately renders C (could also be pkg.C or ~pkg.C, all without backquotes in the docstring) in bold, whereas sphinx.ext.napoleon renders C as a reference to the C class (with a link). The latter behavior appears to be more useful.

One may argue that "C" should be enclosed in backquotes for that to happen, but in fact sphinx's default info field list syntax (http://www.sphinx-doc.org/en/stable/domains.html#info-field-lists) also does not require backquotes (similarly to numpydoc's examples) but still renders "C" as a reference.

(Actually looks similar to #43, #57 but possibly with more background info. In particular it would be nice if ~pkg.C and .pkg.C are correctly handled. Feel free to close as duplicate.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions