markdown writing cheat-sheet gfm commonmark dev-reference

The Ultimate Markdown Cheat Sheet: Syntax, Preview, and Best Practices

A comprehensive Markdown cheat sheet for developers and writers. Master headers, lists, tables, and GFM extensions with clear examples and FAQ.

2026-04-12

The Ultimate Markdown Cheat Sheet: Syntax, Preview, and Best Practices

Markdown is a lightweight markup language with plain-text formatting syntax. It is widely used for README files, documentation, and blog posts. Because it's easy to read and easy to write, Markdown has become the standard for developer communication.

Use this cheat sheet as a quick reference for standard Markdown and GitHub Flavored Markdown (GFM) syntax.


1. Text Formatting

Basic styling for your text.

Element Syntax Result
Headers # H1 to ###### H6 H1 to H6
Bold **text** or __text__ text
Italic *text* or _text_ text
Strikethrough ~~text~~ text
Blockquote > quote > quote
Horizontal Rule --- or ***

2. Lists

Organize your content with ordered, unordered, or task lists.

  • Unordered List: Use *, -, or +.
    - Item 1
    - Item 2
      - Sub-item
    
  • Ordered List: Use numbers followed by a period.
    1. First item
    2. Second item
    
  • Task List (GFM):
    - [x] Completed task
    - [ ] Incomplete task
    

3. Links and Images

  • Link: [Text](URL) -> Google
  • Image: ![Alt text](URL)
  • Link with Title: [Text](URL "Title")

4. Code Blocks

  • Inline Code: Use single backticks: `code`.
  • Code Block: Use triple backticks with optional language highlighting:
    ```javascript
    console.log("Hello, World!");
    
    
    

5. Tables and Advanced Syntax

Tables:

| Header 1 | Header 2 |
| :--- | :--- |
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |

Footnotes:

Here is a footnote reference[^1].
[^1]: This is the footnote content.

6. Flavors of Markdown

  • CommonMark: The standard, highly compatible version of Markdown.
  • GitHub Flavored Markdown (GFM): Adds support for tables, task lists, strikethrough, and autolinks. Most modern renderers support GFM.
  • HTML in Markdown: You can use raw HTML tags (like <u> or <div>) inside Markdown for more complex layouts, though some renderers might strip them for security.

Common Questions (FAQ)

Q: How can I preview my Markdown?

A: Most code editors like VS Code have a built-in Markdown Preview (Ctrl+Shift+V). You can also use online Markdown renderers or specialized editors to see how your document will look after being converted to HTML.

Q: What is the difference between a Markdown editor and a renderer?

A: An editor is where you write the plain-text syntax. A renderer (or parser) is the engine that converts that syntax into HTML for display in a browser.

Q: What are the best practices for writing Markdown?

A:

  1. Consistency: Stick to one style for lists (- vs *) and headers.
  2. Readability: Use blank lines between paragraphs and list items.
  3. Alt Text: Always provide meaningful alt text for images for accessibility.
  4. Code Fencing: Always specify the language for code blocks to enable syntax highlighting.

Related on Tool3M

  • Markdown to HTML: Instantly convert and preview your Markdown into clean, production-ready HTML.
  • SQL Formatter: Format SQL code blocks to paste into your Markdown documentation.