Markdown Syntax
This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements.
Headings
To create a heading, add one to six #
symbols before your heading text. The number of #
you use will determine the size of the heading.
# The largest heading
## The second largest heading
###### The smallest heading
Styling text
You can indicate emphasis with bold, italic, or strikethrough text in comment fields and .md
files.
Style | Syntax | Keyboard shortcut | Example | Output |
---|---|---|---|---|
Bold | ** ** or __ __ |
command/control + b | **This is bold text** |
This is bold text |
Italic | * * or _ _ |
command/control + i | *This text is italicized* |
This text is italicized |
Strikethrough | ~~ ~~ |
~~This was mistaken text~~ |
||
Bold and nested italic | ** ** and _ _ |
**This text is _extremely_ important** |
This text is extremely important | |
All bold and italic | *** *** |
***All this text is important*** |
All this text is important |
Quoting text
You can quote text with a >
.
Text that is not a quote
> Text that is a quote
Quoting code
You can call out code or a command within a sentence with single backticks. The text within the backticks will not be formatted.
Write like this:
```markdown
Code here.
```
Links
You can create an inline link by wrapping link text in brackets [ ]
, and then wrapping the URL in parentheses ( )
.
Images
You can display an image by adding !
and wrapping the alt text in[ ]
. Then wrap the link for the image in parentheses ()
.
![This is an image](https://myoctocat.com/assets/images/base-octocat.svg)
Tip: When you want to display an image which is in your repository, you should use relative links instead of absolute links.
Lists
You can make an unordered list by preceding one or more lines of text with -
or *
.
- George Washington
- John Adams
- Thomas Jefferson
To order your list, precede each line with a number.
1. James Madison
2. James Monroe
3. John Quincy Adams
Nested Lists
You can create a nested list by indenting one or more list items below another item.
To create a nested list using the web editor a text editor that uses a monospaced font, like Atom, you can align your list visually. Type space characters in front of your nested list item, until the list marker character (-
or *
) lies directly below the first character of the text in the item above it.
1. First list item
- First nested list item
- Second nested list item
In this example, you could add a nested list item under the list item 100. First list item
by indenting the nested list item a minimum of five spaces, since there are five characters (100.
) before First list item
.
100. First list item
- First nested list item
You can create multiple levels of nested lists using the same method. For example, because the first nested list item has seven characters (␣␣␣␣␣-␣
) before the nested list content First nested list item
, you would need to indent the second nested list item by seven spaces.
100. First list item
- First nested list item
- Second nested list item
Using emoji
You can add emoji to your writing by typing :EMOJICODE:
.
Typing :
will bring up a list of suggested emoji. The list will filter as you type, so once you find the emoji you’re looking for, press Tab or Enter to complete the highlighted result.
Paragraphs
You can create a new paragraph by leaving a blank line between lines of text.
Footnotes
You can add footnotes to your content by using this bracket syntax:
Here is a simple footnote[^1].
A footnote can also have multiple lines[^2].
You can also use words, to fit your writing style more closely[^note].
[^1]: My reference.
[^2]: Every new line should be prefixed with 2 spaces.
This allows you to have a footnote with multiple lines.
[^note]:
Named footnotes will still render with numbers instead of the text but allow easier identification and linking.
This footnote also has been made with a different syntax using 4 spaces for new lines.
The footnote will render like this:
Note: The position of a footnote in your Markdown does not influence where the footnote will be rendered. You can write a footnote right after your reference to the footnote, and the footnote will still render at the bottom of the Markdown.