MakeMyTxt
← Back to blog

Markdown Cheat Sheet 2026

·7 min read

Markdown is a plain-text formatting syntax created by John Gruber and Aaron Swartz in 2004. The original idea was simple: write in a format that looks readable as-is, then convert it to HTML when you need to publish. Two decades later, Markdown is everywhere — GitHub READMEs, Notion, Obsidian, Slack messages, Jupyter notebooks, static site generators, documentation systems, and most developer tools. The syntax is small enough to memorize, but the edge cases and flavor differences trip people up. This is a complete reference.

Headings

Prefix a line with # characters. One hash is an h1, two is an h2, and so on through h6. Always put a space after the hashes.

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

Gruber’s original spec also supports underline-style headings using === for h1 and --- for h2 on the line below the text. Most people avoid this style because it only covers two levels and is harder to scan in a long document.

Emphasis and Inline Formatting

*italic* or _italic_
**bold** or __bold__
***bold italic*** or ___bold italic___
~~strikethrough~~       (GFM extension)
`inline code`

The asterisk variants are more common than underscores in practice. Underscores can cause trouble inside words — some_variable_name should not be partially italicized, and most parsers handle this correctly now, but asterisks avoid the ambiguity entirely.

Links and Images

[Link text](https://example.com)
[Link with title](https://example.com "Hover text")

![Alt text](image.png)
![Alt text](image.png "Image title")

[Reference-style link][1]
[1]: https://example.com

Reference-style links keep the text readable when you have many URLs. The reference label goes in square brackets, and the URL definition can live anywhere in the document — usually at the bottom. Images use the same syntax with a leading !.

Lists

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

Ordered:
1. First
2. Second
3. Third

Mixed nesting:
1. First
   - Sub-bullet
   - Another
2. Second

You can use -, *, or +for unordered list markers. Pick one and be consistent. For ordered lists, the actual numbers you type do not matter to most renderers — 1. 1. 1. will render as 1, 2, 3. But sequential numbering makes the raw text easier to read, and some tools (notably CommonMark-strict parsers) use the first number to determine the start value.

Indentation for nested items is two or four spaces depending on the flavor. GitHub uses two. CommonMark requires that the content aligns with the first character of the parent item’s text, which works out to three spaces for - markers and four for 1. markers.

Code

Inline code uses single backticks: `variable`. For blocks, use triple backticks (fenced code blocks) with an optional language identifier:

```javascript
function greet(name) {
  return `Hello, ${name}`;
}
```

```python
def greet(name):
    return f"Hello, {name}"
```

```sql
SELECT * FROM users WHERE active = true;
```

The language hint after the opening backticks enables syntax highlighting in renderers that support it (GitHub, VS Code preview, most static site generators). Common identifiers: javascript, typescript, python, rust, sql, bash, json, css, html, go, java, ruby, yaml, diff.

You can also indent code by four spaces instead of using fences. This is the original Markdown syntax for code blocks. Fenced blocks are preferred now because they support language hints and do not require you to indent every line.

Blockquotes

> This is a blockquote.
> It can span multiple lines.
>
> It can contain **formatting** and even other elements.
>
> > Nested blockquotes work too.

Prefix each line with >. You can nest blockquotes by stacking > characters. Some people use blockquotes for callouts or admonitions, though GitHub has its own alert syntax (> [!NOTE], > [!WARNING]) for that purpose.

Tables

| Column A | Column B | Column C |
|----------|:--------:|---------:|
| Left     | Center   |    Right |
| default  | aligned  |  aligned |

The second row is the alignment row. Colons on the left mean left-aligned (default), on both sides means centered, on the right means right-aligned. Tables are not part of the original Markdown spec — they come from PHP Markdown Extra and were adopted by GitHub Flavored Markdown (GFM). Pipes do not need to align visually, but aligning them makes the raw text readable.

Task Lists

- [x] Completed task
- [ ] Incomplete task
- [ ] Another pending item

Task lists are a GFM extension. They render as checkboxes on GitHub and in most modern Markdown editors. The [x] marker is case-insensitive in some parsers, but lowercase x is the convention.

Horizontal Rules

---
***
___

Three or more hyphens, asterisks, or underscores on their own line produce a horizontal rule. All three variants produce identical output. Hyphens are most common. Be careful with --- directly below a line of text — some parsers will interpret it as an underline-style h2 heading instead of a horizontal rule. Add a blank line above the rule to be safe.

Escape Characters

Backslash escapes any Markdown-special character:

\*not italic\*
\# not a heading
\[not a link\](url)
\`not code\`

Characters you might need to escape: \ ` * _ { } [ ] ( ) # + - . ! |.

HTML in Markdown

Markdown allows raw HTML inline. This is useful for things Markdown cannot express: <details> collapsible sections, <sup> superscripts, <kbd> keyboard keys, or custom <div> wrappers with classes.

<details>
<summary>Click to expand</summary>

Hidden content goes here. Markdown **works** inside the block
as long as there's a blank line after the opening HTML tag.

</details>

Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.

Most Markdown processors pass HTML through untouched. GitHub sanitizes HTML and strips potentially dangerous tags like <script> and <style>.

Flavor Differences: CommonMark vs GFM vs Others

Gruber’s original spec was intentionally vague. Different implementations made different choices about edge cases, leading to a fragmentation problem. CommonMark, released in 2014, is a strict specification that resolves the ambiguities. It defines exact behavior for every edge case — how many spaces constitute indentation, when a blank line breaks a list, how nested emphasis is parsed.

GitHub Flavored Markdown (GFM) is a superset of CommonMark. It adds tables, task lists, strikethrough (~~text~~), autolinked URLs (plain URLs become clickable without brackets), and alert blocks. GFM is what you write in GitHub issues, PRs, and README files.

MultiMarkdown adds footnotes ([^1] with [^1]: footnote text at the bottom), definition lists, citations, and math support. Obsidian uses its own extended flavor with [[wikilinks]], ==highlights==, and callout blocks. Pandoc has the widest feature set, adding footnotes, definition lists, citation syntax, YAML front matter, and cross-references.

The practical advice: write CommonMark-compatible Markdown as your baseline. Use GFM extensions (tables, task lists, strikethrough) freely — they are supported nearly everywhere. Use tool-specific extensions (wikilinks, footnotes) only when you know your target renderer supports them.

Writing Markdown Faster

VS Code with the built-in Markdown preview (Ctrl+Shift+V or Cmd+Shift+V) gives you side-by-side editing. The Markdown All in One extension adds keyboard shortcuts for bold (Ctrl+B), italic (Ctrl+I), and toggling task list checkboxes.

Obsidian and Typora render Markdown inline as you type, so you see the formatted output without a separate preview pane. This works well for notes and long-form writing. For technical docs with lots of code blocks, a split-pane editor is usually better because inline rendering can obscure the raw syntax.

On GitHub, you can drag and drop images directly into a comment or issue body — GitHub uploads them and inserts the Markdown image syntax automatically. The / key in the GitHub web editor opens a slash command menu for inserting code blocks, tables, and task lists without typing the syntax from memory.

For quick previewing without installing anything, paste your Markdown into a browser-based Markdown previewer to see the rendered output instantly. No account, no upload — paste, preview, done.

Markdown’s power is its simplicity. A dozen symbols cover 90% of formatting needs. Learn the basics in this reference, keep it bookmarked for the table alignment syntax you always forget, and you will never need to reach for a rich text editor again.

Try it yourself

Use our free Markdown Previewer — runs entirely in your browser, no sign-up required.