May 26 2022 · Aleksandra Płońska, Piotr Płoński

The 5 ways how to style text in Jupyter Notebook

How to style text in Markdown in Jupyter Notebook bannerThe Jupyter Notebook offers a great way to mix code with Markdown. It allows create computational documents and is a step forward to literate programming proposed by Donald Knuth. Have you ever need to style a Markdown text in the Jupyter Notebook? I will show you how it can be done with Markdown or HTML syntax.

1. Jupyter Notebook bold text

There are several ways to create a bold text in Jupyter Notebook Markdown:

**bold text**
__bold text__
<strong>bold text</strong>
<b>bold text</b>

As you can see you can use Markdown or HTML syntax for creating bold text. Please notice that there is no spaces between Markdown special characters and words (it is important), such string ** not a bold ** will not work!

There are many ways to have bold in the text. Which one to use? I'm personally using the option with **. Why? Because it is easy for me to find * in the plain text.

2. Jupyter Notebook italic text

The italic text in Jupyter Markdown is very similar except there is one special character needed:

*italic text*
_italic text_
<em>italic text</em>
<i>italic text</i>

IMPORTANT: there are no spaces between word and * or _. Here, as well I prefer the solution with single *.

3. Jupyter Notebook strikethrough text

To get strikethrough text in Markdown in Jupyter Notebook you can use following syntax:

~strike text~
<strike>strike text</strike>
<del>strike text<del>

4. Jupyter Notebook bold and italic

You can mix above syntax to get bold and italic text. There are several ways to do this. My prefered way:

***bold and italic text***

But you can mix any of the above:

_**bold and italic**_
___bold and italic___
**<i>bold and italic</i>**

The same with strikethrough:

~***bold and italic and strike text***~

5. Jupyter Notebook underline

There is no syntax for underline in the Markdown. The underline text might be confusing with hyperlinks. If you really need underline text in your Jupyter Notebook then you can do this with HTML tags:

<u>underline text</u>

Summary

There are many ways to style text in Jupyter Notebook Markdown. Just select your preferred way and use it consistently. I hope you will create wonderful things in your Jupyter Notebook. Good luck!

Become a Data Science wizard, today!

Forget about Python problems, just do your work.

MLJAR Studio