-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Standardize usage of single backticks for variables in docstrings. #2286
Comments
Thanks @tlambert03, I think internally in sphinx single backticks will be converted to a inline directive with a role and name, it just happened that if there is None, sphinx try to "guess", and the "guess" is part of sphinx configuration. I don't think this is critical in the short term, and likely something I can try to address in vélin. Maybe this is something we can also talk about with the Jupyter Book crowed as well. I know the single-vs double is also quite confusing comming from markdown. |
Yeah, so I've started using |
I don't think there is one. The :func:my_function: role actually links to a reference in the Sphinx index, but parameters don't have such cross-reference indices... hence the confusion here |
That's... annoying. LOL |
Thanks for raising this @tlambert03, I'll go with to whatever the recommended best practices here are |
Personally I think that staying with single in the codebase and working on fixing the styling/directive-role in sphinx is the right way to go. It may be a matter of updating numpydoc to emit references in parameters. |
📚 Documentation
as pointed out by @Carreau in #2279 (comment), there are plenty of places in our docstrings where double backticks are being used stylistically, to achieve
<pre>
styling in the sphinxdocs... but this conflates style with semantics. This has been discussed a lot elsewhere (see e.g. sympy/sympy#13519 and SO).The truth is, the meaning of a single back-tick in rst is a little vague, these docs call single backticks "interpreted text" and note:
So... it really is "what we make of it." ... but the numpy docstring guide says:
so that's good enough for me! (I'm probably the biggest offender here in terms of using double backticks to get the desired sphinx style)
Sphinx uses
<cite>content</cite>
for single backticks and<em>content</em>
for asterisks, and while the default rendering of<cite>
appears to be italicizes, we can change that on the CSS side.So, fixing this will require going through the docstrings and replacing variables in double backticks with single backticks. note, numpy docs say "For inline display use double backticks (like
y = np.sin(x))
."... so double backticks aren't always unacceptable, but shouldn't be used for variable names.rst docs say double backticks are "inline literals" which are "Normally rendered as monospaced text. Spaces should be preserved, but line breaks will not be."
@kne42
The text was updated successfully, but these errors were encountered: