Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.85 KB

README.md

File metadata and controls

43 lines (25 loc) · 1.85 KB

Jupyter Notebook Web Page integration

This repository demonstrates how to perform a full integration of a jupyter notebook in a web page.

The code is highlighted with pygments. Math equations are rendered with MathJax. The jupyter notebook is converted to HTML with nbconvert. The main style is from bootstrap. Custom CSS classes are provided in this repo for a consistent style between the included jupyter HTML file, and the mother HTML page.

This setup is fully explained in my article https://thedatafrog.com/jupyter-notebooks-web-pages.

Description of the repository

The file templates/overfitting.html has been generated with

jupyter nbconvert --execute --template basic overfitting.ipynb

templates/main.html is the template web page in which we want to include

render.py is a simple custom python script that generates index.html from the template. This script is just for demonstration purposes. For real websites, I use django and its template engine.

the css directory contains custom CSS classes for the styling of the various elements in the web page:

Rendering the HTML file

Just do

python render.py

And open the resulting index.html in your browser to see the results.

If you edit template.html do not forget to render again.

Results

Here is what I get in my django website: