Markdown Syntax Cheat Sheet

New

Complete Markdown reference: headings, lists, links, code blocks, tables, and GitHub Flavored Markdown

Headings

Heading Levels

Use # through ###### for H1 to H6

# H1 Heading ## H2 Heading ### H3 Heading #### H4 Heading ##### H5 Heading ###### H6 Heading

Emphasis

Bold & Italic

Wrap text with * or _ for emphasis

**bold text** *italic text* ***bold and italic*** ~~strikethrough~~

Lists

Unordered List

Use -, *, or + for bullet points

- Item one - Item two - Nested item - Another nested - Item three

Ordered List

Use numbers followed by a period

1. First item 2. Second item 1. Nested item 2. Another nested 3. Third item

Task Lists (GFM)

GitHub Flavored Markdown checkboxes

- [x] Completed task - [ ] Pending task - [x] Another done task

Links & Images

Links

Inline links and reference-style links

[Link text](https://example.com) [Link with title](https://example.com "Title") <https://example.com> <!-- auto-link -->

Images

Embed images (alt text is required for accessibility)

![Alt text](image.png) ![Alt text](https://example.com/img.png "Optional title")

Code

Inline Code

Wrap with single backtick for inline code

Use `const x = 5` in JavaScript.

Fenced Code Block

Triple backticks with optional language for syntax highlighting

```javascript function hello(name) { console.log(`Hello, ${name}!`); } ``` ```python def hello(name: str): print(f"Hello, {name}!") ```

Blockquotes & Rules

Blockquotes

Prefix lines with > for quoted content

> This is a blockquote. > It can span multiple lines. > > > Nested blockquote

Horizontal Rule

Three or more dashes, asterisks, or underscores

--- *** ___

Tables (GFM)

Tables

Use pipes and dashes to create tables. Colon controls alignment.

| Name | Age | Role | |---------|-----|----------:| | Alice | 30 | Engineer | | Bob | 25 | Designer | # Alignment: |:--- | left |---: | right |:---:| center

GitHub Flavored Markdown

Mentions & References

GitHub-specific features

@username # mention a user #123 # link to issue/PR SHA-hash # link to commit

Collapsible Sections

Hide long content in a collapsible block

<details> <summary>Click to expand</summary> Hidden content here. </details>

Common Patterns

README Structure

Standard README.md layout for an open source project

# Project Name

> One-line description of what the project does.

## Features
- Feature one
- Feature two

## Installation
```bash
npm install my-package
```

## Usage
```javascript
const pkg = require("my-package");
pkg.doSomething();
```

## API

| Method | Description |
|--------|-------------|
| `foo()`  | Does foo     |
| `bar()`  | Does bar     |

## License
MIT

GitHub PR Template

.github/PULL_REQUEST_TEMPLATE.md

## Summary
<!-- What does this PR do? -->

## Changes
- [ ] Feature: added X
- [ ] Fix: resolved Y
- [ ] Refactor: cleaned up Z

## Testing
- [ ] Unit tests pass
- [ ] Manual testing done
- [ ] Screenshot attached (if UI change)

## Related Issues
Closes #123

Documentation Page

Structured documentation with sections and code examples

# API Reference

## Authentication

All requests require a Bearer token:

```http
Authorization: Bearer <your-token>
```

## Endpoints

### Get User

```http
GET /api/users/:id
```

**Parameters:**

| Name | Type   | Description |
|------|--------|-------------|
| id   | string | User ID     |

**Response:**

```json
{
  "id": "123",
  "name": "Alice"
}
```

> **Note:** Returns 404 if user is not found.

Tips & Best Practices

Leave blank lines between block elements (headings, paragraphs, code blocks) to ensure correct rendering

Always specify the language in fenced code blocks (```js) for proper syntax highlighting

Preview your Markdown before committing — VS Code has built-in preview with Cmd+Shift+V

Use reference-style links for long URLs to keep prose readable

Two trailing spaces at end of a line create a line break without a new paragraph