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

'Run in Colab' buttons not rendered on readthedocs #244

Closed
jxmorris12 opened this issue Aug 12, 2020 · 3 comments
Closed

'Run in Colab' buttons not rendered on readthedocs #244

jxmorris12 opened this issue Aug 12, 2020 · 3 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@jxmorris12
Copy link
Collaborator

jxmorris12 commented Aug 12, 2020

For some reason, the .ipynb HTML is formatted differently when displayed on Github/jupyter/jupyternb and readthedocs. The bit of HTML in each notebook that's intended to show buttons (like 'Run in Colab') doesn't render properly. We probably just need to fix the indentation, or maybe some setting in nbsphinx.


Screenshot of how it looks on github (good):
Screen Shot 2020-08-12 at 5 09 51 PM


Screenshot of how it looks on readthedocs (bad):
Screen Shot 2020-08-12 at 5 09 55 PM

@jxmorris12 jxmorris12 added bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers labels Aug 12, 2020
@bterrific2008
Copy link
Contributor

bterrific2008 commented Aug 16, 2020

According to this issue, HTML-style hyperlinks are not currently supported by nbsphinx. The content of the HTML-style hyperlink is generated as plain text, which accounts for why the buttons appear differently on readthedocs.

An solution could be replacing the buttons with Markdown image links. I was able to replace the "Run in Google Colab" button with a badge:

Open In Colab

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb)

I couldn't find an existing "View GitHub Source" badge online, but it shouldn't be difficult to make one with shields.io.

One issue with this solution is that the image links are center aligned and not left aligned in the notebook. There should be a workaround using CSS, but I haven't been able to get it to work locally.


Screenshot of how it looks on jupyter notebook:

image

Screenshot of how it looks from the browser:

image

@jxmorris12
Copy link
Collaborator Author

Wow, thanks for figuring this out @bterrific2008 -- that sounds like a perfect solution. Do you mind submitting a pull request to fix the buttons?

@bterrific2008
Copy link
Contributor

Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants