Markdown Cheatsheet
DevOps
markdowngfmwritingdocumentation
Markdown Cheatsheet
A quick reference for Markdown and GitHub Flavored Markdown (GFM).
Text Formatting
**bold** or __bold__
*italic* or _italic_
~~strikethrough~~
`inline code`
***bold and italic***
```text
**bold** or **bold**
*italic* or *italic*
~~strikethrough~~
`inline code`
***bold and italic***
## Headings
```markdown
# H1
## H2
### H3
#### H4
##### H5
###### H6
```text
## Links & Images
```markdown
[link text](https://example.com)
[link with title](https://example.com "Title")
[relative link](../other-file.md)



```text
[link text](https://example.com)

## Blockquotes
```markdown
> Single line quote
>
> > Nested quote
>
> **Formatted** text inside a quote
```text
> Single line quote
>
> > Nested quote
>
> **Formatted** text inside a quote
## Lists
### Unordered
```markdown
- Item
- Item
- Nested item
- Nested item
- Deeply nested
* Also works with asterisks
+ And plus signs
```text
- Item
- Item
- Nested item
- Nested item
- Deeply nested
### Ordered
```markdown
1. First
2. Second
3. Third
1. Nested (indented)
2. Still nested
```text
1. First
2. Second
3. Third
1. Nested (indented)
2. Still nested
### Mixed
```markdown
1. Step one
- Sub-point
- Another sub-point
2. Step two
> A note about step two
3. Step three
```text
1. Step one
- Sub-point
- Another sub-point
2. Step two
> A note about step two
3. Step three
## Task Lists (GFM)
```markdown
- [x] Completed task
- [x] Another completed task
- [ ] Pending task
- [ ] Blocked task
```text
- [x] Completed task
- [x] Another completed task
- [ ] Pending task
- [ ] Blocked task
## Code Blocks
### Fenced with Syntax Highlighting
````markdown
```python
def greet(name: str) -> str:
return f"Hello, {name}!"
print(greet("World"))
```text
def greet(name: str) -> str:
return f"Hello, {name}!"
print(greet("World"))
```text
### Inline Code
```markdown
Use `npm install` to install dependencies.
```text
Use `npm install` to install dependencies.
### Common Language Identifiers
| Language | Identifier |
| --- | --- |
| JavaScript | `js` or `javascript` |
| TypeScript | `ts` or `typescript` |
| Python | `python` or `py` |
| Bash | `bash` or `sh` |
| YAML | `yaml` or `yml` |
| JSON | `json` |
| SQL | `sql` |
| CSS | `css` |
| HTML | `html` |
| Dockerfile | `dockerfile` |
## Tables (GFM)
```markdown
| Header 1 | Header 2 | Header 3 |
| ---------- | ---------- | ---------- |
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
| Left-aligned | Center-aligned | Right-aligned |
| :------------- | :--------------: | --------------: |
| Left | Center | Right |
| L | C | R |
```text
| Header 1 | Header 2 | Header 3 |
| ---------- | ---------- | ---------- |
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
| Left-aligned | Center-aligned | Right-aligned |
| :------------- | :--------------: | --------------: |
| Left | Center | Right |
| L | C | R |
## Horizontal Rule
```markdown
---
***
___
```text
---
## Footnotes (GFM)
```markdown
Here is a statement that needs a citation[^1] and another one[^2].
[^1]: This is the first footnote.
[^2]: This is the second footnote with **formatting**.
```text
Here is a statement that needs a citation[^1] and another one[^2].
[^1]: This is the first footnote.
[^2]: This is the second footnote with **formatting**.
## Definition Lists (GFM)
```markdown
Term 1
: Definition of term 1
Term 2
: Definition of term 2
: Another definition for term 2
```text
Term 1
: Definition of term 1
Term 2
: Definition of term 2
: Another definition for term 2
## Escaping
```markdown
\*not italic\*
\# not a heading
\[not a link\]
\`not code\`
```text
\*not italic\*
## Keyboard Keys (GFM)
```markdown
Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.
Press <kbd>Alt</kbd> + <kbd>F4</kbd> to close.
```text
Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.
Press <kbd>Alt</kbd> + <kbd>F4</kbd> to close.
## Alerts / Admonitions (GFM)
```markdown
> [!NOTE]
> Useful information.
> [!TIP]
> Helpful suggestion.
> [!IMPORTANT]
> Key information.
> [!WARNING]
> Cautionary advice.
> [!CAUTION]
> Potential danger.
```text
> [!NOTE]
> Useful information.
> [!TIP]
> Helpful suggestion.
> [!IMPORTANT]
> Key information.
> [!WARNING]
> Cautionary advice.
> [!CAUTION]
> Potential danger.
## URLs & Autolinks
```markdown
<https://example.com>
<user@example.com>
```text
<https://example.com>
<user@example.com>
## Emojis (GFM)
```markdown
:thumbsup: :rocket: :warning: :check_mark:
```text
:thumbsup: :rocket: :warning: :check_mark:
## Math (where supported)
```markdown
Inline: $E = mc^2$
Block:
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
```text
Inline: $E = mc^2$
Block:
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
## Mermaid Diagrams (where supported)
````markdown
```mermaid
graph LR
A[Start] --> B{Decision}
B --> | Yes | C[Action]
B --> | No | D[End]
C --> D
```text
graph LR
A[Start] --> B{Decision}
B --> | Yes | C[Action]
B --> | No | D[End]
C --> D
```text
## HTML in Markdown
Most Markdown processors allow inline HTML:
```markdown
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>
<sup>superscript</sup> and <sub>subscript</sub>
<br>
<div align="center">
Centered content
</div>
```text
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>
<sup>superscript</sup> and <sub>subscript</sub>