This Jupyter Notebook Markdown Cheatsheet provides concise, practical instructions for formatting text, creating lists, adding links, and embedding images and other elements in Markdown cells. It covers essential syntax for headings, emphasis, mathematical symbols, and more. Perfect for enhancing your Jupyter Notebook documentation.
Markdown for Jupyter Notebooks Cheat Sheet
Headings
Use the number sign (#
) followed by a blank space for notebook titles and section headings:
#
for titles##
for major headings###
for subheadings####
for 4th level subheadings
Emphasis
Use the following code to emphasize text:
- Bold text:
__string__
or**string**
- Italic text:
_string_
or*string*
Mathematical Symbols
Surround mathematical symbols with a dollar sign ($
), for example:
$ mathematical symbols $
Monospace Font
Surround text with a grave accent (`
), for example:
`string`
You can use the monospace font for file paths, file names, message text that users see, or text that users enter.
Line Breaks
To force a line break, use the following code:
<br>
Indenting
Use the greater than sign (>
) followed by a space, for example:
> Text that will be indented when the Markdown is rendered.
Any subsequent text is indented until the next carriage return.
Bullets
To create a circular bullet point, use one of the following methods. Each bullet point must be on its own line:
- A hyphen (
-
) followed by one or two spaces, for example:- Bulleted item
- A space, a hyphen (
-
) and a space, for example:- Bulleted item
- An asterisk (
*
) followed by one or two spaces, for example:* Bulleted item
To create a sub bullet, press Tab
before entering the bullet point using one of the methods described above. For example:
- Main bullet point
- Sub bullet point
Numbered Lists
To create a numbered list, enter 1.
followed by a space, for example:
1. Numbered item
1. Numbered item
For simplicity, you use 1.
before each entry. The list will be numbered correctly when you run the cell.
To create a substep, press Tab
before entering the numbered item, for example:
1. Numbered item
1. Substep
Colored Note Boxes
Use one of the following <div>
tags to display text in a colored box:
- Blue boxes (
alert-info
):<div class="alert alert-block alert-info"> <b>Tip:</b> Use blue boxes (alert-info) for tips and notes. If it’s a note, you don’t have to include the word “Note”. </div>
- Yellow boxes (
alert-warning
):<div class="alert alert-block alert-warning"> <b>Example:</b> Use yellow boxes for examples that are not inside code cells, or use for mathematical formulas if needed. </div>
- Green boxes (
alert-success
):<div class="alert alert-block alert-success"> <b>Up to you:</b> Use green boxes sparingly, and only for some specific purpose that the other boxes can't cover. For example, if you have a lot of related content to link to, maybe you decide to use green boxes for related links from each section of a notebook. </div>
- Red boxes (
alert-danger
):<div class="alert alert-block alert-danger"> <b>Just don't:</b> In general, avoid the red boxes. These should only be used for actions that might cause data loss or another major issue. </div>
Graphics
You can attach image files directly to a notebook in Markdown cells by dragging and dropping them into the cell.
To add images to other cell types, use graphics that are hosted on the web with this code, substituting url/name
with the full URL and name of the image:
<img src="url/filename.gif" alt="Alt text" title="Title text" />
Geometric Shapes
Use &#
followed by the decimal or hex reference number for the shape, for example:
&#reference_number
For a list of reference numbers, see UTF-8 Geometric shapes.
Horizontal Lines
On a new line, enter three asterisks:
***
Internal Links
To link to a section within your notebook, use the following code:
[Section title](#section-title)
For the text inside the parentheses, replace any spaces and special characters with a hyphen. For example, if your section is called Analyzing customer purchasing habits, you'd enter:
[Analyzing customer purchasing habits](#analyzing-customer-purchasing-habits)
Alternatively, you can add an ID above the section:
<a id="section_ID"></a>
To link to a section that has an ID, use the following code:
[Section title](#section_ID)
External Links
To link to an external site, use the following code:
__[link text](http://url)__
Surround the link with two underscores (_
) on each side.
Adding Tables
To add tables, use the following syntax:
| Column 1 | Column 2 |
|----------|----------|
| Row 1 | Data 1 |
| Row 2 | Data 2 |
Adding Code Blocks
To add code blocks, use triple backticks (```) before and after the block of code: ```python def example(): print("Hello, World!") ```
Adding Footnotes
To add footnotes, use the following syntax:
Here is a simple footnote[^1].
[^1]: This is the footnote.