Markdown syntax guide: from basics to advanced GFM
A complete Markdown syntax guide. Covers CommonMark, GitHub Flavored Markdown extensions, and modern conventions for technical writing.
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
**strong**, _emphasis_, `code`, and [a link](https://trymarkdownviewer.com).
Block elements
# Heading(1–6 levels)> Blockquote- Bulletand1. Orderedfenced code blocks---horizontal rule
GitHub Flavored Markdown extensions
GFM adds the features you actually want for technical writing.
Tables
| Feature | Status |
| -------------- | :----: |
| Live preview | ✅ |
| Autosave | ✅ |
| PDF export | ✅ |
Task lists
- [x] Write the post
- [ ] Publish it
Strikethrough
~~Old plan~~ → new plan.
Autolinks
URLs and emails get linkified automatically: https://trymarkdownviewer.com.
Code fences with language hints
```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:
---
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)
Here's a footnote.[^1]
[^1]: And here's the explanation.
Admonitions and callouts
These vary by renderer. GitHub uses:
> [!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 cleans up these issues automatically. Hit Format markdown in the sidebar to apply our conventions in one pass.
Where to go next
Written by Markdown Viewer Team. Found this useful? Try the editor →
Keep reading
Hand-picked articles related to this one.
Everything you need to know about Markdown tables — syntax, alignment, escape sequences, GFM extensions, accessibility tips, and how to generate them faster.
How to write Markdown code blocks — fenced and indented, with syntax highlighting, line numbers, inline code, escape sequences, and tips for technical writing.
Master Markdown links — basic syntax, internal anchors, reference-style links, automatic linking, link titles, opening in new tabs, and SEO best practices.