Skip to content

2. Markdown Cheat Sheet


Table of Contents

Headers
Emphasis
Lists
Links
Images
Code and Syntax Highlighting
Tables
Blockquotes
Inline HTML
Horizontal Rule
Line Breaks

Headers

# H1
## H2
### H3
#### H4
##### H5
###### H6


Alternatively, for H1 and H2, an underline-ish style:


Alt-H1
======


Alt-H2
------

H1

H2

H3

H4

H5
H6

Alternatively, for H1 and H2, an underline-ish style:

Alt-H1

Alt-H2

Emphasis

Emphasis, aka italics, with *asterisks* or _underscores_.


Strong emphasis, aka bold, with **asterisks** or __underscores__.


Combined emphasis with **asterisks and _underscores_**.


Strikethrough uses 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 two tildes. ~~Scratch this.~~

Lists

1. First ordered list item
2. Another item
  * Unordered sub-list. 
1. Actual numbers don't matter, just that it's a number
  1. Ordered sub-list
4. And another item.  


   Some text that should be aligned with the above item.


* Unordered list can use asterisks
- Or minuses
+ Or pluses
  1. First ordered list item
  2. Another item * Unordered sub-list.
  3. Actual numbers don't matter, just that it's a number
  4. Ordered sub-list
  5. And another item.

Some text that should be aligned with the above item.

  • Unordered list can use asterisks
  • Or minuses
  • Or pluses

There are two 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 for reference-style link definitions][1]


Or leave it empty and use the [link text itself]


URLs and URLs in angle brackets will automatically get turned into links. 
http://www.example.com or <http://www.example.com> and sometimes 
example.com (but not on Github, for example).


Some text to show that the reference links can follow later.


[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com

I'm an inline-style link

I'm a reference-style link

You can use numbers for reference-style link definitions

Or leave it empty and use the link text itself

URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or http://www.example.com and sometimes example.com (but not on Github, for example).

Some text to show that the reference links can follow later.

Images

Here's our logo (hover to see the title text):


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"

Here's our logo (hover to see the title text):

Inline-style: alt text

Reference-style: alt text

Code and Syntax Highlighting

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, so no syntax highlighting. 
  But let's throw in a &lt;b&gt;tag&lt;/b&gt;.
  ```
var s = "JavaScript syntax highlighting";
alert(s);
s = "Python syntax highlighting"
print s
No language indicated, so no syntax highlighting in Markdown Here (varies on Github). 
But let's throw in a <b>tag</b>.

Again, to see what languages are available for highlighting, and how to write those language names, see the highlight.js demo page.

This is a really long line that still gets quoted correctly when it wraps. Oh boy, let's write some more to make sure this is long enough to wrap for everyone. Oh, you can put Markdown inside a quote.

Inline HTML

You can also use raw HTML in your Markdown, and it mostly works pretty well.

<dl>
  <dt>Definition list</dt>
  <dd>Is something people sometimes use.</dd>

  <dt>Markdown in HTML</dt>
  <dd>Doesn't work *terribly* well **correctly**. Use HTML <em>tags</em>.</dd>
</dl>
Definition list
Is something people sometimes use.
Markdown in HTML
Doesn't work *terribly* well **correctly**. Use HTML tags.

Horizontal Rule

Three or more...


---


Hyphens


***


Asterisks


___


Underscores

Three or more...


Hyphens


Asterisks


Underscores

Line Breaks

The basic recommendation for learning about line breaks is to experiment and explore -- press <Enter> once (i.e., add one line break), then press it twice (i.e., add two line breaks), see what happens. You'll soon learn to get the result you want. "Markdown Toggle" is your friend.

Here are some things to try:

Here is a line we start with.


This line is separated from the above by two line breaks, so it is a *separate paragraph*.


This line is also a separate paragraph, but...
This line is separated by only one line break, so it is a separate line *in the same paragraph*.

Here is a line we start with.

This line is separated from the above by two line breaks, so it is a separate paragraph.

This line also starts a separate paragraph, but...
This line is separated by only one line break, so it is a separate line in the same paragraph.