学习Markdown(一)

基本 Markdown 语法

Markdown是一种易于编写和易于阅读的纯文本格式,您可以使用它写作,然后将其转换为html文件,放在Github(或Blog中或是其他地方)以供访问和阅读。

基本的写作方法

段落

Markdown的段落是间隔着一行或多行空白行的一行或多行连续的文本。(就像在html中使用<p>元素添加段落一样)

例如:

On July 2, an alien mothership entered Earth's orbit and deployed several dozen saucer-shaped "destroyer" spacecraft, each 15 miles (24 km) wide.

On July 3, the Black Knights, a squadron of Marine Corps F/A-18 Hornets, participated in an assault on a destroyer near the city of Los Angeles.  

标题

可以通过在标题前添加一个或多个‘#’来创建一个标题,使用#的数目将会改变标题的大小。

#h1 tag
##h2 tag
###h3 tag
……

引用文字

可以使用“>”表明一段引用

毛主席说:
>虚心使人进步,骄傲使人落后。

文本样式

使用“*”添加斜体

*This text will be italic*  

使用“**”添加粗体

**This text will be bold**  

如果需要同时创建加粗和斜体的文本样式,可以使用"*"或者"_"包含内容。

**Everyone _must_ attend the meeting at 5 o'clock today.**

无序列表

使用‘*’或者‘-’和一个空格创建无序列表。

* Item
* Item
* Item

- Item
- Item
- Item  

有序列表

使用序号1,2,3加上‘.’再加上空格创建有序列表

1. Item 1
2. Item 2
3. Item 3

嵌套列表

在下一行缩进2个空格以创建嵌套列表

1. Item 1
  1. A corollary to the above item.
  2. Yet another point to consider.
2. Item 2
  * A corollary that does not need to be ordered.
    * This is indented four spaces, because it's two spaces further than the item above.
    * You might want to consider making a new list.
3. Item 3  

格式化的代码

使用``标记来保护单行代码或语句

Here's an idea: why don't we take `SuperiorProject` and turn it into `**Reasonable**Project`.

使用```来包含代码块

Check out this neat program I wrote:

```
x = 0
x = 2 + 2
what is x
```

(也可以给代码块的每行统一添加TAB)

链接

使用[]()的格式创建链接,在[]中填写文本,在()中填入URL即可。
例如:
Visit GitHub!

[Visit GitHub!](www.github.com)

本文翻译自Github Help Markdown Basic

posted @ 2015-05-06 21:21  秦风无衣  阅读(83)  评论(0)    收藏  举报