-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Feature Request: render IPython/Jupyter Notebooks in repo view pane #2877
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
Comments
Please see #2570 |
Could somebody explain how to enable this feature? I can't find it anywhere. |
see #3301 |
@lunny, sorry I still couldn't figure out how to do it. Is there a more detailed instruction specifically for ipython notebook? |
@entron Just adding it here as I guess people will come back to this issue if they want to know how to do it. Let's say you have access to the server running gitea, and you can install python on it. Create a virtual environment and install jupyter in it. What you need to add in the config file to render jupyter notebooks is the following:
You obviously need to give exec access for the virtual environment to your web server user. I am still not fully happy with this solution as the python code is not coloured. But that is a huge step forward when compared to the json text displayed before. The |
@eapetitfils Thank you very much for this instruction. I followed it but I got an empty output when I opened a jupyter file in gitea. Could you tell me how to debug it? I want to find the error log but I don't know where to find it. |
@entron the log files reside in the If you run Gitea in docker, try |
Side-note:
|
@entron what version of gitea are you using? Have you tried running the render command outside of gitea? It should print out all the HTML code. And do not forget the space at the end of the render command in your config file. |
Thanks you all for the help! I realized the reason: I was running gitea in docker and I installed jupyter only on the host:) I installed jupyter inside the gitea docker container with:
|
After I installed jupyter in the docker the notebook rendering worked except images did not show up. I have checked the output of the command as suggested by @eapetitfils, the html output did contain the image. I am using the latest version. Does anyone have the same issue as me? |
Maybe a way to do it would be to add the handling of data URI images in the sanitizer policy: However, this comes with a security risk so not sure if this is a good idea to have that enabled all the time. And even if this was enabled only for specific external renderers, I am not sure nbconvert protects against a malicious ipynb file. There is also the colour rendering that is nuked by the sanitizer. Edit: What's left after this is embedding code inside a PNG, but AFAIK that is harmless until activated by something else and, anyway, could be embedded in any image hosted on Gitea, so this is not relevant to external parser. |
@eapetitfils sorry for the n00b question: which config file do we add this to? |
To the gitea More details were added lately to the documentation: https://docs.gitea.io/en-us/external-renderers/ |
Awesome. Many thanks! |
@eapetitfils said:
where do we set this p.AllowDataURIImages()? |
[x]
):Description
I would like to request that a feature be added to render IPython/Jupyter Notebooks in the file view of a repo.
Gogs (and GitLab/GitHub, etc.) have the ability to view IPython/Jupyter Notebooks in rendered form, but also to pull it up in source/raw, however in Gitea they are displayed as text only. Gogs uses notebook.js and marked.js to do this work. Gogs has the plugins in "public/plugins". There are some modifications in "pkg/markup/markup.go", "routes/repo/view.go", "templates/repo/view_file.tmpl", and "templates/base/head.tmpl".
I believe the locations in Gitea would be the following: "modules/markup/markup.go", "routers/repo/view.go", "public/vendor/plugins", "templates/base/head.tmpl", and "templates/repo/view_file.tmpl".
An example of the end goal is given in the screenshots below.
Screenshots
Current View:

This is what it should look like (this is from GitLab):

The text was updated successfully, but these errors were encountered: