Module 5 of 13 · Jupyter Notebooks · Beginner

Markdown and Text Formatting

Duration: 5 min

This module delves into the essential skill of Markdown and text formatting within Jupyter Notebooks. Understanding how to format text effectively not only enhances the readability of your notebooks but also aids in better communication of your findings and code. Proper formatting is crucial for creating professional and well-structured documents.

Basic Markdown Syntax

Markdown is a lightweight markup language that allows you to format text using simple syntax. In Jupyter Notebooks, Markdown cells are used to add headers, paragraphs, lists, and other formatted text. This makes your notebooks more readable and visually appealing. For example, you can create headers by prefixing lines with '#' symbols, and paragraphs by leaving a blank line between text blocks.

# This is a Markdown cell in a Jupyter Notebook

# Header 1
##
This is a header 1

# Header 2
##
## This is a header 2

# Paragraphs

This is a paragraph.

This is another paragraph with a blank line between them.

Try it in Google Colab: Open in Colab

Header 1
This is a header 1

Header 2
This is a header 2

This is a paragraph.

This is another paragraph with a blank line between them.

Advanced Markdown Features

Beyond basic formatting, Markdown supports more advanced features like lists, links, images, and code blocks. Lists can be unordered (using '-' or '*') or ordered (using numbers). Links and images can be added using the syntax [text](URL) and ![alt text](URL) respectively. Code blocks can be added using triple backticks (```).

# Unordered List
#- Item 1
#- Item 2
#
# Ordered List
#1. First Item
#2. Second Item

# Link
#This is a [link](https://www.example.com)

# Image
#![Image](https://www.example.com/image.jpg)

# Code Block
#```python
#def hello_world():
#    print('Hello, world!')
#```

💡 Tip: When writing Markdown, always ensure that your cells are properly formatted to avoid rendering issues. For example, make sure there are no extra spaces before Markdown symbols like '#' for headers.

❓ What is the correct syntax to create a header 1 in Markdown?

❓ How do you create an unordered list item in Markdown?

← Previous Continue interactively → Next →

Related Courses