Add Jupyter Notebook (.ipynb) Rendering Support#37433
Add Jupyter Notebook (.ipynb) Rendering Support#37433karthikbhandary2 wants to merge 66 commits intogo-gitea:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new frontend external renderer to display .ipynb files as formatted Jupyter notebooks inside Gitea’s repository file viewer, instead of showing raw JSON.
Changes:
- Register a new
jupyter-notebookfrontend renderer for*.ipynb. - Add a custom TypeScript notebook renderer plugin + dedicated CSS styling.
- Add Playwright e2e coverage for basic notebook rendering scenarios.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
web_src/js/render/plugins/frontend-jupyter-notebook.ts |
Implements client-side parsing/rendering of notebook cells and outputs (markdown/code/output types). |
web_src/js/external-render-frontend.ts |
Registers the new jupyter-notebook frontend plugin for the external-render framework. |
web_src/css/features/jupyter.css |
Adds notebook-specific styling for cells, prompts, code blocks, and outputs. |
tests/e2e/jupyter-render.test.ts |
Adds e2e tests to validate notebook rendering in the external-render iframe. |
modules/markup/external/external.go |
Registers *.ipynb to use the frontend external renderer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey suggested changes were made. Please check now. |
Are these fonts the same as the regular gitea pages uses? I see serif fonts and Gitea never renders serif, those should be sans-serif and use the existing font stacks from CSS variables. If that library injects CSS, I'd recommend disabling that and make it work with Gitea's existing markup CSS in https://github.com/go-gitea/gitea/tree/main/web_src/css/markup which applies to |
Now its only using san-serif and existing font-stack. |





Summary
Closes #37308
Adds native rendering support for Jupyter notebook files (.ipynb) in Gitea, allowing users to view formatted notebooks with code cells, markdown, outputs, and visualizations directly in the repository browser.
Motivation
Jupyter notebooks are widely used in data science, machine learning, and scientific computing. Currently, Gitea displays .ipynb files as raw JSON, making them difficult to read. This feature enables users to view notebooks in a formatted, readable way similar to GitHub and GitLab.
Implementation Approach
Initially attempted to use the
notebookjslibrary as suggested by @silverwind but encountered several issues:So Implemented a custom renderer that:
Features
Supported Cell Types
Supported Output Types
Edge Cases Handled
Changes
Frontend (TypeScript/JavaScript)
web_src/js/render/plugins/frontend-jupyter-notebook.ts(NEW)web_src/js/external-render-frontend.tsStyling (CSS)
web_src/css/features/jupyter.css(NEW)Backend (Go)
modules/markup/external/frontend.gomodules/markup/external/external.go.ipynbfile pattern for frontend renderingTests (E2E)
tests/e2e/jupyter-render.test.ts(NEW)Security Considerations
Testing
Run E2E tests:
All tests pass with validation for:
Screenshots
Dependencies
No new dependencies added. Uses existing:
Development Note: This PR was developed with assistance from Amazon Q Developer and Claude AI for implementation, debugging, and testing.