What Is CommonMark? The Standardized Markdown Spec

CommonMark is a strict specification for markdown that resolves ambiguities in the original syntax. Learn what it standardizes, why it matters, and who uses it.

· · 5 min read

Last updated: February 28, 2026

markdown commonmark learn

CommonMark is a formal specification for markdown syntax, published in 2014. It defines exactly how every markdown construct should be parsed and rendered, resolving hundreds of ambiguities in John Gruber’s original 2004 description. Most modern markdown tools, including GitHub, VS Code, and MDtoLink, build on CommonMark as their foundation.

Why CommonMark Exists

The original markdown specification was a blog post by John Gruber. It described the syntax in prose but left many edge cases undefined:

  • What happens when you nest a blockquote inside a list?
  • Does a blank line between list items change the HTML output?
  • How do you handle overlapping emphasis markers like *foo **bar* baz**?
  • Should a link inside another link be valid?

Different markdown processors answered these questions differently. A document that rendered one way in one tool looked different in another. There was no way to test whether a parser was “correct” because there was no authoritative definition of correct.

In 2012, Jeff Atwood (Stack Overflow co-founder), John MacFarlane (Pandoc author), and others started work on a unified specification. The result, published in 2014, was CommonMark.

What CommonMark Standardizes

The specification covers 17 categories of syntax with 652 test cases (as of spec version 0.31.2):

CategoryWhat It Defines
Thematic breaks---, ***, ___ rules
ATX headings# through ######
Setext headings=== and --- underlines
Indented code blocks4-space indent rules
Fenced code blocksBacktick and tilde fences
ParagraphsWhen lines merge, when they separate
Blank linesTheir effect on surrounding elements
Block quotes> nesting and continuation
List itemsIndentation, lazy continuation, loose vs tight
ListsOrdered/unordered, start numbers
Backslash escapesWhich characters can be escaped
Entity referencesHTML entity handling
Code spansBacktick matching rules
Emphasis* and _ precedence and nesting
LinksInline, reference, and autolinks
Images![]() parsing
Raw HTMLWhen HTML passes through vs gets escaped

Each category has precise rules with examples showing input and expected output.

CommonMark vs Original Markdown

AspectOriginal Markdown (2004)CommonMark (2014+)
FormatBlog post / informal descriptionFormal spec with test suite
Edge casesUndefinedDefined (652+ tests)
Reference implementationMarkdown.pl (Perl)cmark (C), commonmark.js (JS)
AmbiguityManyNone by design
ExtensionsNot addressedNot included (handled by flavors)
Maintained byJohn GruberCommonMark team (John MacFarlane et al.)

CommonMark is intentionally conservative. It specifies only the core markdown syntax and leaves extensions (tables, task lists, strikethrough) to flavors like GFM.

CommonMark vs GFM

GitHub Flavored Markdown (GFM) is built on top of CommonMark. Everything in CommonMark is valid GFM. GFM adds features that CommonMark does not include:

FeatureCommonMarkGFM
HeadingsYesYes
Emphasis (bold/italic)YesYes
Links and imagesYesYes
Code blocksYesYes
ListsYesYes
BlockquotesYesYes
TablesNoYes
Task listsNoYes
StrikethroughNoYes
Auto-linking bare URLsNoYes
FootnotesNoYes
Disallowed raw HTMLNoYes (security filtering)

For most writing, GFM is the practical choice because tables and task lists are used frequently. CommonMark is the right reference when building a parser or when you need to understand how the core syntax works.

See What Is GitHub Flavored Markdown? for the full breakdown.

Who Uses CommonMark

Tool / PlatformCommonMark-Based?
GitHub (GFM)Yes (superset)
GitLab (GLFM)Yes (superset)
VS CodeYes
DiscourseYes
Swift PlaygroundsYes
Reddit (new editor)Yes
Stack OverflowYes (CommonMark since 2020)
PandocSupports CommonMark mode
MDtoLinkYes

The cmark reference implementation (written in C) and commonmark.js (JavaScript) are the official parsers. Many other parsers (marked, markdown-it, pulldown-cmark) implement CommonMark or a close variant.

The CommonMark Spec in Practice

Here is an example of an ambiguity that CommonMark resolves:

What does this produce?

- foo
bar

In the original markdown, different parsers disagreed: is bar a continuation of the list item, or a separate paragraph? CommonMark defines it precisely: bar is a continuation of the list item because it is indented to the content column of the item.

Another example: overlapping emphasis.

*foo **bar* baz**

Some old parsers would crash or produce inconsistent output. CommonMark has rules for how emphasis delimiters match, and this produces: <em>foo <strong>bar</strong></em> baz** (the last ** is literal because it has no matching opener after the * closes).

FAQ

Is CommonMark the “official” markdown standard?

It is the closest thing to an official standard. John Gruber (the original creator) never endorsed it, but the specification has been adopted by GitHub, GitLab, Stack Overflow, Reddit, and most major platforms.

Should I write CommonMark or GFM?

Write GFM if you use tables, task lists, or strikethrough. GFM includes all of CommonMark plus those extensions. If you only use core syntax (headings, emphasis, links, lists, code), your document is valid CommonMark and GFM simultaneously.

Does CommonMark support tables?

No. Tables are a GFM extension, not part of the CommonMark specification. CommonMark covers only the core syntax.

Where can I read the full specification?

The specification is at spec.commonmark.org. It includes every parsing rule with input/output examples. The CommonMark dingus lets you test how any input parses under the spec.

Try It Out

Write CommonMark-compatible markdown in the MDtoLink editor and see it render in real time. Publish to a shareable URL when you’re done.

For the full syntax, see the markdown cheat sheet. For the GFM extensions, see What Is GitHub Flavored Markdown?.


David Schemm
David Schemm

Founder, MDtoLink

David builds developer tools and writes about markdown workflows, documentation, and AI-assisted publishing.

Publish your markdown to a shareable URL

One command. Free to start. No credit card.