Include sphinxcontrib.jquery
in the project dependencies & fix other JavaScript issues (Cherry-pick of #277)
#278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sphinx 6 stopped including jQuery by default, but we're still using it in some places. As a result, the docs' functionality is broken in some places like the language selection not being clickable: #272
I wanted to remove jQuery via
#275, but it is too hard to safely due with Pytorch because we have 105 usages. We will need to wait for the switch to Furo.
So, for now, we will include jQuery by default. We also try to activate the extension by default with the line
app.setup_extension("sphinxcontrib.jquery"),
but I'm having issues with that actually working. So, projects may need to still add"sphinxcontrib.jquery"
explicitly in their extensions inconf.py
- but they at least won't have to explicitly includesphinxcontrib-jquery
in their requirements.--
This PR also fixes other issues with our JavaScript, as reported by the developer console:
languages.html
was not recognizing jQuery. So, rewrite it to modern JavaScriptpytorchAnchors.bind();
was not defined so caused some of our setup to failhandleLeftMenu:
function was failing becausedocument.getElementById("docs-tutorials-resources")
does not exist. Since that function failed, it looks like it wasn't actually necessary anymore.