Skip to content
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

Merged
merged 12 commits into from
May 21, 2021

Conversation

oke-aditya
Copy link
Contributor

@oke-aditya oke-aditya commented May 21, 2021

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 word PyTorch I changed the copyright name to PyTorch

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

Copy link
Member

@NicolasHug NicolasHug left a 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!

@@ -1,3 +1,5 @@
:github_url: https://github.com/pytorch/vision
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

Copy link
Contributor Author

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.

image

Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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 :)

Copy link
Contributor Author

@oke-aditya oke-aditya May 21, 2021

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 😅

@oke-aditya oke-aditya requested a review from NicolasHug May 21, 2021 09:41
@oke-aditya oke-aditya changed the title Add CopyButton to Docs Add CopyButton and minor Improvements Docs May 21, 2021
Copy link
Member

@NicolasHug NicolasHug left a 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 !

@NicolasHug NicolasHug merged commit dba5cf3 into pytorch:master May 21, 2021
@oke-aditya oke-aditya deleted the add_cpbt branch May 21, 2021 10:30
facebook-github-bot pushed a commit that referenced this pull request May 25, 2021
…s in docs (#3868)

Reviewed By: vincentqb, cpuhrsch

Differential Revision: D28677166

fbshipit-source-id: ae065ac44d28884ec6e1746318e33a7eb877e8c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants