N.B. Where id appears in this document it
should be replaced with a unique identifier string!
Inline elements
Links
There are two ways to make a link:
This is an [inline](http://melroch.se "Optional title") link.
This is an inline link.
This is a [definition][id] link.
Then on its own line anywhere in the text:
[id]: http://melroch.se "Optional title"
This is a definition link.
If you leave the ID empty you can use the linked text as ID:
This is [another][] definition link
[another]: http://melroch.se "Same thing!"
This is another definition link
Automatic links:
<http://melroch.se>
<foo@bar.baz>
Images
Images can also be linked in two ways:

![alt text][id]
[id]: http://blog.melroch.se/some/path/melrochrandom.png "Optional title"
or:
![alt text][]
[alt text]: http://blog.melroch.se/some/path/melrochrandom.png "Optional title"
Footnotes (Markdown Extra only)
Put a footnote reference somewhere in the document:
There is an orange fruit[^id] in the fridge.
and then the identifier followed by the footnote text in its own paragraph anywhere in the document:
[^id]: Not an orange, but some other fruit of that color.
And the footnotes will be placed in order at the end of the output:
There is an orange fruit1 in the fridge.
N.B. you can only have one reference to each footnote.
Abbreviations (Markdown Extra only)
If you write put a declaration of the form
*[abbr]: definition
anywhere in your text every occurrence of abbr will
be wrapped in <abbr> tags and given a title attribute
consisting of definition:
<abbr title="definition">abbr</abbr>
E.g.
There is a sharon fruit in the fridge
*[sharon fruit]: an orange colored fruit
There is a sharon fruit in the fridge
Emphasis
<em> tag (usually rendered as italics):
*One asterisk* or _underscore_ before and after the emphasized span.
asterisk or underscore
<strong> tag (usually rendered as bold):
**Two asterisks** or __underscores__ before and after the strong span.
asterisks or underscores
N.B This differs from the common usage in email where _single underscores_ mark underline or ‘italics’ (c.f. how underline was commonly used as handwriting equivalent of italics) and *single asterisks* marks ‘bold’. Even though the traditional handwriting equivalent of bold was double underline I consider this a misfeature of Markdown!
Inline code
Enclose in backticks:
Entities like to `ö` make HTML unreadable!
Entities like to ö make HTML unreadable!
Block elements
Paragraph
One or more lines of text, separated by one or more blank lines.
<br /> tag
End a line inside a paragraph with two or more spaces.
Inline HTML
You can use any HTML inside Markdown
- Indent opening tag by no more than three spaces.
- Inside a list, indent to the same level as the list.
Code blocks
Indent 4 spaces or 1 tab
Markdown inside HTML blocks (Markdown Extra only)
<div markdown="1">
This text *will* be processed by markdown
</div>
This text will be processed by markdown
Blockquotes
Right angles in the left margin, like in email:
> Vides ut alta stet
> nive candidum Soracte
Vides ut alta stet nive candidum Soracte
Horizontal rules:
At least three astersiks or dashs or underscores with an optional space between with blank lines before and after:
***
---
___
----------------------------
* * *
- - -
_ _ _
Headers
In this section all headers which illustrate output rather than belong to the structure of this document are shown in blockquotes. The blockquote indicators are of course not part of the output of the header markup!
There are two styles of H1 and H2:
# Header 1 #
or
Header 1
========
## Header 2 ##
or
Header 2
--------
Header 1
or
Header 1
Header 2
or
Header 2
Lower level headers
### Header 3 ###
#### Header 4 ####
##### Header 5 #####
##### Header 6 #####
Header 3
Header 4
Header 5
Header 6
Closing hashes are optional
## Header 2 ##
and
## Header 2
give the same thing.
Header 2
Header ID attribute (Markdown Extra only)
# Header 1 {#header1}
or
Header 2 {#header2}
--------
Header 1
or
Header 2
Link back to header (Markdown Extra only)
[Link back to header 1](#header1)
Lists
Unordered lists
Asterisks, plus signs or dashes:
* Tic + Tic - Tic
* Tac + Tac - Tac
* Toe + Toe - Toe
- Tic
- Tac
- Toe
Ordered lists
Ordered or unordered digits followed by a period
1. Tic 1. Tic
2. Tac 1. Tac
3. Toe 1. Toe
- Tic
- Tac
- Toe
Definition lists
Term
: Definition
- Term
- Definition
Multiple definitions:
Orange
: A city in France
: A fruit
- Orange
- A city in France
- A fruit
Multiple terms:
- Orange
- Naranja
- Apelsin
-
The same fruit in three languages
-
Orange
Naranja
Apelsin
- The same fruit in three languages
Tables (Markdown Extra only)
Header A | Header B
-----------|-----------
Content 1a | Content 1b
Content 2a | Content 2b
or:
| Header A | Header B |
| -----------|------------|
| Content 1a | Content 1b |
| Content 2a | Content 2b |
| Header A | Header B |
|---|---|
| Content 1a | Content 1b |
| Content 2a | Content 2b |
Text alignment within columns
Uses the HTML ALIGN attribute
| Unspecified | Left | Center | Right |
|-------------|:-----|:------:|------:|
| Number | 10 | 20 | 30 |
| Unspecified | Left | Center | Right |
|---|---|---|---|
| Number | 10 | 20 | 30 |
Literal characters
LITERAL CHARACTERS Use backslash escape to insert the following characters literally:
| To get | Type | |
|---|---|---|
| \ | \\ |
backslash |
| ` | \` |
backtick |
| * | \* |
asterisk |
| _ | \_ |
underscore |
| {} | \{\} |
curly braces |
| [] | \[\] |
square brackets |
| () | \(\) |
parentheses |
| # | \# |
hash mark |
| + | \+ |
plus sign |
| - | \- |
minus sign (hyphen) |
| . | \. |
dot |
| ! | \! |
exclamation mark |
| : | \: |
colon (Markdown Extra only) |
| | | \| |
pipe (Markdown Extra only) |
\\ \` \* \_ \{\} \[\] \(\) \# \+ \- \. \! \: \|
\ ` * _ {} [] () # + - . ! : |
- Markdown: http://daringfireball.net/projects/markdown/syntax
- PHP Markdown Extra: http://www.michelf.com/projects/php-markdown/extra/
- This page was based on: http://www.thingoid.com/2006/01/markdown-cheat-sheet/
-
Not an orange, but some other fruit of that color. ↩
