Markdown Cheatsheet
This is a list of frequently used markdown commands.
I’ll be updating this section on an ongoing basis.
I use the GitHub flavored markdown and the StackOverflow markdown for reference.
Headers
# H1
## H2
### H3
#### H4
##### H5
###### H6
H1
H2
H3
H4
H5
H6
Emphasis/Italics
*asterisks* or _underscore_
asterisks or underscore
Strong Emphasis/Bold
**asterisks** or __underscore__
asterisks or underscore
Combined Emphasis
**asterisks and _underscores_**
asterisks and underscores
Strikethrough
~~Scratch this.~~
Line Breaks
1 newline => new line in the same paragraph
2 newlines => new paragraph altogether
Horizontal Rule
Three or more
- Hyphens
---
- Asterisks
***
- Underscores
___
BlockQuote
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
This is a very long line that will still be quoted properly when it wraps. Oh boy let’s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.
Tables
Colons can be used to align columns.
| Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 | | col 2 is | centered | $12 | | zebra stripes | are neat | $1 |
There must be at least 3 dashes separating each header cell.
You can also use inline Markdown.
The outer pipes (|) are optional, and you don’t need to make the raw Markdown line up prettily.
Markdown | Less | Pretty --- | --- | --- *Still* | `renders` | **nicely** 1 | 2 | 3
Code and Syntax Highlighting
Inline Code blocks
Inline `code` has `back-ticks around` it.
Inline code
has back-ticks around
it.
Fenced code blocks
```javascript var s = "JavaScript syntax highlighting"; alert(s); ``` ```python s = "Python syntax highlighting" print s ``` ``` No language indicated, so no syntax highlighting. But let's throw in a tag. ```
Images
These can be shown in two ways
Inline style
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
Reference style
![alt text][logo] [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
Links
Inline link without title
[I'm an inline-style link](https://www.google.com)
Inline link with title
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
I’m an inline-style link with title
Reference style link type 1
[I'm a reference-style link][Arbitrary case-insensitive reference text] [arbitrary case-insensitive reference text]: https://www.mozilla.org
Reference style link type 2
[You can use numbers for reference-style link definitions][1] [1]: http://slashdot.org
You can use numbers for reference-style link definitions
Reference style link type 3
Or leave it empty and use the [link text itself]. [link text itself]: http://www.reddit.com
Or leave it empty and use the link text itself.
Lists
Unordered lists
* Unordered list can use asterisks - Or minuses + Or pluses
- Unordered list can use asterisks
- Or minuses
- Or pluses
Indentation
1. And another item. ⋅⋅⋅You can have properly indented paragraphs within list items. ⋅⋅⋅Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown). ⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅ ⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅ ⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
- And another item.
You can have properly indented paragraphs within list items.
Notice the blank line above, and the leading spaces (at least one, but we’ll use three here to also align the raw Markdown).
To have a line break without a paragraph, you will need to use two trailing spaces.
Note that this line is separate, but within the same paragraph.
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
Ordered List
1. One 2. Two 3. Three
- One
- Two
- Three
Ordered list within unordered list
* Title 1. One 2. Two
- Title
- One
- Two
Unordered list within Ordered list
1 Title * One * Two
- Title
- One
- Two
Sub-ordered list within ordered list
1. Title 1. one 2. two
- Title
- one
- two