Markdown cheat sheet
GitHub Flavored Markdown on one page. Every entry shows the syntax and how it renders. Try anything live in the editor, where typing / inserts most of these for you.
Headings
# Heading 1 ## Heading 2 ### Heading 3 #### Heading 4
Heading 1
Heading 2
Heading 3
Heading 4
Emphasis
**bold** *italic* ***both*** ~~strikethrough~~ `inline code` <u>underline</u> H<sub>2</sub>O x<sup>2</sup> <kbd>Ctrl</kbd> + <kbd>C</kbd> <mark>highlight</mark>
bold italic bothstrikethrough inline code
underline H2O x2
Ctrl + C highlight
Lists
- Bullet item - Another item - Nested with two spaces 1. First 2. Second 1. Nested numbered
- Bullet item
- Another item
- Nested with two spaces
- First
- Second
- Nested numbered
Task lists
- [x] Done - [ ] To do - [ ] Another task
- Done
- To do
- Another task
Links and images
[Link text](https://example.com) [With title](https://example.com "Tooltip") <https://autolink.example>  [](#)
Code
Inline `code` in a sentence.
```python
def greet(name):
return f"Hello, {name}"
```
```bash
npm install && npm test
```
Inline code in a sentence.
def greet(name):
return f"Hello, {name}"Tables
| Left | Center | Right | | :--- | :----: | ----: | | a | b | 1 | | c | d | 22 |
| Left | Center | Right |
|---|---|---|
| a | b | 1 |
| c | d | 22 |
Build one visually with the table generator.
Quotes and callouts
> A quoted paragraph. > > > Nested quote. > [!NOTE] > Useful information. > [!WARNING] > Something to be careful about.
A quoted paragraph.Nested quote.
Types: NOTE, TIP, IMPORTANT, WARNING, CAUTION.
Line breaks and rules
Two trailing spaces
force a line break.
Or end with a backslash\
for the same effect.
A blank line starts a new paragraph.
---
Two trailing spaces
force a line break.
Or end with a backslash
for the same effect.
A blank line starts a new paragraph.
The dotted marks show the two spaces; they are copied with the example.
Footnotes
A claim that needs a source.[^1] [^1]: The source, with a [link](https://example.com).
A claim that needs a source.1
1. The source, with a link. ↩
Collapsible sections
<details> <summary>Click to expand</summary> Hidden content, with **Markdown** inside. </details>
Click to expand
Hidden content, with Markdown inside.
Leave blank lines around the content so the Markdown inside renders.
Math (LaTeX)
Inline: $E = mc^2$ Display: $$ \int_a^b f(x)\,dx = F(b) - F(a) $$
Inline: E = mc2
∫ab f(x) dx = F(b) − F(a)
Rendered with KaTeX in MeowMD and natively on GitHub.
Diagrams (Mermaid)
```mermaid
graph LR
A[Write] --> B{Review}
B -->|OK| C[Merge]
B -->|Changes| A
```
```mermaid
sequenceDiagram
Client->>Server: GET /docs
Server-->>Client: 200 OK
```
Flowcharts, sequence diagrams, Gantt charts, class and state diagrams, all from text. MeowMD also renders chart blocks (JSON) as bar, line and pie charts and csv blocks as tables.
Escaping characters
\*not italic\* \# not a heading 1\. not a list Pipe in a table cell: \| Backtick: \`
*not italic*
# not a heading
1. not a list
Pipe in a table cell: |
Backtick: `
Inline HTML
<div align="center"> ## Centered heading </div> <img src="logo.png" width="120"> <br> <!-- a comment that does not render -->
Centered heading
Use HTML for width, alignment and comments. Keep blank lines around block tags so Markdown inside still renders.
Frequently asked
How do I make a line break?
End a line with two spaces or a backslash, or leave a blank line to start a new paragraph. A single newline inside a paragraph is ignored by most renderers.
How do I write a table?
Separate cells with pipes and add a separator row of dashes under the header. Colons in the separator row align the column: :--- left, :---: center, ---: right.
How do I add a note or warning box on GitHub?
Start a blockquote with [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] or [!CAUTION] on its own line. GitHub renders it as a coloured callout.
Can Markdown render math and diagrams?
On GitHub and in MeowMD, yes. Wrap LaTeX in $ for inline math or $$ for display math, and put Mermaid code in a fenced block tagged mermaid.