Skip to main content

Github flavored markdown syntax

· 3 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

GitHub Flavored Markdown (GFM) is a superset of the CommonMark specification, which means it includes all the standard Markdown features plus several useful additions. It's the dialect of Markdown used on GitHub for things like issues, pull requests, wikis, and comments.

Where and Why We Use GFM

We use GFM on GitHub because it's tailored to the needs of developers. The extra features make it easy to reference other parts of a repository and collaborate more effectively. You can use it to:

  • Reference Code and People: Easily link to specific issues, pull requests, commits, and users.
  • Track Tasks: Create and manage simple to-do lists within a comment or issue.
  • Highlight Code: Use syntax highlighting in code blocks for better readability.
  • Create Tables: Organize data in a clear, structured way.

GFM Syntax

GFM includes all the standard Markdown syntax (headings, lists, bold, italics, etc.) and adds the following features:

Task Lists

Task lists allow you to create interactive checklists.

- [x] Complete the task
- [ ] Another task to do

Strikethrough

You can cross out text using two tildes.

~~This is a mistake.~~

Tables

You can create tables with hyphens and pipes. You can also specify text alignment within columns using colons.

| Header 1 | Header 2 |
| :--- | :---: |
| Left-aligned | Center-aligned |

GFM automatically turns URLs and email addresses into clickable links without requiring the full link syntax.

Go to https://github.com

Mentions and References

You can reference users, issues, pull requests, and commits directly.

SyntaxDescriptionExample
@usernameMention a user. They will be notified.@octocat
#issue-numberReference an issue or pull request.Closes #123
owner/repo#1Reference an issue in another repository.Fixes some-other-repo#456
commit_shaReference a specific commit.See 7c2a74c

Disallowed HTML

GFM sanitizes and removes certain raw HTML tags to prevent security vulnerabilities (1). This is a security measure to ensure the content is safe to display.

Sources

  1. GitHub Flavored Markdown Spec