http://daringfireball.net/projects/markdown/
Setextスタイルのheader.
ヘッダー 1
==========
ヘッダー 2
----------
atxスタイルのheader.
# ヘッダー 1
## ヘッダー 2
### ヘッダー 3
#### ヘッダー 4
##### ヘッダー 5
###### ヘッダー 6
#
で閉じるatxスタイルも対応している. なお閉じ記号の数は合っている必要はない.
# ヘッダー 1 #
## ヘッダー 2 ##
### ヘッダー 3 ######
引用内のテキストは通常と同様に<p>
タグと処理される.
> 引用文は行頭に > を置く.
>
> 引用文内で空白を挟むことで別パラグラフとなる.
>
> ## 引用文内のH2ヘッダー
空行がなければ先頭行のみに>
でもよい.
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
引用文内で他のMarkdown書式が有効.
> ## This is a header.
>
> 1. This is the first list item.
> 2. This is the second list item.
>
> Here's some example code:
>
> return shell_exec("echo $input | $markdown_script");
ネストも可能.
> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.
*アスタリスク* or _アンダースコア_ でemタグによる強調.
2連続の **アスタリスク** or __アンダースコア__ でstrongタグによる強調.
unordered list.
* item 1
* item 2
* item 3
+ item 1
+ item 2
+ item 3
- item 1
- item 2
- item 3
ordered list.
1. item 1
2. item 2
3. item 3
リストアイテム内で改行は許可される(パラグラフは1つ). インデントはしてもしなくても同じ.
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.
空行を挟むことでリストアイテムが<p>
タグで括られる.
* Bird
* Magic
リストアイテム内で複数パラグラフを置く場合はインデント(4 spaces or 1 tab)
* A list item.
With multiple paragraphs.
* Another item in the list.
引用やコードブロックもインデントすればOK. つまりコードブロックであれば 8 spaces 挿入することになる.
* A list item with a blockquote:
> This is a blockquote
> inside a list item.
* A list item with a code block:
<code goes here>
ネストしたリストはインデントしていけばよい.
* aaa
* bbb
* ccc
* ddd
* eee
* fff
* ggg
* hhh
[リンク](http://example.com/)
[リンク](http://example.com/ "リンクタイトル")
リファレンススタイル.
[Google][1], [Yahoo][2], [MSN][3]
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
リファレンススタイルのタイトル文字列を括るのはダブルクォート、シングルクォート、括弧が利用できる.
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ 'Yahoo Search'
[3]: http://search.msn.com/ (MSN Search)
またリンクURLは<
, >
で括ってもよい.
[1]: <http://google.com/> "Google"
リンクURLとリンクタイトルの間にはスペースをいくら挟んでもよく、また改行してもよい(長いURLの場合には改行したほうが見栄えがよい).
[1]: http://google.com/
"Google"
リファレンスのIDを省略すると文字列がそのままIDと見做される.
[Google][]
[Google]: http://google.com/

![altテキスト][id]
[id]: /path/to/img.jpg "タイトル"
バッククォートで括ると `code` タグが適用される.
バッククォートを含む文字列に適用する場合は複数のバッククォートで括ればよい.
``There is a literal backtick (`) here. ``
開くバッククォートの直後と閉じるバッククォートの直前にスペース1つ含むことができる.
`` ` ``
`` `foo` ``
複数行のコードブロックは 4 spaces でインデントする.
<blockquote>
<p>For example.</p>
</blockquote>
アスタリスク or ハイフン or アンダーラインを3つ以上ならべると水平線(<hr />
)となる. スペースを含んでもよい.
***
---
___
* * *
MarkdownからHTML変換時、<
は<
に、&
は&
に自動的にエスケープされる.
行末にスペース2つを置くことで<br />
に変換される.
<
, >
で括ることでリンク扱いとなる.
<http://google.com/>
<[email protected]>
以下文字をリテラルとして扱う場合はバックスラッシュでエスケープを行う.
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] squire brackets
() parentheses
# hash mark
+ plus sign
- minus sign(hyphen)
. dot
! exclamation mark