Markdown
| Full name | Markdown |
|---|---|
| Extensions | .md, .markdown (also .mdown, .mkd, .mkdn) |
| MIME type | text/markdown (with charset and optional variant, e.g. text/markdown; charset=UTF-8; variant=GFM) |
| Type | plain text with lightweight markup, usually converted to HTML |
| Starts with | nothing fixed (plain text); often # Title or YAML front matter --- |
| Specification | CommonMark 0.31.2, GitHub Flavored Markdown |
| Also standardized as | RFC 7763 (media type), RFC 7764 (variants) |
| Maintained by | CommonMark project; GitHub (GFM) |
| License | open |
Markdown is plain text with a few punctuation conventions: # for headings, * or - for lists, **bold**, [links](https://example.com) and backtick code spans. The text stays readable as is, and tools convert it to HTML. It’s the standard format for README files, documentation, wikis, static site generators, chat messages, note-taking apps and LLM output.
There is no single Markdown. The original 2004 description was informal, so implementations disagreed on edge cases. CommonMark is the precise, tested specification that most modern parsers follow. GitHub Flavored Markdown (GFM) is CommonMark plus tables, task lists, strikethrough, autolinks and HTML filtering. Many tools add their own extensions: footnotes, front matter, math, definition lists, admonitions.
When to use Markdown#
- Use for README files, documentation, notes, blog posts and any text that people write by hand and that ends up as HTML.
- Use when the source should be readable and diffable in version control.
- Avoid for layout-heavy documents (columns, precise positioning, page breaks): use HTML, PDF or a word processor format.
- Avoid assuming that every renderer shows the same output: write to CommonMark or GFM and test with your target renderer.
Syntax#
The core CommonMark syntax:
# Heading 1
## Heading 2
Paragraphs are separated by blank lines. Lines next to each other
join into one paragraph.
*italic* or _italic_, **bold**, `inline code`, [link](https://example.com "title"),
, <https://autolink.example>
- bullet list
- second item
1. nested numbered list
2. second
> block quote
indented code block (4 spaces)
```python
fenced code block with a language
```
--- (thematic break)
Line ends with a backslash\
for a hard line break. <span>Raw HTML</span> is allowed.
GFM adds:
| Column | Aligned right |
|--------|--------------:|
| cell | 42 |
- [x] done task
- [ ] open task
~~strikethrough~~, www.example.com and https://example.com become links
Common extensions outside the specs: footnotes (text[^1] and [^1]: note, supported by GitHub), YAML front matter between --- lines at the top of the file, math ($x^2$, $$...$$), heading IDs (## Title {#id}), definition lists, and GitHub alerts (> [!NOTE]).
File structure#
A Markdown file is plain text, normally UTF-8. A CommonMark parser works in two phases:
- Block structure: the input is split into lines and grouped into blocks: paragraphs, headings (ATX
#or setext underlines), block quotes, lists and list items, code blocks (indented or fenced), HTML blocks, thematic breaks, and link reference definitions ([id]: https://url "title"). Containers (quotes, list items) nest. - Inlines: the text inside paragraphs and headings is parsed for emphasis, code spans, links, images, autolinks, raw HTML, entities, backslash escapes and line breaks.
The result is an abstract syntax tree (document, block and inline nodes) that renderers turn into HTML, or back into normalized Markdown. Raw HTML passes through unchanged, which is why renderers for untrusted input either escape it or sanitize the output.
Front matter#
Static site generators (Hugo, Jekyll, Astro, Docusaurus) put metadata at the top of the file. It’s not part of CommonMark; parsers need an extension to skip or read it:
---
title: Release notes
date: 2026-11-05
tags: [docs, release]
---
# Release notes
Variants#
| Variant | Where | Adds to CommonMark |
|---|---|---|
| CommonMark | reference spec | (base) |
| GFM | GitHub, GitLab, many tools | tables, task lists, strikethrough, autolinks, disallowed raw HTML |
| Original Markdown.pl | 2004 Perl script | (older, ambiguous rules) |
| MultiMarkdown | MultiMarkdown tools | tables, footnotes, metadata, citations, math |
| PHP Markdown Extra | PHP Markdown, many ports | tables, footnotes, definition lists, abbreviations, attributes |
| Pandoc Markdown | Pandoc | almost everything: citations, math, grid tables, divs, attributes |
| MDX | React documentation sites | JSX components and imports |
| R Markdown, Quarto, MyST | data science, Python docs | executable code chunks, roles and directives |
Converting Markdown#
# to HTML with the CommonMark reference implementation
cmark --to html README.md > README.html
# GFM with cmark-gfm
cmark-gfm -e table -e strikethrough -e autolink -e tasklist README.md > README.html
# to PDF, DOCX, EPUB and many more with Pandoc
pandoc README.md -o README.pdf
pandoc README.md -o README.docx
pandoc notes.docx -t gfm -o notes.md # Word to Markdown
Specifications and documentation#
- CommonMark specification 0.31.2: the precise syntax with 650+ examples
- CommonMark home page: reference implementations, 10-minute tutorial, dingus to try the syntax
- GitHub Flavored Markdown spec: CommonMark plus GFM extensions
- GitHub docs: basic writing and formatting syntax: alerts, footnotes, math and other GitHub features
- RFC 7763: the
text/markdownmedia type; RFC 7764: variants - Original Markdown syntax
- Pandoc’s Markdown
- Babelmark 3: compare the output of many Markdown implementations
Software that opens Markdown files#
| Software | Windows | macOS | Linux | Web | Can | Notes |
|---|---|---|---|---|---|---|
| SumatraPDF | ✓ | view | free, open source; renders .md as GitHub Flavored Markdown | |||
| Visual Studio Code | ✓ | ✓ | ✓ | ✓ | view, edit, create | free; built-in preview (Ctrl+Shift+V) |
| Obsidian | ✓ | ✓ | ✓ | view, edit, create | free for personal use; Markdown note vault. Also on Android and iOS | |
| Typora | ✓ | ✓ | ✓ | view, edit, create, convert | commercial; WYSIWYG Markdown editor | |
| Zettlr | ✓ | ✓ | ✓ | view, edit, create, convert | free, open source; academic writing, Pandoc export | |
| Joplin | ✓ | ✓ | ✓ | view, edit, create | free, open source notes app. Also on Android and iOS | |
| iA Writer | ✓ | ✓ | view, edit, create, convert | commercial. Also on Android and iOS | ||
| MarkText | ✓ | ✓ | ✓ | view, edit, create | free, open source WYSIWYG editor | |
| Notepad | ✓ | view, edit, create | built into Windows 11; formatting view for Markdown | |||
| GitHub | ✓ | view, edit | renders .md files and READMEs in repositories | |||
| StackEdit | ✓ | view, edit, create | free, in the browser | |||
| Pandoc | ✓ | ✓ | ✓ | convert | free, open source; Markdown to and from HTML, DOCX, PDF, EPUB and more |
Libraries#
Every language has CommonMark-compliant parsers. See all Markdown libraries for a comparison.