Introduction
Markdown is a lightweight markup language that allows you to write documents using an easy-to-read and easy-to-write plain text format. This cheat sheet covers all Markdown syntax from basic to advanced, with practical examples. Whether you're new to Markdown or looking for a specific syntax reference, this guide has you covered.
Basic Syntax
Headings
Markdown supports six levels of headings, using the #
symbol:
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
You can also use underline style (only for levels 1 and 2):
Heading 1
=========
Heading 2
---------
Paragraphs and Line Breaks
Paragraphs are separated by blank lines. To create a line break without starting a new paragraph, add two spaces at the end of the line.
This is the first paragraph.
This is the second paragraph.
This is one line
This is the next line (note the two spaces at the end of the previous line)
Text Formatting
Style | Syntax | Example |
---|---|---|
Bold | **text** or __text__ |
bold text |
Italic | *text* or _text_ |
italic text |
Bold Italic | ***text*** or ___text___ |
bold italic text |
Strikethrough | ~~text~~ |
|
Underline | <u>text</u> |
underlined text |
Lists
Unordered Lists
Use -
, +
, or *
to create unordered lists:
- Item 1
- Item 2
- Subitem 2.1
- Subitem 2.2
- Item 3
+ You can also use plus signs
* Or asterisks
Ordered Lists
Use numbers followed by periods to create ordered lists:
1. First item
2. Second item
1. Subitem 2.1
2. Subitem 2.2
3. Third item
Task Lists
GitHub-style task lists:
- [x] Completed task
- [ ] Todo task
- [ ] Another todo task
Links
Inline Links
[Link text](https://www.example.com)
[Link with title](https://www.example.com "Link title")
Reference Links
[Link text][reference label]
[reference label]: https://www.example.com "Optional title"
Automatic Links
<https://www.example.com>
<[email protected]>
Images


Reference-style images:
![Alt text][image reference]
[image reference]: image-url "Optional title"
Blockquotes
> This is a blockquote
> It can span multiple lines
>
> > And can be nested
Code
Inline Code
Use `backticks` to surround inline code
Code Blocks
Use three backticks or indent with four spaces:
```javascript
function hello() {
console.log("Hello, World!");
}
```
Or use indentation (four spaces)
function hello() {
console.log("Hello, World!");
}
Horizontal Rules
Use three or more hyphens, asterisks, or underscores:
---
***
___
Advanced Syntax
Tables
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Data 1 | Data 2 | Data 3 |
| Data 4 | Data 5 | Data 6 |
Alignment:
| Left-aligned | Center | Right-aligned |
|:-------------|:------:|--------------:|
| Left | Center | Right |
Footnotes
Here's a footnote example[^1].
[^1]: This is the footnote content.
Definition Lists
Term 1
: Definition 1
Term 2
: Definition 2a
: Definition 2b
Abbreviations
HTML is Hyper Text Markup Language.
*[HTML]: Hyper Text Markup Language
GitHub Flavored Markdown (GFM)
Syntax Highlighting
Specify a language in code blocks:
```python
def hello():
print("Hello, World!")
```
```json
{
"name": "example",
"version": "1.1.0"
}
```
Emoji
:smile: :heart: :thumbsup: :star:
User Mentions and Issue References
@username
#123 (issue number)
organization/repository#123
HTML Support
Markdown supports inline HTML:
<div style="color: red;">
This is red text
</div>
<details>
<summary>Click to expand</summary>
Hidden content
</details>
Escaping Characters
Use backslash to escape special characters:
\* Not italic
\# Not a heading
\[Not a link\]
Characters that need escaping:
\ ` * _ {} [] () # + - . ! |
Best Practices
1. Maintain Consistency
- Choose one heading style and stick to it
- Use either
*
or-
consistently for lists - Keep indentation consistent (typically 2 or 4 spaces)
2. Prioritize Readability
- Add blank lines before and after headings
- Separate paragraphs with blank lines
- Avoid overly long lines (recommend 80-100 characters)
3. Use Semantic Markup
- Use headings hierarchically, don't skip levels
- Use appropriate markup (lists, quotes, etc.)
- Provide descriptive text for links and images
Common Mistakes
1. List Formatting Errors
Wrong:
-Item one (missing space)
- Item two
Correct:
- Item one
- Item two
2. Link Format Errors
Wrong:
(link text)[URL]
Correct:
[link text](URL)
3. Code Block Indentation
Wrong:
```
code
```
Correct:
```
code
```
Tools & Tips
Using MD-PDF-WORD
MD-PDF-WORD perfectly supports all these Markdown syntaxes and accurately converts them to PDF and Word formats:
- Preserves all formatting
- Renders tables correctly
- Supports code highlighting
- Handles typography properly
Shortcuts (Common Editors)
Function | Windows/Linux | Mac |
---|---|---|
Bold | Ctrl + B | Cmd + B |
Italic | Ctrl + I | Cmd + I |
Link | Ctrl + K | Cmd + K |
Code | Ctrl + ` | Cmd + ` |
Learning Resources
- Official Specification: Markdown Official Documentation
- GitHub Guide: GitHub Markdown Guide
- Interactive Tutorial: Markdown Tutorial
- Live Preview: Use MD-PDF-WORD's real-time preview feature
Conclusion
Mastering Markdown syntax enables you to create formatted documents more efficiently. From basic text formatting to advanced tables and code blocks, Markdown provides rich yet concise syntax. Combined with tools like MD-PDF-WORD, you can easily convert Markdown documents to professional PDF or Word formats, meeting various document needs.
Remember, Markdown's core philosophy is to let you focus on content rather than formatting. Choose the syntax you need, keep it simple, and make your documents both beautiful and maintainable.
Practice Markdown Now
Use the MD-PDF-WORD online editor to practice these syntaxes
Open Editor Install Extension