-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add an option to not create links within a sig-param
block
#9599
Comments
Would removing this line https://github.com/pytorch/vision/blob/57725901bdc59530670813e07f61423702051845/docs/source/conf.py#L201 be a valid solution for you? |
That would remove all the other python intersphinx mapping that we desire to use, so no, it would not be a valid solution as far as I can tell. |
(I can't immediately compile the docs as the package is not found during
I think all the spans are needed to be able to customize through CSS by theme authors. Do you have particular examples of superfluous ones?
This is indeed a problem and, e.g., the RTD theme has some CSS that broke some declarations due to this (see e.g., breathe-doc/breathe#655).
Indeed, and I think once the Python domain uses more of the above-mentioned docutils nodes I believe we can be a nice structured guide for styling the declarations (perhaps that reveals a bit more cleanup in the CSS classes is needed). #9023 may provide some hints for now, and at sphinx/sphinx/themes/basic/static/basic.css_t Line 546 in 6c38f68
|
This is probably the best path for now, thanks.
This annotation
I think the open and closing parenthesis ( |
This project is indeed difficult to build, sorry for that. The only easy way to get the project is via conda using the |
Thanks for the example. If I remember correct then the As for the As a comparison for how the HTML will look after this update, you can compare to a similar C++ signature, e.g., https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#_CPPv4NK16overload_example1C1fEd which becomes the following (currently with the extra <span class="kt"><span class="pre">void</span></span>
<span class="w"> </span>
<span class="sig-name descname">
<span class="n"><span class="pre">f</span></span>
</span>
<span class="sig-paren">(</span>
<span class="kt"><span class="pre">double</span></span>
<span class="w"> </span>
<span class="n sig-param"><span class="pre">d</span></span>
<span class="sig-paren">)</span>
<span class="w"> </span>
<span class="k"><span class="pre">const</span></span> |
Describe the bug
Over at Pytorch/vision, we moved from Sphinx 2.x to Sphinx 3.5.4. When rendering python functions with annotations, the rendering looks like this (the raw html is in the detail, broken up by lines).
torchvision.datasets.
Caltech101
(root: str, target_type: Union[List[str], str] = 'category', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]We have a few concerns, the primary one is:
str
andbool
, we really do not need them and the link formatting is distracting.Also problematic, but much less so:
class="sig-param"
container.raw html
How to Reproduce
Expected behavior
I would expect there to be an option to disable creating links, an option to create light-weight signatures, or something along those lines.
It would also be helpful to have a "guide to formatting" that describes the various classes available for formatting. In this example there are
"anchorjs-link "
,"default_value"
,"n"
,"o"
,"p"
,"pre"
,"property"
,"reference external has-code"
,"reference internal has-code"
,"sig-name descname"
,"sig-param"
,"sig-paren"
,"sig-prename descclassname"
,"viewcode-link"
Your project
https://github.com/pytorch/vision/tree/main/docs
Screenshots
No response
OS
linux
Python version
3.8
Sphinx version
3.5.4
Sphinx extensions
'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', 'sphinx.ext.duration', 'sphinx_gallery.gen_gallery', 'sphinx_copybutton'
Extra tools
No response
Additional context
We use the pytorch_sphinx_theme based on the RTD theme. Here is the issue that triggered this report pytorch/pytorch_sphinx_theme#139
The text was updated successfully, but these errors were encountered: