GitHub Markdown Syntax Summary
Learn what Markdown is and summarize key Markdown syntax based on GitHub Flavored Markdown for GitHub Pages blog hosting.
To utilize GitHub Pages, it’s necessary to understand markdown syntax. This summary is based on GitHub’s official documents Mastering Markdown and Basic writing and formatting syntax.
1. What is Markdown
Markdown is a lightweight markup language based on plain text. It is used to write formatted documents in plain text and is characterized by its easy and simple syntax compared to general markup languages. It is widely used in README files distributed with application software or online posts because it can be easily converted to formatted documents such as HTML and Rich Text Format (RTF).
John Gruber created the Markdown language in 12004 HE through significant collaboration with Aaron Swartz on grammar, with the goal of enabling people to write using an easy-to-read and easy-to-write plain text format while allowing optional conversion to structurally valid XHTML (or HTML).
2. Markdown Syntax
Since Markdown doesn’t have a set standard, detailed syntax may vary slightly depending on where it’s used. The Markdown syntax summarized here is based on GitHub Flavored Markdown.
2.1. Line Breaks, Paragraph Separation
In Markdown, a single press of the Enter key is not recognized as a line break.
1
2
3
First sentence.
Second sentence.
Third sentence.
First sentence. Second sentence. Third sentence.
A line break is applied by entering two or more consecutive spaces.
1
2
3
First sentence.
Second sentence.
Third sentence.
First sentence.
Second sentence.
Third sentence.
Paragraphs are separated by a blank line (pressing Enter twice).
1
2
3
One paragraph.
Another paragraph.
One paragraph.
Another paragraph.
2.2. Headers
There are six levels in total.
1
2
3
4
5
6
# This is an H1
## This is an H2
### This is an H3
#### This is an H4
##### This is an H5
###### This is an H6
In principle, there should only be one H1 tag per page, so you usually don’t directly write it when creating posts or documents.
2.3. Emphasis
1
2
3
4
5
6
7
8
9
10
11
*This text is italicized*
_This is italicized too_
**This is bold text**
__This is bold text too__
~~This was mistaken text~~
_You **can** combine them_
***All this text is important***
This text is italicized
This is italicized too
This is bold text
This is bold text too
This was mistaken text
You can combine them
All this text is important
2.4. Text Quotation
Use >.
1
2
3
> This is a first blockquote.
>> This is a second blockquote.
>>> This is a third blockquote.
This is a first blockquote.
This is a second blockquote.
This is a third blockquote.
2.5. Code Quotation
Use ``` or ~~~.
1
2
3
4
5
```
git status
git add
git commit
```
1
2
3
git status
git add
git commit
You can also specify a programming language to activate syntax highlighting.
1
2
3
4
5
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```
1
2
3
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
2.6. Links
1
2
[GitHub Pages](https://pages.github.com/)
<https://pages.github.com/>
GitHub Pages
https://pages.github.com/
You can also use relative path links pointing to other files within the repository. The usage is the same as in the terminal.
1
[README](../README.md)
2.7. Unordered Lists
Use - or *.
1
2
3
- George Washington
- John Adams
- Thomas Jefferson
- George Washington
- John Adams
- Thomas Jefferson
2.8. Ordered Lists
Use numbers.
1
2
3
1. James Madison
2. James Monroe
3. John Quincy Adams
- James Madison
- James Monroe
- John Quincy Adams
2.9. Nested Lists
1
2
3
1. First list item
- First nested list item
- Second nested list item
- First list item
- First nested list item
- Second nested list item
- First nested list item
2.10. Task Lists
To create a task list, add [ ] before each item. To mark a task as complete, use [x].
1
2
3
- [x] Finish my changes
- [ ] Push my commits to GitHub
- [ ] Open a pull request
- Finish my changes
- Push my commits to GitHub
- Open a pull request
2.11. Image Attachment
1
2
3
4
Method: {(Optional)Additional options}

{: .align-center}
{: width="50%" height="50%"}
2.12. Table Creation
You can create tables using | and -. Leave a blank line before the table for proper display. Use at least three - for proper recognition.
1
2
3
4
5
| Left-aligned | Center-aligned | Right-aligned |
| :--- | :---: | ---: |
| git status | git status | git status |
| git diff | git diff | git diff |
Left-aligned | Center-aligned | Right-aligned |
---|---|---|
git status | git status | git status |
git diff | git diff | git diff |