Skip to content

Markdown Basic Syntax

Markdown's basic syntax is simple and easy to learn. This chapter introduces the most commonly used core syntax, allowing you to quickly master the basics of Markdown.

Paragraphs and Line Breaks

Paragraphs

Separate paragraphs with blank lines:

markdown
This is the first paragraph.

This is the second paragraph.

Result:

This is the first paragraph.

This is the second paragraph.

Line Breaks

Add two spaces at the end of a line or use the <br> tag:

markdown
First line
Second line

Result:

First line Second line

Headings

Use # symbols to create headings, supporting levels 1-6:

markdown
# Level 1 Heading
## Level 2 Heading
### Level 3 Heading
#### Level 4 Heading
##### Level 5 Heading
###### Level 6 Heading

Result:

Level 1 Heading

Level 2 Heading

Level 3 Heading

Level 4 Heading

Level 5 Heading
Level 6 Heading

Text Styling

Bold

Use ** or __ to surround text:

markdown
**This is bold text**
__This is also bold text__

Result: This is bold text

Italic

Use * or _ to surround text:

markdown
*This is italic text*
_This is also italic text_

Result: This is italic text

Bold and Italic

Use *** or ___ to surround text:

markdown
***This is bold and italic text***
___This is also bold and italic text___

Result: This is bold and italic text

Strikethrough

Use ~~ to surround text:

markdown
~~This is strikethrough text~~

Result: This is strikethrough text

Lists

Unordered Lists

Use -, +, or * to create:

markdown
- Item one
- Item two
- Item three

Result:

  • Item one
  • Item two
  • Item three

Ordered Lists

Use numbers followed by . to create:

markdown
1. First item
2. Second item
3. Third item

Result:

  1. First item
  2. Second item
  3. Third item

Nested Lists

Use indentation to create nesting:

markdown
- Main item
  - Sub-item 1
  - Sub-item 2
    - Sub-sub-item

Result:

  • Main item
    • Sub-item 1
    • Sub-item 2
      • Sub-sub-item
markdown
[Link text](https://example.com)
[Link with title](https://example.com "Title shown on hover")

Result: Link text

markdown
[Link text][ref]

[ref]: https://example.com "Optional title"
markdown
<https://example.com>
<email@example.com>

Result: https://example.com

Images

Basic Syntax

markdown
![Alt text](Image URL)
![Image with title](Image URL "Image title")

Reference-style Images

markdown
![Alt text][img-ref]

[img-ref]: Image URL "Optional title"

Blockquotes

Use > to create blockquotes:

markdown
> This is a blockquote.
> It can have multiple lines.

Result:

This is a blockquote. It can have multiple lines.

Nested Blockquotes

markdown
> First level quote
>> Second level quote
>>> Third level quote

Result:

First level quote

Second level quote

Third level quote

Code

Inline Code

Use backticks ` to surround:

markdown
This is an `inline code` example.

Result: This is an inline code example.

Code Blocks

Use three backticks ``` to create:

markdown

This is a code block Can have multiple lines

Code Blocks with Syntax Highlighting

markdown
```python
def hello():
    print("Hello, World!")

**Result:**

```python
def hello():
    print("Hello, World!")

Horizontal Rules

Use three or more -, *, or _:

markdown
---
***
___

Result:


Tables

Use | and - to create tables:

markdown
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Content 1 | Content 2 | Content 3 |
| Content 4 | Content 5 | Content 6 |

Result:

Column 1Column 2Column 3
Content 1Content 2Content 3
Content 4Content 5Content 6

Alignment

markdown
| Left-aligned | Center-aligned | Right-aligned |
|:------------|:--------------:|--------------:|
| Left | Center | Right |

Result:

Left-alignedCenter-alignedRight-aligned
LeftCenterRight

Escaping Characters

Use backslash \ to escape special characters:

markdown
\* This is not italic \*
\# This is not a heading

Result: * This is not italic *

Characters That Need Escaping

\   Backslash
`   Backtick
*   Asterisk
_   Underscore
{}  Curly braces
[]  Square brackets
()  Parentheses
#   Hash mark
+   Plus sign
-   Hyphen
.   Period
!   Exclamation mark

Task Lists

Use - [ ] and - [x] to create:

markdown
- [x] Completed task
- [ ] Incomplete task
- [ ] Another task

Result:

  • [x] Completed task
  • [ ] Incomplete task
  • [ ] Another task

Footnotes

markdown
This is some text[^1].

[^1]: This is the footnote content.

HTML Tags

Markdown supports inline HTML:

markdown
<div style="color: red;">
This is red text
</div>

<kbd>Ctrl</kbd> + <kbd>C</kbd>

Result:

Ctrl + C

Common HTML Tags

Text Color

html
<span style="color: red;">Red text</span>
<span style="color: blue;">Blue text</span>

Text Alignment

html
<center>Centered text</center>
<div align="right">Right-aligned text</div>

Superscript and Subscript

html
H<sub>2</sub>O
X<sup>2</sup>

Result: H2O, X2

Comments

Comments in Markdown are not displayed:

markdown
<!-- This is a comment and will not be shown on the page -->

Quick Reference Table

ElementSyntax
Headings# H1 ## H2 ### H3
Bold**bold**
Italic*italic*
Blockquote> quote
Ordered List1. item
Unordered List- item
Code`code`
Horizontal Rule---
Link[text](URL)
Image![alt](URL)

Practice Exercise

Try creating a document with the following elements:

  1. A level 1 heading
  2. An introduction paragraph (including bold and italic)
  3. An unordered list
  4. An ordered list
  5. A blockquote
  6. A code block
  7. A link
  8. A table

Summary

This chapter introduced Markdown's basic syntax, including:

  • Headings and paragraphs
  • Text formatting (bold, italic, strikethrough)
  • Lists (ordered, unordered, nested)
  • Links and images
  • Blockquotes and code
  • Tables and horizontal rules

After mastering these basic syntax elements, you can start using Markdown for daily writing. Next, we will dive deeper into each syntax's detailed usage.

Next: Learn more about Markdown Headings.

Content is for learning and research only.