Skip to content
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

Trailing underscores in types #444

Open
KendrickLamarck opened this issue Jan 2, 2023 · 2 comments
Open

Trailing underscores in types #444

KendrickLamarck opened this issue Jan 2, 2023 · 2 comments

Comments

@KendrickLamarck
Copy link

Trailing underscores in types in the Parameters and Returns sections have to be escaped in order to not give an Unknown target name warning.

Examples that DON'T work :

def identity(object_):
    """Identity function.

    Parameters
    ----------
    object_ : Any

    Returns
    -------
    object_ : type(object_)
        Just `object_` again.
    """
    return object_

The returns section

Returns
-------
type(object_)
    Just `object_` again.

Without a name doesn't work either. In both cases, I have to write type(object\_).

I don't know if this is fixable like it was for parameter names (#63). I guess types are actually supposed to be links sometimes, in contrast to parameter names? Feel free to close if that is the case and there's just not really a possible fix.

@larsoner
Copy link
Collaborator

larsoner commented Jan 2, 2023

I think we try to allow / stick with standard RST, and name_ in RST is a link to .. _name: whatever. So I don't think this is a NumpyDoc issue so much as a RST one

@KendrickLamarck
Copy link
Author

Well, the parameter names also change the default RST behavior by making the names bold. It's just a bit confusing and inconsistent, especially because the types are in italics. This normally also disables linking, but I guess in this case the italicization happens after "link-checking", whereas bolding the parameter names happens before?

But if the intention is to allow standard RST after the :, that's a good enough reason to close this.

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

2 participants