Prettify Your Jupyter Notebook

Taylor Hale Robert
2 min readJul 2, 2021

A beautiful Jupyter Notebook is a useful Jupyter Notebook.

When I began working with Jupyter Notebooks, I found myself with a desire to create functional, pleasant-to-read and engaging notebooks.

The Jupyter Notebook is a beautiful way to work through problems. You can always keep your trash code! Just copy and paste it away — hoard it somewhere else in your repo.

A thoughtful and useful notebook tends to have the right balance of code, explanatory text, visualizations, and the occasional image. Jupyter Notebooks are versatile computing and programming work tools, and working with them can also be a wonderfully creative process. The mixture of code, markdown and some HTML is a fun and functional way to work.

After many StackOverflow queries for the same information, I decided to create a collection of common resources. For basic formatting, here is a link to the most useful Jupyter Markdown reference I’ve come across. Below I’ve listed some HTML goodies for further customization of your notebook.

Jupyter Notebook Cheatsheet by SplBak

Use color like this: <font color=#hexcodehere>YourTextHere</font>

Insert geometric shapes by decimal or hex code: &#shape;

Break lines using 2 spaces or <br>

Embed code without execution using backticks and specifying a language.

Above: markdown cell input, Below: output

Adjust image width and height like this:

<img src=”path-to-image" style=”width:500px;height:250px;”>

Align headings the way you prefer using:

<h1 style="text-align:center;font-size:150%;;">Your Heading Here</h1>

Use internal links to keep your work organized and easy to navigate. Here is a simple example to quickly navigate to the top of a notebook:

#example notebook header
<a id="top"></a>
<H1>Predicting Student Test Scores</H1>
---#example notebook footer with link to top
[Go to top.](#top)

I hope you find this information useful. Happy coding!

--

--

Taylor Hale Robert

data science + workflow automation, and the health + habits that support the work