---
title: "对标记语言的一个非常全的总结"
author: "idning"
date: "2012-01-11T14:06:54Z"
tags: []
categories: ["非技术"]
slug: "untitled"
draft: false
lastmod: "2012-01-11T14:06:54Z"
id: 1341300
url: "https://idning.iteye.com/blog/1341300"
---

突然发现：

这本书应该也不错：

 

[http://www.worldhello.net/gotgithub/index.html](http://www.worldhello.net/gotgithub/index.html)

 

# 7. 附录：轻量级标记语言[](http://www.worldhello.net/gotgithub/appendix/markups.html#markups "永久链接至标题")

没有标记语言就没有Web和丰富多彩的互联网，但创造了Web的HTML语言并非尽善尽美，存在诸如难读、难写、难以向其他格式转换的问题。究其根源是因为HTML语言是一种“重”标记语言，对机器友好而并非对人友好。

下面这段HTML源码，非技术控阅读起来会遇到困难。

```
<html>
<head>
  <meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' />
  <title>轻量级标记语言</title>
</head>
<body>
  <h1 id='id1'>轻量级标记语言</h1>

  <p><strong>轻量级标记语言</strong> 是一种 <em>语法简单</em> 的标记语言。
  它使用易于理解的格式标记，没有古怪的 <code>&lt;标签&gt;</code> 。</p>

  <ul>
  <li>可以使用最简单的文本编辑器编辑。</li>
  <li>所见即所得，非技术控亦可直接阅读源码。</li>
  <li>可版本控制。</li>
  <li>实现单一源文件出版。</li>
  </ul>
<body>
</html>
```

同样的信息如果换用轻量级标记语言来表达，就非常直观了。如下所示：

```
轻量级标记语言
==============

**轻量级标记语言** 是一种 *语法简单* 的标记语言。
它使用易于理解的格式标记，没有古怪的 `<标签>` 。

- 可以使用最简单的文本编辑器编辑。
- 所见即所得，非技术控亦可直接阅读源码。
- 可版本控制。
- 实现单一源文件出版。
```

GitHub另人着迷的一个因素就在于GitHub为用户提供更为便捷地创建UGC（用户生成内容）的方法，其奥秘就在于使用了轻量级标记语言。无论是代码提交说明、提交评注、问题描述、项目的README文件、维基页面、用户主页和项目主页都可以使用Markdown[\[8\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id38)等轻量级标记语言来撰写。轻量级标记语言如Markdown是对人友好的标记语言，一些语法参照了我们写电子邮件时的习惯，即使第一次接触用轻量级标记语言撰写的文件，也可以毫无障碍地理解其中的内容。

虽然GitHub更倾向于使用Markdown标记语言[\[9\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id39)，但很多地方也提供对其他轻量级标记语言的支持。包括为Python程序员所熟悉的reStructedText[\[10\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id40)，为Ruby程序员所熟悉的Textile[\[11\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id41)、RDoc[\[12\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id42)，为Perl程序员所熟悉的POD[\[13\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id43)，为Emacs用户所熟悉的Org-mode[\[14\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id44)，为维基用户所熟悉的MediaWiki[\[15\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id45)和Creole[\[16\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id46)，以及可作为DocBook[\[17\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id47)前端的颇有前途的AsciiDoc[\[18\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id48)标记语言。

下面通过一张表格对几种常用的轻量级标记语言加以对照，供有不同标记语言偏好的用户参考，便于在GitHub某些不能随意更换标记语言而只能使用GFM（GitHub风格的Markdown）的场合可以自如地转换。

在“[*表7-1：常用轻量级标记语言对照*](http://www.worldhello.net/gotgithub/appendix/markups.html#tbl-markups)”中，为使表格更加紧凑使用代号表示各种标记语言。例如：md为Markdown，gfm是GitHub风格的Markdown，rst为reStructedText，ttl为Textile，asc为AsciiDoc，org为Org-mode。

表7-1：常用轻量级标记语言对照          类别 标记语言 代码示例 输出示例 MD RST TTL ASC ORG 标题 md        

```
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题
```

输出略。

注解

Atx风格标题后面可接匹配的井号。

  rst      

```
一级标题
========

二级标题
--------

三级标题
^^^^^^^^
```

输出略。

注解

reST标题可用下列符号标记： # * = - ^ ~ \` : . _ + ” 等。

    ttl    

```
h1. 一级标题
h2. 二级标题
h3. 三级标题
h4. 四级标题
h5. 五级标题
h6. 六级标题
```

输出略。       asc  

```
AsciiDoc 提供两种风格的标题。

文档标题
========

一级标题
--------

二级标题
~~~~~~~~

三级标题
^^^^^^^^

四级标题
++++++++

或者使用下面单行标题风格进行定义。

= 文档标题 =
== 一级标题 ==
=== 二级标题 ===
==== 三级标题 ====
===== 四级标题 =====
```

输出略。

注解

除了两种不同风格的标题外，还支持以点开始的块标题，块标题不生成目录。如：

```
.BlockTitle
```

        org

```
* 一级标题
** 二级标题
*** 三级标题
```

输出略。

注解

为支持更多标题级别需要设置 `#+OPTIONS:H:6`。

段落 空行分段 md rst ttl* asc org

```
一个回车不分段，
本行续上行。

空行开始新段落。
```

一个回车不分段，°本行续上行。

空行开始新段落。

无空白续行   rst      

```
行尾转义字符让\
续行之间无空格。
```

行尾转义字符让续行之间无空格。 插入换行 md        

```
行尾两空格°°
保持换行。
```

行尾两空格

保持换行。

gfm   ttl    

```
GFM、Textile等
保持段落内换行符。
```

GFM、Textile等

保持段落内换行符。

  rst      

```
| 保持换行符，
| 本行不续行。
```

保持换行符，

本行不续行。

  rst      

```
.. role:: raw-html(raw)
   :format: html

用新定义的role插入换行，
:raw-html:`<br />`
本行不再续行。
```

用新定义的role插入换行，   
本行不再续行。       asc  

```
行尾的空格和加号 +
保持换行。
```

行尾的空格和加号

保持换行。

        org*

```
行尾两个反斜线\\
保持段落内换行符。
```

行尾两个反斜线

保持段落内换行符。

        org

```
#+BEGIN_VERSE
 保持换行符，
 本行不续行。
#+END_VERSE
```

保持换行符，

本行不续行。

段落缩进 md rst      

```
邮件体段落缩进：

> 第一级段落缩进。
>
> > 第二级段落缩进。
>
> 返回一级段落缩进。
```

邮件体段落缩进：

> 第一级段落缩进。
> 
> > 第二级段落缩进。
> 
> 返回一级段落缩进。

  rst      

```
Python式段落缩进：

  第一级段落缩进。

    第二级段落缩进。

  返回一级段落缩进。
```

Python式段落缩进：

> 第一级段落缩进。
> 
> > 第二级段落缩进。
> 
> 返回一级段落缩进。

    ttl    

```
Textile式段落缩进：

bq. 本段缩进。

正常段落。

bq.. 注意缩进关键字后有两个点。

后续段落持续缩进，
直至遇到 p. 定义的段落。

p. 正常段落不再缩进。
```

Textile式段落缩进：

> 本段缩进。

正常段落。

> 注意缩进关键字后有两个点。
> 
> 后续段落持续缩进，
> 
> 直至遇到 p. 定义的段落。

正常段落不再缩进。

      asc  

```
四个或以上的下划线括起的区域为引言缩进。

[quote, author, source]
______________________________
引言...
______________________________
```

四个或以上的下划线括起的区域为引言缩进。

> 引言...
> 
> > source
> > 
> > —— author

        org

```
Org-mode式段落缩进：

#+BEGIN_QUOTE
 段落缩进。
#+END_QUOTE
```

Org-mode式段落缩进：

> 段落缩进。

代码块 md        

```
四个空格缩进是代码块：

    $ printf "Hello, world.\n"
```

四个空格缩进是代码块：

```
$ printf "Hello, world.\n"
```

gfm        

````
三个连续的`或~等符号界定代码块。

```ruby
require 'redcarpet'
md = Redcarpet.new("Hello, world.")
puts md.to_html
```
````

三个连续的\`或~等符号界定代码块。

```
require 'redcarpet'
md = Redcarpet.new("Hello, world.")
puts md.to_html
```

  rst      

```
双冒号后缩进为代码块。

::

  $ printf "Hello, world.\n"

还可声明语言类型实现语法加量。

.. code-block:: sh

   $ printf "Hello, world.\n"
```

双冒号后缩进为代码块。

```
$ printf "Hello, world.\n"
```

还可声明语言类型实现语法加量。

```
$ printf "Hello, world.\n"
```

    ttl    

```
以bc.或bc..指令开头的是代码块。

bc.. $ git init

$ git commit --allow-empty

p. 本段不再是代码块。
```

以bc.或bc..指令开头的是代码块。

```
$ git init

$ git commit --allow-empty
```

本段不再是代码块。

    ttl    

```
原样格式输出，相当于<PRE>标签。

pre..
           更上一层楼
欲穷千里目

p. 恢复正常段落。
```

原样格式输出，相当于&lt;PRE&gt;标签。

```
           更上一层楼
欲穷千里目
```

恢复正常段落。

      asc  

```
四个或更多减号括起代码块，
还可声明语言种类。

[source, c]
-----------------------------
#include <stdio.h>

int main() {
   printf("Hello World!\n");
   exit(0);
}
-----------------------------
```

四个或更多减号括起代码块， 还可声明语言种类。

```
#include <stdio.h>

int main() {
   printf("Hello World!\n");
   exit(0);
}
```

      asc  

```
正常段落。

  缩进段落相当于添加<pre>标签，
  等宽字体，原样输出。

缩进会和其他语法如列表相混淆，
可用 `[literal]` 显示声明。

[literal]
原样输出，
显示为等宽字体。

或用四个以上点组成的定界符标记。

..............................
原样输出，
显示为等宽字体。
..............................
```

正常段落。

```
缩进段落相当于添加<pre>标签，
等宽字体，原样输出。
```

缩进会和其他语法如列表相混淆， 可用`[literal]` 显示声明。

```
原样输出，
显示为等宽字体。
```

或用四个以上点组成的定界符标记。

```
原样输出，
显示为等宽字体。
```

        org

```
下面是代码块。

#+BEGIN_SRC ruby
  require 'redcarpet'
  md = Redcarpet.new("Hello, world.")
  puts md.to_html
#+END_SRC
```

下面是代码块。

```
require 'redcarpet'
md = Redcarpet.new("Hello, world.")
puts md.to_html
```

列表 无序列表 md rst      

```
* 星号、减号、加号开始列表。

  - 列表层级和缩进有关。

    + 和具体符号无关。

* 返回一级列表。
```

- 星号、减号、加号开始列表。
  
  - 列表层级和缩进有关。
    
    - 和具体符号无关。
- 返回一级列表。

    ttl    

```
* 星号开始无序列表。
** 更多星号代表不同层级。
*** 三级列表。
* 返回一级列表。
```

- 星号开始无序列表。
  
  - 更多星号代表不同层级。
    
    - 三级列表。
- 返回一级列表。

      asc  

```
- 1个减号开始列表。
* 或1到5个星号开始列表。
** 三级列表。
- 返回一级列表。
```

- 1个减号开始列表。
  
  - 或1到5个星号开始列表。
    
    - 三级列表。
- 返回一级列表。

        org

```
列表语法和Markdown、reST类似。
星号和列表语法冲突需缩进，不建议使用。

  - 减号、加号开始列表。

    + 列表层级和缩进有关。

      - 和具体符号无关。

  - 返回一级列表。
```

列表语法和Markdown、reST类似。 星号和列表语法冲突需缩进，不建议使用。

- 减号、加号开始列表。
  
  - 列表层级和缩进有关。
    
    - 和具体符号无关。
- 返回一级列表。

有序列表 md        

```
1. 数字和点开始有序列表。

   1. 注意子列表的缩进位置。

      1. 三级列表。
      1. 编号会自动更正。

   1. 二级列表，编号自动更正为2。

2. 返回一级列表。
```

1. 数字和点开始有序列表。
   
   1. 注意子列表的缩进位置。
      
      1. 三级列表。
      2. 编号会自动更正。
   2. 二级列表，编号自动更正为2。
2. 返回一级列表。

  rst      

```
1. 数字和点是一种编号方式。

   A. 大写字母编号。

      a. 小写字母编号。

2. 继续一级列表。

   (I) 大写罗马编号。

       i) 小写罗马编号。
```

1. 数字和点是一种编号方式。
   
   1. 大写字母编号。
      
      1. 小写字母编号。
2. 继续一级列表。
   
   1. 大写罗马编号。
      
      1. 小写罗马编号。

    ttl    

```
# 井号开始有序列表。
# 有序列表自动编号。
## 更多井号代表不同层级。
### 三级列表。
# 返回一级列表。
```

1. 井号开始有序列表。
2. 有序列表自动编号。
   
   1. 更多井号代表不同层级。
      
      1. 三级列表。
3. 返回一级列表。

      asc  

```
1. 和reST一样支持多种编号方式。
a. 层级靠列表风格决定，而非缩进。
A. 三级列表。
b. 返回二级列表。
i) 罗马数字列表。
IX)  大写罗马。编号自动纠正。
2. 返回一级列表。
```

注解

还可以用1到5个点开始有序列表， 自动按数字、字母方式编号。如：

```
. 数字一级列表。
.. 字母二级列表。
... 罗马数字三级列表。
.... 大写字母四级列表。
..... 大写罗马五级列表。
```

1. 和reST一样支持多种编号方式。
   
   1. 层级靠列表风格决定，而非缩进。
      
      1. 三级列表。
   2. 返回二级列表。
      
      1. 罗马数字列表。
         
         1. 大写罗马。编号自动纠正。
2. 返回一级列表。

        org

```
1. 数字和点或右括号开始有序列表。

   1) 缩进即为子列表。

      1. 三级列表。
      1. 编号会自动更正。

   2) 二级列表。

2. 返回一级列表。
```

1. 数字和点或右括号开始有序列表。
   
   1. 缩进即为子列表。
      
      1. 三级列表。
      2. 编号会自动更正。
   2. 二级列表。
2. 返回一级列表。

列表续行、段落和代码块 md        

```
1. 列表项可以折行，
   对齐则自动续行。

2. 列表项可包含多个段落。

    空行开始的新段落必须缩进四个空格，
    段落才属于列表项。

3. 列表中的代码块要缩进8个空格。

        $ printf "Hello, world.\n"
```

1. 列表项可以折行， 对齐则自动续行。
2. 列表项可包含多个段落。
   
   空行开始的新段落必须缩进四个空格， 段落才属于列表项。
3. 列表中的代码块要缩进8个空格。
   
   ```
   $ printf "Hello, world.\n"
   ```

  rst      

```
1. 列表项可以折行，
   对齐则自动续行。

2. 列表项可包含多个段落。

   空行开始的新段落，
   新段落要和列表项内容对齐。

3. 列表下的代码段注意对齐即可。

   ::

     $ printf "Hello, world.\n"
```

1. 列表项可以折行， 对齐则自动续行。
2. 列表项可包含多个段落。
   
   空行开始的新段落， 新段落要和列表项内容对齐。
3. 列表下的代码段注意对齐即可。
   
   ```
   $ printf "Hello, world.\n"
   ```

      asc  

```
1. 列表项可以折行，
   对齐则自动续行。

2. 列表项可包含多个段落。
+
加号代表本段落属于列表。
+
--
两个减号包裹的块作为一整体
属于列表。

其中分段无需再使用加号。
--

3. 注意列表项内代码段前空行用加号替换。
+
--------
$ printf "Hello, world.\n"
--------
```

1. 列表项可以折行， 对齐则自动续行。
2. 列表项可包含多个段落。
   
   加号代表本段落属于列表。
   
   两个减号包裹的块作为一整体 属于列表。
   
   其中分段无需再使用加号。
3. 注意列表项内代码段前空行用加号替换。
   
   ```
   $ printf "Hello, world.\n"
   ```

        org

```
1. 列表项可以折行，
   对齐则自动续行。

2. 列表项可包含多个段落。

   空行开始的新段落，
   新段落要和列表项内容对齐。

3. 列表下的代码段注意对齐即可。

   #+BEGIN_SRC bash
     $ printf "Hello, world.\n"
   #+END_SRC
```

1. 列表项可以折行， 对齐则自动续行。
2. 列表项可包含多个段落。
   
   空行开始的新段落， 新段落要和列表项内容对齐。
3. 列表下的代码段注意对齐即可。
   
   ```
   $ printf "Hello, world.\n"
   ```

定义   rst      

```
git
  Simple and beautiful.

hg
  Another DVCS.

subversion
  VCS with many constrains.

  Why not Git?
```

git

Simple and beautiful.

hg

Another DVCS.

subversion

VCS with many constrains.

Why not Git?

    ttl    

```
- git := Simple and beautiful.
- hg := Another DVCS.
- subversion :=
VCS with many constrains.

Why not Git? =:
```

git

Simple and beautiful.

hg

Another DVCS.

subversion

VCS with many constrains.

Why not Git?

      asc  

```
git ::
    Simple and beautiful.
hg :: Another DVCS.
subversion :: VCS with many constrains.
              +
              Why not Git?
```

git

Simple and beautiful.

hg

Another DVCS.

subversion

VCS with many constrains.

Why not Git?

        org

```
- git :: Simple and beautiful.
- hg :: Another DVCS.
- subversion :: VCS with many constrains.

                Why not Git?
```

git

Simple and beautiful.

hg

Another DVCS.

subversion

VCS with many constrains.

Why not Git?

分隔线 md   ttl    

```
三条短线或以上显示为分隔线。

---
```

输出略。   rst      

```
四条短线或以上显示为分隔线。

----
```

输出略。       asc  

```
三个或更多的单引号作为分割线。

'''
```

输出略。         org

```
五条短线或以上显示为分隔线。

-----
```

输出略。 字体 粗体和斜体 md        

```
这些都是 **粗体** 或 __粗体__ ，
这写都是 *斜体* 或 _斜体_ 。
```

这些都是 **粗体** 或 **粗体** ， 这些都是 *斜体* 或*斜体* 。   rst      

```
这是 **粗体** ，这是 *斜体* 。

不留白的\ **粗体**\ 和\ *斜体*\ 效果。
```

这是 **粗体** ，这是 *斜体* 。

不留白的**粗体**和*斜体*效果。

    ttl    

```
这些都是 *粗体* 或 **粗体** ，
这些都是 _斜体_ 或 __斜体__ 。
```

这些都是 **粗体** 或 **粗体** ， 这些都是 *斜体* 或*斜体* 。       asc  

```
这是 *粗体* ，
这是 _斜体_ 或 '斜体' 。

不留白的**粗体**和__斜体__效果。
```

这是 **粗体** ， 这是 *斜体* 或 *斜体* 。

不留白的**粗体**和*斜体*效果。

        org

```
这是 *粗体* ，这是 /斜体/ 。
```

这是 **粗体** ，这是 *斜体* 。 删除线 gfm        

```
~~删除线~~ 效果
```

删除线 效果   rst      

```
.. role:: strike
   :class: strike

:strike:`删除线` 效果

不留白的\ :strike:`删除线`\ 效果
```

删除线 效果

不留白的删除线效果

    ttl    

```
-删除线- 效果
```

删除线 效果       asc  

```
[line-through]#删除线# 效果

不留白的[line-through]##删除线##效果
```

删除线 效果

不留白的删除线效果

        org

```
+删除线+ 效果
```

删除线 效果 下划线 md        

```
<u>下划线</u> 效果
```

下划线 效果   rst      

```
.. role:: ul
   :class: underline

:ul:`下划线` 效果

不留白的\ :ul:`下划线`\ 效果
```

下划线 效果

不留白的下划线效果

    ttl    

```
+下划线+ 效果
```

下划线 效果       asc  

```
[underline]#下划线# 效果

不留白的[underline]##下划线##效果
```

下划线 效果

不留白的下划线效果

        org

```
_下划线_ 效果
```

下划线 效果 上标、下标 md        

```
* Water: H<sub>2</sub>O
* E = mc<sup>2</sup>
```

- Water: H2O
- E = mc2

注解

通过直接嵌入HTML代码实现。

  rst      

```
* Water: H\ :sub:`2`\ O
* E = mc\ :sup:`2`
```

- Water: H2O
- E = mc2

    ttl    

```
* Water: H ~2~ O
* E = mc ^2^
```

- Water: H 2 O
- E = mc 2

      asc  

```
* Water: H~2~O
* E = mc^2^
```

- Water: H2O
- E = mc2

        org

```
* Water: H_2 O
* E = mc^2
```

- Water: H2 O
- E = mc2

等宽字体 md     asc  

```
行内反引号嵌入代码，如: `git status` 。
```

行内反引号嵌入代码，如: `git status` 。   rst      

```
两个连续反引号嵌入代码，如: ``git status`` 。
```

两个连续反引号嵌入代码，如: `git status`。

注解

相当于 :literal:\`git status\` 。 只用一个反引号则相当于 :title-reference:\`引言\` 。

    ttl    

```
行内用字符@嵌入代码，如: @git status@ 。
```

行内用字符@嵌入代码，如: `git status` 。       asc  

```
行内用字符+标识等宽字体，如: +git status+ 。
```

行内用字符+标识等宽字，如: `git status`。         org

```
行内用字符=或~嵌入代码，如:
=git status= 和 ~git st~ 。
```

行内用字符=或~嵌入代码，如: `git status`和 `git st` 。 引言   rst      

```
`Got GitHub` by Jiang Xin.
```

Got GitHub by Jiang Xin.     ttl    

```
??Got GitHub?? by Jiang Xin.
```

Got GitHub by Jiang Xin. 清除标记空白   rst      

```
标记符号前后空白\
用\ **反斜线**\ 消除
```

标记符号前后空白用**反斜线**消除 链接 URL自动链接 gfm rst   asc org

```
* 网址 http://github.com/
* 邮件 me@foo.bar
```

- 网址 [http://github.com/](http://github.com/)
- 邮件 [me@foo.bar](mailto:me%40foo.bar)

文字链接 md        

```
* 访问 [Google](http://google.com "Search")
* 访问 [GitHub][1]
* 访问 [WorldHello][]

 [1]: http://github.com "Git host"
 [worldhello]: http://www.worldhello.net
```

- 访问 [Google](http://google.com/)
- 访问 [GitHub](http://github.com/)
- 访问 [WorldHello](http://www.worldhello.net/)

  rst      

```
* 访问 `Google <http://google.com/>`_ 。
* 上面已定义，直接引用 google_ 链接。
* 链接地址在后面定义，如： GitHub_ 。
* 反引号括起多个单词的链接。如 `my blog`_ 。

.. _GitHub: http://github.com
.. _my blog: http://www.worldhello.net
```

- 访问 [Google](http://google.com/)。
- 上面已定义，直接引用 [google](http://google.com/) 链接。
- 链接地址在后面定义，如： [GitHub](http://github.com/)。
- 反引号括起多个单词的链接。如 [my blog](http://www.worldhello.net/)。

    ttl    

```
* 访问 "Google (Search)":https://google.com
* 访问 "GitHub (Git host)":github
* 访问 "WorldHello":wh

[github]http://github.com
[wh]http://www.worldhello.net
```

- 访问 [Google](https://google.com/)
- 访问 [GitHub](http://github.com/)
- 访问 [WorldHello](http://www.worldhello.net/)

      asc  

```
* 访问 http://google.com[Google]
* 访问 link:/index.html[首页]
```

- 访问 [Google](http://google.com/)
- 访问 [首页](http://www.worldhello.net/index.html)

        org

```
* 访问 [[http://google.com][Google]]
```

- 访问 [Google](http://google.com/)

内部跳转 md        

```
<a name="md-anchor" id="md-anchor"></a>

跳转至 [文内链接](#md-anchor) 。
```

跳转至 [文内链接](http://www.worldhello.net/gotgithub/appendix/markups.html#md-anchor) 。

  rst      

```
.. _fig1:

.. figure:: /images/github.png

   内部跳转图例

上面定义的位置，可以：

* 通过 fig1_ 跳转。
* 或者 `点击这里 <#fig1>`__ 跳转。
* 或者参见 :ref:`fig1`\ 。
```

![../images/github.png](http://www.worldhello.net/gotgithub/images/github.png)

内部跳转图例

上面定义的位置，可以：

- 通过 [fig1](http://www.worldhello.net/gotgithub/appendix/markups.html#fig1) 跳转。
- 或者 [点击这里](http://www.worldhello.net/gotgithub/appendix/markups.html#fig1) 跳转。
- 或者参见 [*内部跳转图例*](http://www.worldhello.net/gotgithub/appendix/markups.html#fig1)。

    ttl    

```
<a name="ttl-anchor" id="ttl-anchor"></a>

跳转至 "文内链接":#ttl-anchor 。
```

跳转至 [文内链接](http://www.worldhello.net/gotgithub/appendix/markups.html#ttl-anchor) 。

      asc  

```
两种方式在这儿定义内部链接。

[[alink1,链接标题1]]
anchor:alink2[链接标题2]

指向位置：

- 跳转至 <<alink1,内部链接1>>
- 跳转至 xref:alink2[]
```

两种方式在这儿定义内部链接。

指向位置：

- 跳转至 [内部链接1](http://www.worldhello.net/gotgithub/appendix/markups.html#alink1)
- 跳转至 [链接标题2](http://www.worldhello.net/gotgithub/appendix/markups.html#alink2)

        org

```
# <<org-anchor>>

跳转至 [[#org-anchor][文内链接]]
```

跳转至 [文内链接](http://www.worldhello.net/gotgithub/appendix/markups.html#org-anchor) 。

GitHub提交和问题链接 gfm        

```
* SHA: cea00609ca8441c82bc9760ae5eea...
* User@SHA ref: mojombo@cea00609ca84...
* User/Project@SHA:
  mojombo/god@cea00609ca8441c82bc976...
* \#Num: #1
* User/#Num: mojombo#1
* User/Project#Num: mojombo/god#1
```

- SHA: cea00609ca8441c82bc...
- User@SHA ref: mojombo@cea00609ca8...
- User/Project@SHA: mojombo/god@cea0060... [\[19\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id49)
- #Num: #1
- User/#Num: mojombo#1
- User/Project#Num: mojombo/god#1 [\[20\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id50)

脚注   rst      

```
reST脚注的多种表示法：

* 脚注即可以手动分配数字 [1]_ ，
  也可以使用井号自动分配 [#]_ 。

* 自动分配脚注 [#label]_ 也可以用
  添加标签形式 [#label]_ 多次引用。

* 还支持用星号嵌入符号式脚注，
  如这个 [*]_ 和 这个 [*]_ 。

* 使用单词做标识亦可 [CIT2012]_ 。


.. [1] 数字编号脚注。
.. [#] 井号自动编号。
.. [#label] 井号添加标签以便多次引用。
.. [*] 星号自动用符号做脚注标记。
.. [*] 星号自动用符号做脚注标记。
.. [CIT2012] 单词或其他规定格式。
```

reST脚注的多种表示法：

- 脚注即可以手动分配数字[\[1\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id25)， 也可以使用井号自动分配[\[2\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id26)。
- 自动分配脚注[\[3\]](http://www.worldhello.net/gotgithub/appendix/markups.html#label)也可以用添加标签形式[\[3\]](http://www.worldhello.net/gotgithub/appendix/markups.html#label)多次引用。
- 还支持用星号嵌入符号式脚注， 如这个[\[\*\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id27)和 这个[\[†\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id28)。
- 使用单词做标识亦可[\[CIT2012\]](http://www.worldhello.net/gotgithub/appendix/markups.html#cit2012)。

  [\[1\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id18) 数字编号脚注。

  [\[2\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id19) 井号自动编号。

  \[3] *([1](http://www.worldhello.net/gotgithub/appendix/markups.html#id20), [2](http://www.worldhello.net/gotgithub/appendix/markups.html#id21))* 井号添加标签以便多次引用。

  [\[\*\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id22) 星号自动用符号做脚注标记。

  [\[†\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id23) 星号自动用符号做脚注标记。

  [\[CIT2012\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id24) 单词或其他规定格式。

    ttl    

```
Textile是Redmine [4] 内置的标记语言。

fn4. http://goo.gl/rGyvs
```

Textile是Redmine [\[4\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id30) 内置的标记语言。

  [\[4\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id29) [http://goo.gl/rGyvs](http://goo.gl/rGyvs)

      asc  

```
- 内联方式 footnote:[此处定义] 定义的脚注。
- 定义脚注时可用一个ID标记
  footnoteref:[note6, 可多次引用] 。
- 引用已定义的脚注 footnoteref:[note6] 。
```

- 内联方式 [\[5\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id34) 定义的脚注。
- 定义脚注时可用一个ID标记 [\[6\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id35) 。
- 引用已定义的脚注 [\[6\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id35) 。

  [\[5\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id31) 此处定义

  \[6] *([1](http://www.worldhello.net/gotgithub/appendix/markups.html#id32), [2](http://www.worldhello.net/gotgithub/appendix/markups.html#id33))* 可多次引用

        org

```
Twitter widget in Org homepage[fn:org]
cannot be accessed in Mainland China, which
caused the homepage load very slowly. >:[

[fn:org] The link is: http://orgmode.org
```

Twitter widget in Org homepage [\[7\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id37)cannot be accessed in Mainland China, which caused the homepage load very slowly. &gt;:[

  [\[7\]](http://www.worldhello.net/gotgithub/appendix/markups.html#id36) The link is: [http://orgmode.org](http://orgmode.org/)

图片 md        

```
![GitHub](/images/github.png "Logo")

GitHub Logo: ![GitHub][logo]

[logo]: /images/github.png "Logo"
```

![../images/github.png](http://www.worldhello.net/gotgithub/images/github.png)

GitHub Logo: ![logo](http://www.worldhello.net/gotgithub/images/github.png)

  rst      

```
.. figure:: /images/github.png
   :width: 32

   图：GitHub Octocat

* GitHub Logo: |octocat|
* 带链接的图片：
  |imglink|_
* 下图向右浮动。
   .. image:: /images/github.png
      :align: right

.. |octocat| image:: /images/github.png
.. |imglink| image:: /images/github.png
.. _imglink: https://github.com/
```

![../images/github.png](http://www.worldhello.net/gotgithub/images/github.png)

图：GitHub Octocat

- GitHub Logo: ![octocat](http://www.worldhello.net/gotgithub/images/github.png)
- 带链接的图片： [![imglink](http://www.worldhello.net/gotgithub/images/github.png)](https://github.com/)
- 下图向右浮动。
  
  ![../images/github.png](http://www.worldhello.net/gotgithub/images/github.png)

    ttl    

```
* GitHub Logo: !/images/github.png(Logo)!
* 带链接的图片：
  !/images/github.png!:https://github.com/
* 下图向右浮动。
  !>/images/github.png!
```

- GitHub Logo: ![icon](http://www.worldhello.net/gotgithub/images/github.png)
- 带链接的图片： [![imglink2](http://www.worldhello.net/gotgithub/images/github.png)](https://github.com/)
- 下图向右浮动。
  
  ![../images/github.png](http://www.worldhello.net/gotgithub/images/github.png)

      asc  

```
.GitHub Octocat
image::/images/github.png["Logo",width=32]

- GitHub Logo:
  image:/images/github.png["Logo"]
```

![../images/github.png](http://www.worldhello.net/gotgithub/images/github.png)

图：GitHub Octocat

- GitHub Logo: ![ascimg](http://www.worldhello.net/gotgithub/images/github.png)

        org

```
* GitHub Logo: [[file:/images/github.png]]
* 带链接的图片：
  [[https://github.com/][file:/images/...]]
```

- GitHub Logo: ![orgimg](http://www.worldhello.net/gotgithub/images/github.png)
- 带链接的图片： [![orgimglink](http://www.worldhello.net/gotgithub/images/github.png)](https://github.com/)

表格 gfm        

```
head1 | head2  | head2
------|:------:|------:
left  | center | right
left  | center | right
```

   head1 head2 head3 left center right left center right

  rst      

```
.. table:: 示例表格
   :class: classic

   +---------+--------+--------+
   | head1   | head2  | head3  |
   +=========+========+========+
   |         | cell   | cell   |
   | rowspan +--------+--------+
   |         | * colspan       |
   |         | * another line  |
   +---------+-----------------+
```

示例表格    head1 head2 head3 rowspan cell cell

- colspan
- another line

    ttl    

```
|_. head1 |_. head2 |_. head3 |
|/3. rowspan | cell  | cell |
|\2. colspan |
| cell | cell |
```

示例表格    head1 head2 head3 rowspan cell cell colspan cell | cell

      asc  

```
[width="50%"]
|============================
|1 |2 |3 |4
|5 2.2+|6 .3+|7
|8
|9 2+|10
|============================
```

    1 2 3 4 5 6 7 8 9 10

        org

```
#+CAPTION: 示例表格
#+LABEL: tblref
   | head1 | head2 | head3 |
   |-------+-------+-------|
   | cell  | cell  | cell  |
   | cell  | cell  | cell  |
```

示例表格    head1 head2 head3 cell cell cell cell cell cell

其他 混用HTML md        

```
<div style="background:#bbb;">
  HTML块中不能混用 **标记语法**
</div>
```

输出略。       ttl    

```
<div style="background:#bbb;">
  HTML块中可以混用 **标记语法**
</div>
```

输出略。 禁止语法解析   rst      

```
反斜线作为转义字符，\
禁止对后面 \*字符\* 做语法解析。
```

反斜线作为转义字符，禁止对后面 \*字符* 做语法解析。     ttl    

```
用 notextile 标记的段落不进行语法解析。

notextile. 不进行 *语法解析* 。
```

用 notextile 标记的段落不进行语法解析。

不进行 \*语法解析* 。

注释   rst      

```
.. 注释

..
   缩进内容也是注释
```

无输出。       asc  

```
/////////////////
四个或更多的斜线包围起来的
文字块是注释，被忽略。
/////////////////
```

无输出。         org

```
# 行首井号是注释。

  #+ 缩进行首用 ``#+`` 标记为注释。


  #+BEGIN_COMMENT
   块注释
   ...
  #+END_COMMENT
```

无输出。

注解

部分标记语言代号后添加了星标，代表该标记语言相应的语法实现稍有区别，或者GitHub的具体实现和标准有出入。