Github Flavored Markdown(GFM),是github改进过的Markdown,使得我们可以用易读简洁的纯文本方式编写html,非常方便使用。
本文对GFM的各种语法格式进行收集整理,以便日后查阅。

Line Breaks

End a line with two or more spaces, then type return.

This is an H1
=============
This is an H2
-------------

This is an H1

This is an H2 ————-


# This is an H1
## This is an H2
###### This is an H6

This is an H1

This is an H2

This is an H6

Blockquotes

> 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.
> 
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.

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.

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.


> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.

This is the first level of quoting.

This is nested blockquote.

Back to the first level.


contain other Markdown elements:

> ## 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 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");

Lists

*   Red
*   Green
*   Blue

+   Red
+   Green
+   Blue

-   Red
-   Green
-   Blue
  • Red
  • Green
  • Blue
    • -
1.  Bird
2.  McHale
3.  Parish
  1. Bird
  2. McHale
  3. Parish
1.  This is a list item 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. Donec sit amet nisl. Aliquam semper ipsum
	sit amet velit.

2.  Suspendisse id sem consectetuer libero luctus adipiscing.
  1. This is a list item 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. Donec sit amet nisl. Aliquam semper ipsum sit amet velit.

  2. Suspendisse id sem consectetuer libero luctus adipiscing.


*   A list item with a blockquote:

	> This is a blockquote
	> inside a list item.
  • A list item with a blockquote:

    This is a blockquote inside a list item.

    • -

To put a code block within a list item, the code block needs to be indented twice – 8 spaces or two tabs:

*   A list item with a code block:

		std::cout << "Hello world!" << std::endl;
  • A list item with a code block:

    std::cout << "Hello world!" << std::endl;
    
    • -
1986. What a great season.
  1. What a great season.
1986\. What a great season.

1986. What a great season.


Code Blocks

```javascript
function test() {
  console.log("notice the blank line before this function?");
}
```
function test() {
  console.log("notice the blank line before this function?");
}

Horizontal Rules


* * *

***

*****

- - -

---------------------------------------

This is [an example](http://example.com/ "Title") inline link.

This is an example inline link.


[This link](http://example.net/) has no title attribute.

This link has no title attribute.


I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].

[1]: http://google.com/        "Google"
[2]: http://search.yahoo.com/  "Yahoo Search"
[3]: http://search.msn.com/    "MSN Search"

I get 10 times more traffic from Google than from Yahoo or MSN.


I get 10 times more traffic from [Google](http://google.com/ "Google")
than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
[MSN](http://search.msn.com/ "MSN Search").

I get 10 times more traffic from Google than from Yahoo or MSN.


Emphasis

~~Mistaken text.~~

*single asterisks*

_single underscores_

**double asterisks**

__double underscores__

un*frigging*believable

\*this text is surrounded by literal asterisks\*

Mistaken text.

single asterisks

single underscores

double asterisks

double underscores

unfriggingbelievable

*this text is surrounded by literal asterisks*


Images

![Alt text](https://help.github.com/assets/help/invertocat-1264358d01ae6ae7a728f3c909f51c83.png)

![Alt text](https://help.github.com/assets/help/invertocat-1264358d01ae6ae7a728f3c909f51c83.png "Optional title")

![Alt text][github]

Alt text

Alt text

Alt text

Where “github” is the name of a defined image reference. Image references are defined using syntax identical to link references:

[github]: https://help.github.com/assets/help/invertocat-1264358d01ae6ae7a728f3c909f51c83.png  "Optional title attribute"

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML <img> tags.


<http://example.com/>  
<address@example.com>

http://example.com/ address@example.com


Backslash Escapes

*literal asterisks*  
\*literal asterisks\*

literal asterisks
*literal asterisks*


Markdown provides backslash escapes for the following characters:

\   backslash
`   backtick
*   asterisk
_   underscore
{}  curly braces
[]  square brackets
()  parentheses
#   hash mark
+	plus sign
-	minus sign (hyphen)
.   dot
!   exclamation mark