Markdown Cheat Sheet is a comprehensive quick reference for Markdown and GitHub Flavored Markdown (GFM) syntax, with rendered previews next to each example. It covers headings, emphasis, lists, links, images, code blocks, tables, task lists, blockquotes, horizontal rules, inline HTML, and escaping special characters.
Markdown was created by John Gruber in 2004 as a lightweight text-to-HTML format. The goal was readability as plain text β asterisks for emphasis look like emphasis even unrendered. Today Markdown is the universal format for README files on GitHub and GitLab, developer documentation platforms like Docusaurus and VitePress, note-taking apps like Obsidian and Notion, and content platforms like Dev.to, Hashnode, and Ghost.
GitHub Flavored Markdown (GFM) extends CommonMark with tables (using the pipe syntax), task lists (checkboxes), strikethrough, autolinks, and @mentions. GFM is the most widely used Markdown dialect in developer contexts. This cheat sheet covers both CommonMark fundamentals and GFM extensions, with each GFM-specific feature clearly labeled.
Table syntax (GFM)
Result: | Name | Age |\n|------|-----|\n| Alice | 30 | β renders as a formatted HTML table with borders
Fenced code block with syntax highlighting
Result: ```python\nprint('Hello')\n``` β Python syntax coloring on most Markdown platforms
Task list (GFM)
Result: - [x] Done\n- [ ] To do β renders as checked and unchecked checkboxes on GitHub
What is the difference between CommonMark and GFM?
CommonMark is the standardized Markdown specification. GFM (GitHub Flavored Markdown) extends it with tables, task lists, strikethrough text, and autolinks. Most developer platforms support GFM. For portability, stick to CommonMark; for GitHub-specific content, GFM extensions are available.
How do I create a link that opens in a new tab?
Standard Markdown has no target attribute syntax. Use raw HTML: Link. Most Markdown parsers pass inline HTML through directly.
How do I escape Markdown special characters?
Prefix with a backslash: \* renders a literal asterisk, \# renders a literal hash. Works for backslash, backtick, asterisk, underscore, curly braces, brackets, parentheses, hash, plus, minus, period, exclamation mark, and pipe.
What is the difference between inline code and a code block?
Inline code uses single backticks `code` for code within a sentence. A code block uses triple backticks or 4-space indentation for multi-line code. Fenced code blocks support language identifiers for syntax highlighting.
Can I use HTML inside Markdown?
Yes β most parsers pass inline HTML through directly. This lets you use elements with no Markdown equivalent: Ctrl+C for keyboard shortcuts, for collapsible sections, and
for complex tables. GitHub sanitizes some attributes for security.
Related Tools