If you write a blog, you may want to embed the HTML from a Jupyter Notebook in WordPress. This is what I often do, so today I’ll show you how to do it painlessly in a couple of steps.
As an example I’ll be using one of my posts in the Pandas series. So, without further ado, here are the steps:
Table of Contents
Step 1 – Open the notebook
Here it is:
![Open the notebook](https://i0.wp.com/prosperocoder.com/wp-content/uploads/2021/06/image-1.png?resize=675%2C497&ssl=1)
Step 2 – Download the Notebook
Go to the File menu and download the file as Notebook, with the extension .ipynb. Make sure there are no spaces in the name of the file.
![Download the Notebook](https://i0.wp.com/prosperocoder.com/wp-content/uploads/2021/06/image-3.png?resize=675%2C611&ssl=1)
Step 3 – Open the Terminal
Now move your notebook to a folder of your choice. Then open the terminal and navigate to that folder:
![Open the Terminal](https://i0.wp.com/prosperocoder.com/wp-content/uploads/2021/06/image-5.png?resize=484%2C253&ssl=1)
Step 4 – Convert to HTML
Now, in the terminal, type the following command:
jupyter nbconvert --to html --template basic file_name_without_spaces.ipynb
and hit Enter. Naturally you should use the actual name of your file:
![Convert to HTML](https://i0.wp.com/prosperocoder.com/wp-content/uploads/2021/06/image-7.png?resize=675%2C208&ssl=1)
Step 5 – Copy the HTML code
Open the html file that has just been created in a word editor of your choice. I use Notepad. Select all and copy.
Step 6 – Add a CustomHTML Block in Worpress and Paste the HTML Code
Now you can use the code in WordPress. In your post add a CustomHTML block and copy the HTML code. You can also use the preview to see what it looks like.