-
Notifications
You must be signed in to change notification settings - Fork 7k
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 CopyButton and minor Improvements Docs #3868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @oke-aditya this is a great idea!
The cross-referencing with other packages is something I wanted to do too!
docs/source/index.rst
Outdated
@@ -1,3 +1,5 @@ | |||
:github_url: https://github.com/pytorch/vision |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enables edit on GitHub in docs. Not one of the best features though, but it is used in pytorch docs.
Hence I thought let's follow the same for torchvision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, the icon for the link looks broken... let's remove it and wait until they fix it. It's not a super useful ffeature as you noted anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea Where could we possibly fix the icon? It is broken even on pytorch website
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code for it is
<a href="https://github.com/pytorch/pytorch" class="fa fa-github"> Edit on GitHub</a>
so it seems related to font-awesome somehow https://fontawesome.com/icons/github.
Perhaps the pages are missing a js script or some css or something... my web dev skills are very weak :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, after a little digging i found out that the pytorch_sphinx_theme creates this issue. Particularly this file
Maybe the fix is to use
<i class="fa fa-github" aria-hidden="true"></i>
instead of class="fa fa-github"
.
Not too sure with this as my web dev skills too are somewhat rusty. Not too experienced to send PR to the theme 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @oke-aditya !
…s in docs (#3868) Reviewed By: vincentqb, cpuhrsch Differential Revision: D28677166 fbshipit-source-id: ae065ac44d28884ec6e1746318e33a7eb877e8c1
Copy button is supported in PyTorch tutorials docs using Sphinx copy button.
So I thought to duplicate same for torchvision,
Users with this can now copy the examples in example gallery (as well as codeblocks in documentation) to their clipboard.
If accepted I can raise PRs for audio and text libraries as well.
Edit: I added
sphinx.ext.duration
. This allows us to view details during doc build.Also since most pages use wordPyTorch
I changed the copyright name toPyTorch
Edit2: I tested it locally it worked fine.
Edit3: Added edit on Github
Edit4: Added intersphinx for torch, PIL, matplotlib
Link to rendered docs
cc @NicolasHug