Introduction to Markdown
Markdown is a lightweight markup language with plain-text formatting syntax. Its design allows it to be converted to many output formats, but it’s most commonly used to generate HTML. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.
Basics of Markdown Syntax
Headings
Headings are created by adding one or more #
symbols before your heading text. The number of #
you use will determine the size of the heading.
1
2
3
4
5
6
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
Emphasis
You can emphasize text using either *
or _
.
1
2
3
*italic* or _italic_
**bold** or __bold__
***bold and italic*** or ___bold and italic___
Lists
Unordered Lists
Unordered lists are created using *
, +
, or -
.
1
2
3
4
* Item 1
* Item 2
* Subitem 2a
* Subitem 2b
Ordered Lists
Ordered lists are created with numbers.
1
2
3
1. First Item
2. Second Item
3. Third Item
Links
Links are created using the following syntax: [link text](URL)
1
[Google](https://www.google.com)
Images
Images are similar to links, but they include a preceding exclamation mark.
1
![alt text](image.jpg)
Code
For inline code, wrap the text in backticks. For code blocks, use triple backticks or indent with four spaces.
1
`inline code`
code blocks:
1
2
3
```python
print('Hello, world!')
```/
without the /
Blockquotes
Blockquotes are created using >
.
1
> This is a blockquote.
Horizontal Rules
Horizontal rules are created using three or more -
, *
, or _
.
1
2
3
4
5
---
* * *
___
Advanced Markdown Elements
Tables
Tables are created using -
for dividing lines and |
for columns.
1
2
3
4
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Row 1 | Data | Data |
| Row 2 | Data | Data |
Fenced Code Blocks
Fenced code blocks are surrounded by triple backticks and can include a language identifier for syntax highlighting.
1
2
```python
print("Hello, world!")
1
2
3
4
5
6
7
### Task Lists
Task lists are lists with checkboxes. They're created by including brackets with a space or an `x`.
```markdown
- [x] Completed task
- [ ] Incomplete task
Footnotes
Footnotes are created by including a caret (^
) followed by a bracketed identifier.
1
2
3
Here's a sentence with a footnote. [^1]
[^1]: This is the footnote.
Strikethrough
Strikethrough text is created using double tildes.
1
~~This text is crossed out.~~
Emojis
Emojis can be added using emoji codes.
1
:smile: :heart: :+1: