Here's a comprehensive breakdown
of Markdown syntax, organized by category.
## 1. Headers
```markdown
# H1
## H2
### H3
#### H4
##### H5
###### H6
```
**Alternative syntax (H1/H2 only):**
```markdown
H1 Header
=========
H2 Header
---------
```
## 2. Text Formatting
| Syntax | Result |
|---|---|
| `*italic*` or `_italic_` | *italic* |
| `**bold**` or `__bold__` | **bold** |
| `***bold italic***` | ***bold italic*** |
| `~~strikethrough~~` | ~~strikethrough~~ |
| `` `inline code` `` | `inline code` |
## 3. Lists
**Unordered:**
```markdown
- Item 1
- Item 2
- Nested item
* Item (asterisk also works)
+ Item (plus also works)
```
**Ordered:**
```markdown
1. First item
2. Second item
1. Nested item
3. Third item
```
**Task lists (GFM extension):**
```markdown
-
- [ ] Incomplete task
```
## 4. Links
```markdown
[Link text](
https://example.com)
[Link with title](
https://example.com "Title text")
<https://example.com> (auto-link)
[Reference link][1]
[1]:
https://example.com (reference definition)
```
## 5. Images
```markdown


```
## 6. Code Blocks
**Fenced code block (recommended):**
````markdown
```python
def hello():
print("Hello, world!")
```
````
**Indented code block (4 spaces):**
```markdown
def hello():
print("Hello, world!")
```
## 7. Blockquotes
```markdown
> This is a blockquote
>> Nested blockquote
> Multiple lines
> in same quote
```
## 8. Horizontal Rules
```markdown
---
***
___
```
(All three produce identical horizontal lines)
## 9. Tables (GFM extension)
```markdown
| Header 1 | Header 2 | Header 3 |
|----------|:--------:|---------:|
| Left | Center | Right |
| aligned | aligned | aligned |
```
**Alignment markers:**
- `:---` = left align
- `:---:` = center align
- `---:` = right align
## 10. Escaping Characters
```markdown
\* Not italic \*
\# Not a header
\[Not a link\]
```
Use backslash before: `\ ` `` ` `` `*` `_` `{ }` `[ ]` `( )` `#` `+` `-` `.` `!`
## 11. Line Breaks
```markdown
End line with two spaces
for a line break (no new paragraph)
Blank line
for a new paragraph
```
## 12. Footnotes (Extension, not universally supported)
```markdown
Here's a sentence with a footnote.[^1]
[^1]: This is the footnote content.
```
## 13. Definition Lists (Extension)
```markdown
Term
: Definition 1
: Definition 2
```
## 14. GitHub-Specific Extensions
**Mentions:**
```markdown
@username
```
**Issue/PR references:**
```markdown
#123
```
**Emoji:**
```markdown
:smile: :heart: :thumbsup:
```
**Syntax highlighting (language-specific):**
````markdown
```javascript
```
```bash
```
```json
```
````
## 15. HTML Embedding
Most Markdown flavors allow raw HTML:
```markdown
<div align="center">
Centered content
</div>
(manual line break)
<sub>subscript</sub>
<sup>superscript</sup>
```
## Quick Reference Table
| Element | Syntax |
|---|---|
| Header | `# H1` |
| Bold | `**text**` |
| Italic | `*text*` |
| Strikethrough | `~~text~~` |
| Link | `[text](url)` |
| Image | `` |
| Code | `` `code` `` |
| Code block | ` ```lang ` |
| Blockquote | `> text` |
| List (unordered) | `- item` |
| List (ordered) | `1. item` |
| Horizontal rule | `---` |
| Table | `\| col \|` |
| Task list | `- [
[...truncated: increase max_tokens...]