GitHub Flavored Markdown (GFM) Cheat Sheet

A markdown cheat sheet for GFM



Introduction

This cheat sheet is a quick guide to mastering Markdown, adapted from the GitHub Markdown Guide.

What is Markdown?

Markdown is a simple syntax to format text for the web. It allows you to style text, add images, create lists, and much more with a few non-alphabetic characters like # or *. Essentially, Markdown is plain text with a few added symbols for formatting.

Syntax Overview

Here's a rundown of Markdown syntax that can be used across GitHub.com and in your text files.


Headers

# This is an H1 tag
## This is an H2 tag
#### This is an H4 tag
  • # for H1
  • ## for H2
  • #### for H4

Emphasis

_Italic text_
 
**Bold text**
 
_You **can** combine them_
  • Use _ or * for italics.
  • Use ** or __ for bold.
  • Combine for bold-italic.

Lists

Unordered

- Item 1
- Item 2
  - Item 2a
  - Item 2b
  • Use -, +, or * for unordered lists.
  • Indent for nested lists.

Ordered

1. First item
2. Second item
3. Third item
   1. Subitem 3a
   2. Subitem 3b
  • Use numbers followed by a period for ordered lists.
  • Sub-items are indented.

Images

![Unsplash Image](https://images.unsplash.com/photo-1522071820081-009f0129c71c)
  • `Unsplash Image
[GitHub](https://unsplash.com)
 
https://unsplash.com - automatic!
  • [unsplash](https://unsplash.com) for clickable text.
  • Direct URL for auto-linking.

Blockquotes

> As Kanye West said:
>
> We're living the future so
> the present is our past.
  • Use > for blockquotes.

Inline Code

I think you should use an `<addr>` element here instead.
  • Use backticks ` for inline code snippets.

Syntax Highlighting

function fancyAlert(arg) {
  if (arg) {
    $.facebox({ div: '#foo' });
  }
}
  • Use triple backticks with the language name (e.g., js) for syntax highlighting.

Footnotes

Here is a simple footnote[^1].
 
[^1]: This is the footnote text.
  • [^1] for footnotes in text.
  • [1]: for the footnote definition.

Task Lists

- [x] Completed item
- [ ] Incomplete item
  • Use - [x] for completed and - [ ] for incomplete tasks.

Tables

| Header 1                   | Header 2                   |
| -------------------------- | -------------------------- |
| Cell 1                      | Cell 2                      |
| Cell in the first column    | Cell in the second column   |
  • Separate headers with hyphens and columns with pipes.

Strikethrough

~~This text is crossed out~~
  • Use ~~ for strikethrough.

2024 Updates

GitHub Flavored Markdown (GFM) has evolved, and here are some key updates:

  • Extended Syntax: GitHub has introduced additional syntaxes like the task list, which is now widely supported across repositories.
  • Enhanced Code Blocks: Syntax highlighting has become more accurate, with support for more languages.
  • Footnotes: Footnotes are now better integrated with text and offer improved usability.
  • Improved Table Rendering: Tables are now easier to create and view, with better mobile support.