Markdown Syntax Guide

Markdown syntax defines the rules for formatting plain text with headings, lists, links, images, tables, code blocks, and other Markdown elements. This reference explains both standard Markdown and widely supported extensions with practical examples, compatibility notes, and links to detailed guides.

Whether you're writing documentation, a GitHub README, technical notes, or Markdown files for static websites, use this guide to understand how each syntax works, where it's supported, and when to use it.

💡 Learning Path: New to Markdown? Start with Markdown Basics to learn the fundamentals. Need a quick reference? Use the Markdown Cheat Sheet to copy common syntax without reading detailed explanations.

Open EditorDownload PDF

About This Guide

Unlike the quick-copy cheat sheet — built for pasting syntax fast — this guide explains the purpose and behavior of each Markdown element: what the syntax does, how to write it correctly, where it's supported across implementations, common mistakes, and links to dedicated documentation for deeper topics. If you're learning Markdown or troubleshooting a formatting issue, this is the place to start; if you already know the syntax and just need to copy it, the Cheat Sheet is faster.

Standard Markdown vs Extended Markdown

Not every Markdown application supports the same syntax. While most editors understand the core Markdown specification, many also add extensions such as tables, task lists, footnotes, and diagrams. Understanding the difference helps you choose syntax that works across the platforms you use.

Feature Standard Markdown CommonMark GitHub Flavored Markdown (GFM)
Headings ✅ ✅ ✅
Lists ✅ ✅ ✅
Links ✅ ✅ ✅
Images ✅ ✅ ✅
Tables ❌ ❌ ✅
Task Lists ❌ ❌ ✅
Footnotes ❌ ❌ Supported by many implementations
Strikethrough ❌ ❌ ✅
Syntax Highlighting Depends on the renderer Depends on the renderer Commonly supported

💡 Tip: If you're writing content for GitHub, use GitHub Flavored Markdown (GFM). If your content will be viewed in different Markdown editors or static site generators, check which extensions they support before relying on advanced syntax.

Original Markdown includes headings, lists, emphasis, links, images, and blockquotes. CommonMark standardizes core behavior across parsers. GFM adds tables, task lists, strikethrough, fenced code blocks, and automatic links.

Markdown Headings

Headings define the structure of a Markdown document and make content easier to navigate. They also help documentation tools, table of contents generators, and search engines understand the hierarchy of your content.

Syntax#

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

Example#

# Project Documentation

## Installation

### Requirements

### Configuration

## Usage

Compatibility#

Markdown Implementation Support
Original Markdown ✅
CommonMark ✅
GitHub Flavored Markdown (GFM) ✅

