-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Justification for enquoting parameters in single backticks #323
Comments
Agreed I have never really understood this. I think one that that could be really cool is figure out how to actually add linkable params as
to link to the This might require expanding https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html to have a new role or something, so an upstream issue might be the place to start. But to start we could just document as |
While linking to a parameter could in principle be possible. That's likely not as simple as one could imagine: One aspect is that parameters are ReST field lists within Python object description directives, e.g.:
Since I don't think one can reasonably change that syntax, you cannot have a new role. Rather, one would need to make these fields referencable. While I haven't looked into the sphinx source code, I anticipate that this is not easy because field lists and roles are quite different things. Another serious issue is the link resolution. Parameter names are usually note unique, we need to make their id unique using the contained function, e.g. |
I'm pretty sure the Sphinx glossary similarly uses a definition list, but
it's entries are referanceable. So it might out be available off the shelf,
but I don't see why it should not be possible with the right hook.
But that barely relates to the question of backticks. Backticks will
execute the default role which can merely be mapped to italic or monospace
font; it can resolve a reference but can be customised to not raise a
warning.
|
Is that suppress_warnings? Unfortunately, the sphinx docs are not quite clear on this. Anyway, my point is that using the default role for parameters does not work well for arbitrary sphinx configurations. numpydoc should communicate clearly which assumptions and configurations are supported (in the minimal scenario only stating your preferred config and that others may not work with using the default role for parameters. |
https://numpydoc.readthedocs.io/en/latest/format.html#parameters states
e.g.
Is there a specification backing this format? I have not found single backticks as valid markup in sphinx or docutils documentation. In contrast if using a default role in sphinx, this generates warning that the role traget cannot be resolved.
While that may (or may not)* work for numpy specifically, it can be a source of confusion for other projects that adopt the numpydoc style. It should at least be mentioned that single backticks can cause trouble with the
default_role
.The text was updated successfully, but these errors were encountered: