17 Nov 2023
Markdown is a lightweight markup language that you can use to add formatting elements to plain text documents. It's widely used for creating documents that can be easily converted to HTML. Here's a comprehensive Markdown guide with explanations:
Headers
# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6
Headers are created using the # symbol. The number of # symbols indicates the level of the header.
Emphasis
*italic* or _italic_
**bold** or __bold__
You can create italic text by enclosing the text in either single or double asterisks (*), and bold text by enclosing it in double asterisks (**).
Lists
Unordered List
- Item 1
- Item 2
- Subitem 2.1
- Subitem 2.2
* Item 3
Create an unordered list using - or * followed by a space.
Ordered List
1. Item 1
2. Item 2
1. Subitem 2.1
2. Subitem 2.2
3. Item 3
Create an ordered list using numbers followed by a period and a space.
Links
[Link Text](URL)
Create a hyperlink using square brackets for the link text followed by parentheses containing the URL.
Images

Insert images using an exclamation mark, square brackets for alt text, and parentheses containing the image URL.
- Similar to links, but with an exclamation mark in front.
- Replace "Alt Text" with a description of the image.
- Replace "ImageURL" with the actual URL of the image.
Blockquotes
> This is a blockquote.
- Use the greater-than symbol (
>) to create a blockquote.
Code
Inline Code
`inline code`
Enclose inline code in backticks.
Code Blocks
```python
def example():
print("Hello, World!")
Create code blocks by wrapping the code in triple backticks.
```
```
You can specify the language for syntax highlighting after the opening backticks.
Read more: πCode syntax highlighting in Markdown
Horizontal Rule
---
Insert a horizontal rule with three consecutive hyphens, underscores, or asterisks.
Tables
Markdown tables are created using a combination of vertical bars | and hyphens - to define the structure of the table.
Here's a basic example of a Markdown table:
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Row 1 | Data 1 | Data 2 |
| Row 2 | Data 3 | Data 4 |
Markdown table output:
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Row 1 | Data 1 | Data 2 |
| Row 2 | Data 3 | Data 4 |
This Markdown code will produce a simple table with three columns and two rows.
Markdown Table Syntax:
- Each row of the table is represented by a new line.
- Columns are separated by vertical bars
|. - The first row typically contains column headers, which are separated from the rest of the rows by a line containing hyphens
-. - Alignment of columns can be specified by using colons
:within the header separator line.- A colon on the left indicates left alignment.
- A colon on the right indicates right alignment.
- Colons on both sides indicate center alignment.
Example of Column Alignment:
| Left-aligned | Center-aligned | Right-aligned |
|:-------------|:--------------:|--------------:|
| Data 1 | Data 2 | Data 3 |
| More data | Even more | Final |
Markdown table output:
| Left-aligned | Center-aligned | Right-aligned |
|---|---|---|
| Data 1 | Data 2 | Data 3 |
| More data | Even more | Final |
Create tables using pipe (|) separators and hyphens for the header.
Escaping Characters
\*escaped\*
Escape characters with a backslash to display them as regular characters.
Footnotes
Here is a sentence with a footnote[^1].
[^1]: This is the footnote text.
Create footnotes using square brackets and a caret (^) followed by the footnote number.
Strikethrough
~~Strikethrough~~
Use two tilde symbols (~~) to create strikethrough text.
Emoji
π‘πππβ
β
You can add any emojis to your Markdown documents using emoji codes.
Suppression of Markdown Elements
\*This will not be italic\*
Use a backslash to escape Markdown characters and prevent them from being treated as formatting.