Best practice: Use a single H1 (#) for the document title, then organize the rest of your content with H2 (##) and H3 (###) headings.

Common Mistakes#

❌ Incorrect ✅ Correct
##Heading ## Heading
Multiple H1 headings in the same document One H1 followed by H2–H6 headings
Skipping heading levels without structure Keep headings in a logical hierarchy

💡 Deep dive: Learn more about heading levels, document structure, and automatic table of contents generation in the Markdown Headings guide.

Paragraphs

Paragraphs are created by leaving a blank line between blocks of text. Most Markdown parsers treat consecutive lines as part of the same paragraph unless a blank line separates them.

Example#

This is the first paragraph.

This is the second paragraph.

Compatibility#

Markdown Implementation Support
Original Markdown ✅
CommonMark ✅
GitHub Flavored Markdown (GFM) ✅

Common Mistakes#

❌ Incorrect ✅ Correct
Forgetting a blank line between paragraphs Leave one blank line between paragraphs
Using multiple blank lines for spacing Use a single blank line for consistent formatting

Note: Different editors may display extra blank lines differently, but the rendered output is usually the same.

💡 Deep dive: See the Markdown Paragraphs guide for spacing rules, paragraph wrapping, and editor behavior.

Line Breaks

A line break starts a new line without creating a new paragraph. Support varies depending on the Markdown implementation.

Method 1 — Two Trailing Spaces#

First line··
Second line

(The dots represent two trailing spaces.)

Method 2 — HTML <br>#

First line<br>
Second line

Compatibility#

Method CommonMark GFM Notes
Two trailing spaces ✅ ✅ Standard approach
<br> ✅ ✅ HTML support required

Common Mistakes#

Problem Solution
Line break doesn't appear Check for the required trailing spaces
<br> is displayed as text The editor may not support HTML rendering

Best practice: Use blank lines for new paragraphs and line breaks only when the content needs to stay within the same paragraph, such as addresses, poems, or formatted text.

💡 Deep dive: Read the Markdown Line Breaks guide to understand soft breaks, hard breaks, HTML line breaks, and renderer differences.

Text Formatting

Markdown provides lightweight syntax for emphasizing text without using HTML. These formatting options are supported by most modern Markdown implementations.

Bold#

Use bold text to highlight important information.

**Bold Text**
Original Markdown CommonMark GFM
✅ ✅ ✅

Common mistake: Leave no spaces between the asterisks and the text.

Italic#

Use italics for emphasis, book titles, or introducing new terms.

*Italic Text*
Original Markdown CommonMark GFM
✅ ✅ ✅

Bold and Italic#

Combine both styles for stronger emphasis.

***Bold Italic***

Strikethrough#

Marks text as removed or no longer relevant.

~~Deprecated~~
Original Markdown CommonMark GitHub Flavored Markdown
❌ ❌ ✅

Note: Strikethrough is part of GitHub Flavored Markdown and many modern Markdown editors, but it isn't included in the original Markdown specification.

Markdown Lists

Lists organize related information and are supported by every major Markdown implementation.

Unordered Lists#

- Item One
- Item Two
- Item Three

Alternative markers: * Item or + Item

Original Markdown CommonMark GFM
✅ ✅ ✅

Ordered Lists#

1. Install
2. Configure
3. Run

Tip: Most Markdown editors automatically continue numbering while you type.

Nested Lists#

- Frontend
  - HTML
  - CSS
  - JavaScript

Common mistake: Inconsistent indentation can produce unexpected rendering across Markdown parsers.

Task Lists#

- [ ] Write documentation
- [x] Review changes
Original Markdown CommonMark GitHub Flavored Markdown
❌ ❌ ✅

Note: Task lists require GitHub Flavored Markdown or another implementation that supports this extension.

💡 Deep dive: Continue with Markdown Lists and Markdown Task Lists.

Markdown Images

Images use the same syntax as links, prefixed with an exclamation mark.

Syntax#

![Alt Text](image.png)

Clickable Images#

[![Project Logo](logo.png)](https://example.com)

Compatibility#

Original Markdown CommonMark GFM
✅ ✅ ✅

Best practice: Always provide descriptive alt text to improve accessibility and give context when images can't be displayed.

💡 Deep dive: Continue to Markdown Images for image paths, reference images, sizing techniques, and GitHub examples.

Tables

Markdown tables organize structured information into rows and columns. They are widely supported in GitHub Flavored Markdown (GFM) and many modern Markdown editors, but they are not part of the original Markdown specification.

Basic Syntax#

| Name | Role | Experience |
|------|------|-----------|
| Alex | Developer | 5 Years |
| Emma | Designer | 3 Years |

Column Alignment#

Alignment Syntax
Left :---
Center :---:
Right ---:

Compatibility#

Feature Original Markdown CommonMark GitHub Flavored Markdown
Tables ❌ ❌ ✅

Implementation note: If your Markdown renderer doesn't support GFM tables, the table may appear as plain text.

Common Mistakes#

Problem Solution
Uneven columns Every row should contain the same number of cells.
Missing separator row Include the --- separator after the header.
Broken alignment Keep the alignment markers inside the separator row.

💡 Deep dive: Continue to Markdown Tables for multiline cells, alignment examples, escaped pipes, and GitHub-specific behavior.

Inline Code & Code Blocks

Inline Code#

Use inline code to highlight commands, filenames, variables, or short code snippets within a sentence.

`npm install`

Example: Run npm install before starting the project.

Original Markdown CommonMark GFM
✅ ✅ ✅

Best practice: Reserve inline code for short snippets. Use fenced code blocks for complete examples.

Fenced Code Blocks#

```javascript
console.log("Hello, World!");
```

Language Identifiers#

Common examples include JavaScript, Python, HTML, CSS, JSON, Bash, TypeScript, and PHP.

Compatibility#

Feature Original Markdown CommonMark GitHub Flavored Markdown
Fenced Code Blocks ❌ ✅ ✅
Syntax Highlighting Renderer dependent Renderer dependent Commonly supported

Implementation note: Syntax highlighting depends on the renderer, not Markdown itself. Two editors may display the same code block differently.

Common Mistakes#

Problem Solution
Missing closing backticks Always close the code fence with three backticks.
Wrong language identifier Use supported language names such as javascript or python.

💡 Deep dive: Read Markdown Code Blocks for syntax highlighting, language identifiers, and renderer support.

Blockquotes

Blockquotes highlight quoted text, notes, or callouts.

Syntax#

> This is a blockquote.

Nested Blockquotes#

> Main Quote
>> Nested Quote

Compatibility#

Original Markdown CommonMark GFM
✅ ✅ ✅

Best practice: Use blockquotes for quoted content or informational notes, not for indentation or layout.

💡 Deep dive: See Markdown Blockquotes for nested quotes, callouts, and GitHub examples.

Horizontal Rules

Horizontal rules visually separate major sections of a document.

Valid syntax includes:

---
***
___

Compatibility#

Original Markdown CommonMark GFM
✅ ✅ ✅

Common mistake: Leave a blank line above and below a horizontal rule to avoid unexpected rendering.

💡 Deep dive: Read Markdown Horizontal Rules for syntax details and platform notes.

Escaping Special Characters

Escape special Markdown characters with a backslash when they should appear as plain text instead of being interpreted as Markdown syntax.

Example#

\*Not italic\*

\# Not a heading

Common characters that can be escaped:

\*
\_
\`
\#
\[
\]
\(
\)
\\

Compatibility#

Original Markdown CommonMark GFM
✅ ✅ ✅

💡 Deep dive: Continue to Markdown Escaping Characters for parser behavior, code spans, and escaped punctuation.

HTML in Markdown

Many Markdown implementations allow HTML when Markdown syntax alone isn't sufficient.

Example#

<b>Bold</b>

<sup>2</sup>

<sub>2</sub>

<br>

Compatibility#

Feature CommonMark GFM Notes
Inline HTML ✅ ✅ Renderer dependent
Block HTML ✅ ✅ Renderer dependent

Implementation note: Some platforms sanitize HTML for security reasons. Tags such as <script> are commonly removed, while simple formatting tags may still work.

Best practice: Prefer native Markdown syntax whenever possible. Use HTML only when Markdown doesn't support the formatting you need.

💡 Deep dive: Read Markdown HTML to learn which tags are commonly supported across different Markdown applications.

GitHub Flavored Markdown (GFM)

GitHub Flavored Markdown (GFM) extends the original Markdown syntax with additional formatting features that are widely used in GitHub repositories, documentation sites, and modern Markdown editors.

💡 Deep dive: Learn more in the GitHub Flavored Markdown (GFM) guide. For README workflows, see GitHub Markdown.

Platform Compatibility

Markdown doesn't render the same way everywhere. Most platforms support the core syntax, while advanced features depend on the Markdown parser they use.

Feature GitHub GitLab VS Code Obsidian Notion Discord
Headings ✅ ✅ ✅ ✅ ✅ ❌
Tables ✅ ✅ ✅ ✅ Limited ❌
Task Lists ✅ ✅ ✅ ✅ ✅ ❌
Footnotes ✅ Partial Depends ✅ ❌ ❌
Mermaid ✅ ✅ Extension ✅ ❌ ❌
HTML Partial Partial ✅ ✅ Limited ❌

Note: Platform support changes over time. Always check the documentation for the Markdown application you're using before relying on advanced features.

Common Rendering Problems#

Problem Possible Cause
Tables display as plain text The renderer doesn't support GitHub Flavored Markdown.
Task lists appear as normal bullets GFM extensions are unavailable.
Code isn't highlighted Syntax highlighting depends on the renderer and language identifier.
HTML tags don't work The platform sanitizes or blocks HTML.
Footnotes aren't rendered The parser doesn't support footnotes.
Mermaid diagrams appear as code Mermaid rendering isn't enabled.

Most rendering issues are caused by differences between Markdown implementations, not by the Markdown syntax itself.

Choosing the Right Markdown Features#

Use Case Recommended Syntax
Maximum compatibility Standard Markdown / CommonMark
GitHub repositories GitHub Flavored Markdown
Technical documentation CommonMark + supported extensions
Personal knowledge bases Platform-specific features where supported

If your content will be viewed in different applications, test advanced features such as tables, footnotes, Mermaid diagrams, and HTML before publishing.

Frequently Asked Questions

  1. 1

    What's the difference between Markdown Syntax and Markdown Basics?

    Markdown Basics teaches the core concepts and formatting rules. This guide serves as a complete syntax reference with compatibility notes, implementation details, and links to dedicated documentation.

  2. 2

    What's the difference between Markdown Syntax and the Markdown Cheat Sheet?

    The Cheat Sheet is designed for quick copy-and-paste. This guide explains how each Markdown element works, where it's supported, and how different implementations behave.

  3. 3

    Does every Markdown application support the same syntax?

    No. Most applications support the core Markdown syntax, but advanced features such as tables, task lists, footnotes, and Mermaid diagrams depend on the Markdown implementation.

  4. 4

    What's the difference between CommonMark and GitHub Flavored Markdown?

    CommonMark standardizes the core Markdown specification. GitHub Flavored Markdown builds on CommonMark by adding extensions such as tables, task lists, strikethrough, and automatic links.

  5. 5

    Can I use HTML inside Markdown?

    Many Markdown applications allow inline HTML, but support varies. Some platforms remove or sanitize HTML for security reasons.

  6. 6

    Why doesn't my Markdown look the same on every platform?

    Different applications use different Markdown parsers and support different extensions. The same Markdown document may render differently on GitHub, Discord, Notion, or other editors.

  7. 7

    Should I learn CommonMark or GitHub Flavored Markdown?

    Start with the core Markdown syntax first. Once you're comfortable with the basics, learn GitHub Flavored Markdown if you regularly work with GitHub repositories or documentation projects.

  8. 8

    Where can I learn more about individual Markdown elements?

    Every major syntax element covered in this guide has its own dedicated documentation page with detailed explanations, examples, compatibility notes, and best practices.