Markdown 入门指南

段落

段落就是被空行分割的文本;空行可以是空格和制表符;并且,正常的段落是没有缩进的;

Markdown的一些属性会影响一段;为了上下内容不被这些属性影响,中间插入空行。

标题

标题有两种格式; Setextatx

Setext 使用等号=和连字符-分别定义一级和二级标题;

atx使用#, 在一行开始加1-6个#分别定义1-6级标题;

引用

使用尖括号>定义

Markdown:

A First Level Header
====================

A Second Level Header
---------------------

Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.

The quick brown fox jumped over the lazy
dog's back.

### Header 3

> This is a blockquote.
> 
> This is the second paragraph in the blockquote.
>
> ## This is an H2 in a blockquote

HTML Output:

<h1>A First Level Header</h1>

<h2>A Second Level Header</h2>

<p>Now is the time for all good men to come to
the aid of their country. This is just a
regular paragraph.</p>

<p>The quick brown fox jumped over the lazy
dog's back.</p>

<h3>Header 3</h3>

<blockquote>
    <p>This is a blockquote.</p>

    <p>This is the second paragraph in the blockquote.</p>

    <h2>This is an H2 in a blockquote</h2>
</blockquote>

强调-斜体与加粗

星号与下划线用来标记强调;

Markdown:

Some of these words *are emphasized*.
Some of these words _are emphasized also_.

Use two asterisks for **strong emphasis**.
Or, if you prefer, __use two underscores instead__.

HTML Output:

<p>Some of these words <em>are emphasized</em>.
Some of these words <em>are emphasized also</em>.</p>

<p>Use two asterisks for <strong>strong emphasis</strong>.
Or, if you prefer, <strong>use two underscores instead</strong>.</p>

列表

列表分为无序和有序两种;

无序列表:*+, -标记

*   Candy.
*   Gum.
*   Booze.
+   Candy.
+   Gum.
+   Booze.
-   Candy.
-   Gum.
-   Booze.

HTML Output:

<ul>
<li>Candy.</li>
<li>Gum.</li>
<li>Booze.</li>
</ul>

有序列表使用数字定义:

1.  Red
2.  Green
3.  Blue

HTML Output:

<ol>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ol>

链接

分为内联与引用,都是使用中括号将文本定义为链接;

内联:

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

HTML Output:

<p>This is an <a href="http://example.com/">
example link</a>.</p>

参考链接:

你可以在任何位置定义好链接,然后引用即可;

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"

Output:

<p>I get 10 times more traffic from <a href="http://google.com/"
title="Google">Google</a> than from <a href="http://search.yahoo.com/"
title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
title="MSN Search">MSN</a>.</p>

图片:

内联:

![alt text](/path/to/img.jpg "Title")

参考链接:

![alt text][id]

[id]: /path/to/img.jpg "Title"

代码

反向引号(`)

一对` `标记范围为他们之间;

三对``` ```标记它们之间的整段为代码;

整段标记为代码还可以使用制表符(tab)或四个空格缩进段首即可成功;

表格

第一种表示方法:

| Header | Column1 | Column2 |
| -------|:-------:| -------:|
| Row1   | 1       | 2       |
| Row2   | 2       | 3       |
Header Column1 Column2
Row1 1 2
Row2 2 3

第二种表示方法:

 Header | Column1 | Column2 
 -------|:-------:| -------:
 Row1   | 1       | 2       
 Row2   | 2       | 3  
Header Column1 Column2
Row1 1 2
Row2 2 3

原文:
Markdown: Basics

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Markdown:Basics(快速入门) 段落、标题、区块代码 一个段落是由一个以上的连接的行句组成,而一个以上...
    TomGui阅读 417评论 0 0
  • 段落、标题、区块代码 一个段落是由一个以上的连接的行句组成,而一个以上的空行则会划分出不同的段落(空行的定义是显示...
    garyond阅读 207评论 0 2
  • Markdown 1. 兼容HTML Markdown语法的目标是:成为一种适用于网络的书写语言。Markdown...
    晴天sy阅读 345评论 0 0
  • 注:详细内容请前往此处。Dingus 是一个网页应用程序,你可以把自已编写的 Markdown 文档转成 XHTM...
    Kevin_简书阅读 210评论 0 0
  • 如果你追求极简,恨不得直接用记事本来写文章,那么Markdown将会是你的得力工具。因为它简单,优雅,只需几个标记...
    天边风阅读 208评论 0 0