Markdown is a lightweight plain-text syntax for writing formatted documents: # for headings, ** for bold, - for lists, and backticks for code. Created in 2004 so writers could produce clean HTML without typing angle brackets, it now powers GitHub READMEs, pull requests, technical docs, Notion, Obsidian, Discord, Slack, Reddit, and static-site generators. Because Markdown files are plain UTF-8 text, they diff cleanly in Git and stay readable decades later in any editor. This cheat sheet covers every element you need daily, the differences between CommonMark and GitHub Flavored Markdown (GFM), and the subtle syntax traps that break rendering.

Headings and paragraphs

# Heading 1 (page title — use once per document)
## Heading 2 (major section)
### Heading 3 (subsection)
#### Heading 4

A paragraph is one or more consecutive lines of text.
Leave a blank line to start a new paragraph.

Always put a space after the # symbols: #Heading fails in strict CommonMark parsers. Inside a paragraph, a single Enter key is normally collapsed into a space (soft break); end a line with two trailing spaces or a backslash (\) when you want a hard line break (<br>) without starting a new paragraph.

Inline emphasis and code

SyntaxRendered outputNotes
*italic* or _italic_italicPrefer * inside words; foo_bar_baz stays literal in CommonMark
**bold** or __bold__boldCombine as ***bold italic***
~~removed~~removedGitHub Flavored Markdown (GFM) extension
`inline code`inline codeUse double backticks to show a literal backtick: ``a ` b``
\*literal\**literal*Backslash escapes any ASCII punctuation character

Lists and task lists

- Unordered item (you can also use * or +)
- Second item
  - Nested item (indent by 2 or 4 spaces consistently)
    - Third level

1. First step
2. Second step
   Continuation paragraph aligned under the text (3 spaces).
3. Third step

- [x] Write unit tests      (GFM task list)
- [ ] Run production build

In ordered lists, Markdown renumbers items automatically in HTML, so writing 1. on every line still renders as 1, 2, 3 — a popular trick for keeping Git diffs clean when inserting a step in the middle of a long list.

[SnipFerry guides](https://snipferry.com/guides)
[Link with hover title](https://snipferry.com "SnipFerry home")
[Relative link](../docs/setup.md)
<https://example.com>

![Sales by region bar chart](images/sales-chart.png)

<!-- Reference-style links keep prose uncluttered -->
Read the [CSV guide][csv] and [SQL guide][sql] before importing.

[csv]: /guides/how-to-clean-messy-csv-data
[sql]: /guides/how-to-query-csv-files-with-sql

Write descriptive alt text inside ![…] describing what the image communicates, not just “screenshot” or “image.png”. Screen-reader users hear that text, and search engines use it to understand the graphic. Avoid spaces in URLs or wrap the URL in angle brackets: [Report](<Q1 Report.pdf>).

Code blocks and syntax highlighting

```javascript
const total = items.reduce((sum, item) => sum + item.price, 0);
console.log(total);
```

````markdown
Use four backticks when your code block itself contains triple backticks:
```sql
SELECT * FROM orders;
```
````

Adding an info string right after the opening fence (js, ts, python, sql, bash, json, yaml, diff) enables syntax highlighting on GitHub, GitLab, and docs sites. Use diff with leading + and - lines to show before/after changes cleanly in PR descriptions.

Blockquotes, callouts, and horizontal rules

> A blockquote can span multiple lines.
>
> Add a bare > to keep two paragraphs inside the same quote.

> [!NOTE]
> GitHub-style alert boxes support NOTE, TIP, IMPORTANT, WARNING, and CAUTION.

---

Horizontal rules use three or more hyphens (---), asterisks (***), or underscores (___) on a line by themselves — leave a blank line above --- so it is not parsed as an underline for a Setext heading.

Tables (GitHub Flavored Markdown)

| Region | Orders | Revenue |
|:-------|-------:|--------:|
| North  |    120 |  48,000 |
| South  |     98 |  39,200 |
| East   |     74 |  29,600 |

The second line defines column alignment: :--- left, ---: right (best for numbers), and :---: centred. You must include at least one pipe (|) and three hyphens per column in the separator row. To include a literal pipe inside a cell, escape it as \|. Building aligned tables manually is slow — paste spreadsheet rows into CSV to Markdown Table to generate padded Markdown instantly, or extract an existing table back into Excel with Markdown Table to CSV.

Markdown flavours compared

FeatureOriginal (2004)CommonMarkGFM (GitHub)Obsidian / Docs
Headings, lists, links, blockquotesYesYesYesYes
Fenced code blocks (```)NoYesYesYes
Tables, task lists, strikethroughNoNoYesYes
Autolinks (bare URLs)NoNoYesYes
Alerts (> [!NOTE])NoNoYesYes
Footnotes, KaTeX math, MermaidNoNoPartialYes

If your Markdown must render identically across multiple platforms (README on GitHub, package page on npm, docs site), stick to CommonMark + GFM tables and task lists, and avoid platform-only shortcodes.

Preview and export before publishing

SnipFerry’s Markdown Preview renders headings, nested lists, tables, fenced code blocks, task lists, and GitHub-style alerts live in your browser, with one-click HTML copy or standalone HTML download. Everything executes locally — safe for internal runbooks, post-mortems, and private RFCs.

Common mistakes that break rendering

  • Missing blank line before a list, table, or code fence — strict parsers treat the lines as a continuation of the previous paragraph.
  • Mixing tabs and spaces in nested lists — pick 2 spaces (or 4 spaces) and stay consistent across the file.
  • Unescaped underscores in code identifiers — wrap names like __init__ or max_retry_count in backticks so older parsers never italicise the middle word.
  • Unescaped angle brackets in prose — writing List<String> outside backticks can disappear because the renderer thinks <String> is an HTML tag. Wrap type names in backticks: `List<String>`.
  • Relying on raw HTML — platforms like GitHub and npm sanitise raw HTML, stripping <script>, <iframe>, inline styles, and unsafe URLs (javascript:).

Need to check word counts on your Markdown draft or diff two revisions? See How to Count Words and Characters and How to Compare Two Texts or JSON Files.