Skip to content

parameter types should be rendered as references #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anntzer opened this issue Sep 8, 2017 · 2 comments
Closed

parameter types should be rendered as references #110

anntzer opened this issue Sep 8, 2017 · 2 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Sep 8, 2017

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.)

@jnothman
Copy link
Member

I can't see where this logic appears in Napoleon's source code... I'm a bit befuddled.

@larsoner
Copy link
Collaborator

This is now in with xref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants