This is intended as a quick reference and showcase. For more complete info, see John Gruber's original spec and the Github-flavored Markdown info page. This cheatsheet is modified from Joshua Pekera'a cheat sheet for "Markdown Here", but this page is just GitHub Flavored Markdown
Headers
Emphasis
Lists
Links
Images
Code and Syntax Highlighting
Tables
Blockquotes
Inline HTML
Horizontal Rule
Line Breaks
For H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
Or the more common
# H1
## H2
### H3
#### H4
##### H5
###### H6
For H1 and H2, an underline-ish style:
Or the more common
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses one tilde ~Scratch This~ or two tildes. ~~Scratch this.~~
Emphasis, aka italics, with asterisks or underscores.
Strong emphasis, aka bold, with asterisks or underscores.
Combined emphasis with asterisks and underscores.
Strikethrough uses one tilde Scratch This or two tildes. Scratch this.
Note: In the GitHub text editor, only two tildes shows the inline preview, but
either one or two tildes show the same on output.
1. First ordered list item
2. Another item
* Unordered sub-list, lead with 4 spaces
1. Actual numbers don't matter, just that it's a number
1. Ordered sub-list, lead with 4 spaces
1. More sub, lead with 4 spaces
3. Notice how the numbers can get janky
1. Notice how the numbers can get janky
2. previous sub
2. previous sub
4. And another item.
1. Main level
1. second level
1. third level
- fourth level
2. third level
2. Second level
7. main level
Unordered list:
- This is a list
- This is a sub list, lead with 4 spaces
- and a further sublist, lead with 4 spaces
- and still more subing
- back down a few
1. add in some ordered stuff
3. more ordered stuff
2. sub ordered stuff
1. Hi There
- Back to the future
Some text that should be aligned with the above item.
* Unordered list can use asterisks
- Or minuses
+ Or pluses
-
First ordered list item
-
Another item
- Unordered sub-list, lead with 4 spaces
-
Actual numbers don't matter, just that it's a number
- Ordered sub-list, lead with 4 spaces
- More sub, lead with 4 spaces 3. Notice how the numbers can get janky
- previous sub
- previous sub
- Ordered sub-list, lead with 4 spaces
-
And another item.
-
Main level
- second level
- third level
- fourth level
- third level
- third level
- Second level
- second level
-
main level
Unordered list:
-
This is a list
- This is a sub list, lead with 4 spaces
- and a further sublist, lead with 4 spaces
- and still more subing
- and a further sublist, lead with 4 spaces
- back down a few
- add in some ordered stuff
- more ordered stuff 2. sub ordered stuff 1. Hi There
- This is a sub list, lead with 4 spaces
-
Back to the future
Some text that should be aligned with the above item.
- Unordered list can use asterisks
- Or minuses
- Or pluses
There are several ways to create links.
[I'm an inline-style link](https://www.google.com)
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[You can use numbers][1] for reference-style link definitions
Or leave it empty and use the [link text itself][]
Some text to show that the reference links can follow later. But while we're at it, might as well point out we can use <a href="#Links" class="dismissed">html links</a> too—this is useful if you need to add a class for use with pages/Jeckyl/whatever.
[arbitrary case-insensitive reference text]: https://git.myndex.com
[1]: http://www.myndex.com/APCA/
[link text itself]: http://www.myndex.com/CVD/
You can use numbers for reference-style link definitions
Or leave it empty and use the link text itself
Some text to show that the reference links can follow later. But while we're at it, might as well point out we can use html links too—this is useful if you need to add a class for use with pages/Jeckyl/whatever.
Here's a logo (hover logo to see the alt text):
Inline-style:
![don't forget to do alt text](https://avatars.githubusercontent.com/u/42009457?s=40&v=4 "Logo Title Hover Text")
Reference-style:
![don't forget to do alt text, this is a logo][logo]
And regular HTML img tags work, and allows setting the width or height, and classes for use with pages:
<img width="200" alt="Hi There! Please be descriptive with Alt Text!!" class="recess" src="https://avatars.githubusercontent.com/u/42009457?s=400&u=2dcba5c146315f82f802b8b58e92a4d6b82344b3&v=4">
[logo]: https://avatars.githubusercontent.com/u/42009457?s=40&v=4 "Logo Title Hover Text: The Sequel"
Here's a logo (hover to see the title text):
And regular HTML img tags work, and allows setting the width or height, and classes for use with pages:
Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and Markdown Here -- support syntax highlighting. Markdown Here supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the highlight.js demo page.
Inline `code` has `back-ticks around` it.
Inline code
has back-ticks around
it.
Blocks of code are either fenced by lines with three back-ticks ```
, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.
```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```
```python
s = "Python syntax highlighting"
print s
```
```
No language indicated.
let what = 'will it' + B;
// let's throw in a comment
<b>tag</b>.
```
// And code blocks that are just indented 4 spaces
let me = out > ofHere ? 'bye' : 'never' ;
return null;
me = 'help I'm trapped after the return line!';
var s = "JavaScript syntax highlighting";
alert(s);
s = "Python syntax highlighting"
print s
No language indicated.
let what = 'will it' + B;
// let's throw in a comment
<b>tag</b>.
// And code blocks that are just indented 4 spaces
let me = out > ofHere ? 'bye' : 'never' ;
return null;
me = 'help I'm trapped after the return line!';
Again, to see what languages are available for highlighting, and how to write those language names, see the [highlight.js demo page](http://softwaremaniacs.org/media/soft/highlight/test.html).
## Tables
```markdown
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 |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3
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 |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty |
---|---|---|
Still | renders |
nicely |
1 | 2 | 3 |
>> Blockquotes are very handy in email to emulate reply text.
>> This line is part of the same quote.
> This is one less quote level
This line gets incorporated with the quote because it's only a single newline away
Quote break.
> 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.
Blockquotes are very handy in email to emulate reply text. This line is part of the same quote. This is one less quote level This line gets incorporated with the quote because it's only a single newline away
Quote break.
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.
You can also use raw HTML in your Markdown... sometimes:
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
But perhaps the most brilliant add is that of details/summary
<details><summary><b>Click here</b> for a surprise!</summary>
**I'm hidden till I'm not, then**
### Sir, Prize!
I can use markdown **here in details**, but no markdown in the **summary**.
</details>
- Definition list
- Is something people use sometimes.
- Markdown in HTML
- Does *not* work **very** well. Use HTML tags.
But perhaps the most brilliant add is that of details/summary
Click here for a surprise!
I'm hidden till I'm not, then
I can use markdown here in details, but no markdown in the summary.
Three or more...
Hyphens
---
Asterisks
***
Underscores
___
All become a thick horizontal line.
Three or more...
Hyphens
Asterisks
Underscores
All become a thick horizontal line.
Here are some things to try out:
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
This line is also begins a separate paragraph, but,
despite having a single newline, it just gets wrapped together.
This line ends with four white spaces before hitting return.
So the next line becomes a single new line
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a separate paragraph.
This line is also begins a separate paragraph, but, despite having a single newline, it just gets wrapped together.
This line ends with four white spaces before hitting return.
So the next line becomes a single new line
Any requests for features fleshed out?