---
title: "Markdown syntax guide: from basics to advanced GFM"
description: "A complete Markdown syntax guide. Covers CommonMark, GitHub Flavored Markdown extensions, and modern conventions for technical writing."
date: "2025-10-21"
author: "Markdown Viewer Team"
tags: ["markdown", "syntax", "GFM"]
cover: "/og.png"
---

Markdown has two layers: **CommonMark**, the strict standard most renderers respect, and **GitHub Flavored Markdown (GFM)**, the practical superset that adds tables, task lists, autolinks, and strikethrough.

This guide walks through both, with notes on what works where.

## CommonMark — the foundation

CommonMark is what every renderer agrees on. If you stick to this subset, your document will look the same everywhere.

### Paragraphs and line breaks

Paragraphs are blocks of text separated by blank lines. Inside a paragraph, a line break needs **two trailing spaces** or a single `\` at the end of the line.

### Inline elements

```md
**strong**, _emphasis_, `code`, and [a link](https://trymarkdownviewer.com).
```

### Block elements

- `# Heading` (1–6 levels)
- `> Blockquote`
- `- Bullet` and `1. Ordered`
- ` ` ` ` fenced code blocks
- `---` horizontal rule

## GitHub Flavored Markdown extensions

GFM adds the features you actually want for technical writing.

### Tables

```md
| Feature        | Status |
| -------------- | :----: |
| Live preview   |   ✅   |
| Autosave       |   ✅   |
| PDF export     |   ✅   |
```

### Task lists

```md
- [x] Write the post
- [ ] Publish it
```

### Strikethrough

```md
~~Old plan~~ → new plan.
```

### Autolinks

URLs and emails get linkified automatically: https://trymarkdownviewer.com.

### Code fences with language hints

````md
```ts
const message = "Hello, Markdown!";
```
````

The language hint enables syntax highlighting in our preview (and on GitHub, GitLab, and most documentation sites).

## Frontmatter

Static site generators read YAML-style frontmatter at the top of a file:

```md
---
title: "My post"
date: "2025-10-21"
tags: ["markdown", "syntax"]
---
```

It's not part of CommonMark, but it's how `git`-friendly content stays portable.

## Footnotes (GFM)

```md
Here's a footnote.[^1]

[^1]: And here's the explanation.
```

## Admonitions and callouts

These vary by renderer. GitHub uses:

```md
> [!NOTE]
> Highlights useful information.

> [!WARNING]
> Critical information that could go wrong.
```

Markdown Viewer renders these as styled blockquotes.

## What to avoid

- **HTML inside Markdown** — most renderers sanitize it for security.
- **Mixing tabs and spaces** for indentation — pick one and stick to it.
- **Trailing whitespace** anywhere except intentional line breaks.

The [Markdown Viewer formatter](/editor) cleans up these issues automatically. Hit **Format markdown** in the sidebar to apply our conventions in one pass.

## Where to go next

- [What is Markdown?](/blog/what-is-markdown)
- [The Markdown cheat sheet](/blog/markdown-cheat-sheet)
- [The best Markdown editors](/blog/best-markdown-editors)
