One of the great things about Jupyter Notebook is how you can intersperse your code blocks with markdown blocks that you can use to add comments or simply more context around your code. Here are ten ways I like to use markdown in my Jupyter Notebooks.

1. Use hashes for easy titles

In your markdown cell, enter a line like this:

# This becomes a H1 header/title

That line will render as a header (h1 element).

2. Use asterisks and hyphens for bullet points

Try these lines in your markdown cell:

* this is one way to do a bullet point
- this is another way to do a bullet point

Both render as bullet point lists.

3. Use asterisks and underscores for emphasis

Next, try this:

*these words become italicized*
__these words become bold__
Wait…that didn’t render quite as expected

The phrase I wanted to italicize italicized and the phrase I wanted to bold went bold, but both phrases rendered on the same line. What gives? I’ve noticed that some markdown behaves like this, but here’s a simple solution: add a <br> (HTML for line break) at the end of each line where you want a line break. So, write this in your markdown cell:

*these words become italicized*<br>
__these words become bold__

4. Center my headers with some HTML

Instead of using the hashtag shortcut, code your header elements directly and style them to center:

<h1 style="text-align: center">This header is centered</h1>

Interestingly, I’ve noticed that my centering works in Jupyter Notebook, but not in Jupyter Lab.

5. Create thick dividing lines with HTML

My notebooks that do a lot of exploratory data analysis before jumping into data modeling can get quite lengthy. I find that a nice, thick dividing line between sections can be a great visual indicator of the changing focus of my notebook. In a markdown cell, give this a try:

<hr style="border-top: 5px solid purple; margin-top: 1px; margin-bottom: 1px"></hr>

6. Write mathematical formulas

I’m more coder than math guy, but a formula or two can sometimes be helpful explaining your solution to a problem. Jupyter markdown cells support LaTeX, so give this a whirl:

linear regression: $y = ax + b$
two dimensions: $y = a_{1}x_{1} + a_{2}x_{2} + b$
Ridge Regression: standard OLS loss function + $\alpha \times \sum_{i=1}^{n} a^{2}_i$

7. Create hyperlinks

Hyperlinks are easy in markdown:

[Google](https://google.com)

8. Drop in images with HTML

A picture is worth a thousand words:

<img src="mind_blown.gif" style="max-width:50%; max-height:50%"></img>

9. Create nice tables

Use pipes and dashes to create a table in your markdown:

|| sepal length (cm) | sepal width (cm) |
|----|----|----|
|0|5.1|3.5|
|1|4.9|3.0|

10. Escape text with three tick marks

Occasionally, I’ll want to show a code snippet in my markdown or other kind of escaped text. You can do that by surrounding your snippet with three back-tick characters:

```
sample code goes here
```

Bonus: change the background color of your markdown cells

It never occurred to me until recently, but Notebooks bring with them a variety of style classes that you can leverage in your own markdown. Here are four examples (note: this is yet another markdown trick that works in Jupyter Notebook, but not in Jupyter Lab…at least the version I’m presently running):

<div class="alert alert-block alert-info">
This is a blue background
</div>
<div class="alert alert-block alert-warning">
This is a yellow background
</div>
<div class="alert alert-block alert-success">
This is a green background
</div>
<div class="alert alert-block alert-danger">
This is a red background
</div>

For all of this code, check out my notebook here. Also, here are two other great posts on more markdown tips and tricks.