jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.58k stars 4.85k forks source link

cannot comment on html view of notebooks #2727

Open jackalack opened 7 years ago

jackalack commented 7 years ago

After creating a pull request, it would be great if people could leave comments on the html view of the jupyter notebook. I believe it is the case that you can only leave comments on the raw jupyter notebook, which makes for a confusing user experience.

mpacer commented 7 years ago

There should be a way to do this using something hypothes.is at least in the context of public notebooks. I'll try this and get back to you.

dsblank commented 7 years ago

I have comments on some of mine, being rendered:

https://athena.brynmawr.edu/jupyter/hub/dblank/public/Jupyter%20Help.ipynb

In a markdown cell:

<div id="disqus_thread"></div>
    <script type="text/javascript">
        var disqus_shortname = 'calicoproject'; // required: replace example with your forum shortname
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
mpacer commented 7 years ago

That doesn't quite solve the line-comments version of the problem does it?

Furthermore, you can't easily wrap GitHub in a Discus comment thread or embed arbitrary js in the html that GitHub renders. So, while cool, that doesn't really solve this problem.

What we need is a way to overlay something for annotating text inside html. That's why I figured something like hypothes.is might work.

Unfortunately, the hypothes.is tool doesn't actually work on text in iframes… so it too wouldn't solve the line-comment version of the problem. I think the protocol would be able to handle it, but I'm not 100% sure.

If you want to see the closest I could come to solution based on the capabilities of hypothes.is today: go to jupyter/nbconvert/…/markdown_display_priority with your hypothes.is account active.

dsblank commented 7 years ago

Oh, I see... this was about PRs. Sorry for the noise.

mpacer commented 7 years ago

No, it's cool! Thank you for sharing — it's a neat idea, just doesn't work in this case.

takluyver commented 7 years ago

I suspect that inline comments integrated with Github's pull request system may be impossible because of the security considerations. They're displaying notebooks in an iframe so that it can't do anything with your Github login, but posting comments requires access to your login.

Maybe there's some way for the JS outside an iframe to capture events inside the iframe and modify its DOM? I haven't heard of any such thing, and I'm not sure it would be possible without breaking the isolation requirements, but browsers do a lot of amazing things.

judell commented 7 years ago

It is possible to do this:

image

In other words, open the iframe in a new tab and annotate there. Not what you're looking for, I know. It's awkward to open the iframe separately, and annotations made there aren't visible to a reader of the notebook as rendered in GitHub. Just mentioning it for completeness. Interested parties could arrange to be notified of annotations on the inner frame, and follow links to it.

dave-kielpinski-circleci commented 4 years ago

bump