| spec.txt | spec.txt | |||
|---|---|---|---|---|
| --- | --- | |||
| 标题: CommonMark 规范 | 标题: CommonMark 规范 | |||
| 作者: John MacFarlane | 作者: John MacFarlane | |||
| version: 0.25 | version: 0.26 | |||
| date: '2016-03-24' | date: '2016-07-15' | |||
| 许可: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)' | 许可: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)' | |||
| ... | ... | |||
| # 引言 | # 引言 | |||
| ## 什么是 Markdown? | ## 什么是 Markdown? | |||
| Markdown 是一种用于编写结构化文档的纯文本格式, | Markdown 是一种用于编写结构化文档的纯文本格式, | |||
| 基于在电子邮件和 usenet 帖子中用于表示格式的约定。 | 基于在电子邮件和 usenet 帖子中用于表示格式的约定。 | |||
| 它由 John Gruber 于 2004 年开发,他编写了 | 它由 John Gruber 于 2004 年开发,他编写了 | |||
| the first Markdown-to-HTML converter in perl, and it soon became | the first Markdown-to-HTML converter in Perl, and it soon became | |||
| widely used in websites. By 2014 there were dozens of | ubiquitous. In the next decade, dozens of implementations were | |||
| implementations in many languages. Some of them extended basic | developed in many languages. Some extended the original | |||
| Markdown syntax with conventions for footnotes, definition lists, | Markdown syntax with conventions for footnotes, tables, and | |||
| tables, and other constructs, and some allowed output not just in | other document elements. Some allowed Markdown documents to be | |||
| HTML but in LaTeX and many other formats. | rendered in formats other than HTML. Websites like Reddit, | |||
| StackOverflow, and GitHub had millions of people using Markdown. | ||||
| And Markdown started to be used beyond the web, to author books, | ||||
| articles, slide shows, letters, and lecture notes. | ||||
| What distinguishes Markdown from many other lightweight markup | ||||
| syntaxes, which are often easier to write, is its readability. | ||||
| As Gruber writes | ||||
| > The overriding design goal for Markdown's formatting syntax is | ||||
| > to make it as readable as possible. The idea is that a | ||||
| > Markdown-formatted document should be publishable as-is, as | ||||
| > plain text, without looking like it's been marked up with tags | ||||
| > or formatting instructions. | ||||
| > (<http://daringfireball.net/projects/markdown/>) | ||||
| The point can be illustrated by comparing a sample of | ||||
| [AsciiDoc](http://www.methods.co.nz/asciidoc/) with | ||||
| an equivalent sample of Markdown. Here is a sample of | ||||
| AsciiDoc from the AsciiDoc manual | ||||
| ``` | ||||
| 1. List item one. | ||||
| + | ||||
| List item one continued with a second paragraph followed by an | ||||
| Indented block. | ||||
| + | ||||
| ................. | ||||
| $ ls *.sh | ||||
| $ mv *.sh ~/tmp | ||||
| ................. | ||||
| + | ||||
| List item continued with a third paragraph. | ||||
| 2. List item two continued with an open block. | ||||
| + | ||||
| -- | ||||
| This paragraph is part of the preceding list item. | ||||
| a. This list is nested and does not require explicit item | ||||
| continuation. | ||||
| + | ||||
| This paragraph is part of the preceding list item. | ||||
| b. List item b. | ||||
| This paragraph belongs to item two of the outer list. | ||||
| -- | ||||
| ``` | ||||
| 这是 Markdown 中的等效版本: | ||||
| ``` | ||||
| 1. List item one. | ||||
| List item one continued with a second paragraph followed by an | ||||
| Indented block. | ||||
| $ ls *.sh | ||||
| $ mv *.sh ~/tmp | ||||
| List item continued with a third paragraph. | ||||
| 2. List item two continued with an open block. | ||||
| This paragraph is part of the preceding list item. | ||||
| 1. This list is nested and does not require explicit item continuation. | ||||
| This paragraph is part of the preceding list item. | ||||
| 2. List item b. | ||||
| This paragraph belongs to item two of the outer list. | ||||
| ``` | ||||
| The AsciiDoc version is, arguably, easier to write. You don't need | ||||
| to worry about indentation. But the Markdown version is much easier | ||||
| to read. The nesting of list items is apparent to the eye in the | ||||
| source, not just in the processed document. | ||||
| ## Why is a spec needed? | ## Why is a spec needed? | |||
| John Gruber's [canonical description of Markdown's | John Gruber's [canonical description of Markdown's | |||
| syntax](http://daringfireball.net/projects/markdown/syntax) | syntax](http://daringfireball.net/projects/markdown/syntax) | |||
| does not specify the syntax unambiguously. Here are some examples of | does not specify the syntax unambiguously. Here are some examples of | |||
| questions it does not answer | questions it does not answer | |||
| 1. How much indentation is needed for a sublist? The spec says that | 1. How much indentation is needed for a sublist? The spec says that | |||
| continuation paragraphs need to be indented four spaces, but is | continuation paragraphs need to be indented four spaces, but is | |||
| skipping to change at line 261 | skipping to change at line 339 | |||
| `*`, `+`, `,`, `-`, `.`, `/`, `:`, `;`, `<`, `=`, `>`, `?`, `@`, | `*`, `+`, `,`, `-`, `.`, `/`, `:`, `;`, `<`, `=`, `>`, `?`, `@`, | |||
| `[`, `\`, `]`, `^`, `_`, `` ` ``, `{`, `|`, `}`, 或 `~`。 | `[`, `\`, `]`, `^`, `_`, `` ` ``, `{`, `|`, `}`, 或 `~`。 | |||
| A [punctuation character](@) is an [ASCII | A [punctuation character](@) is an [ASCII | |||
| 标点字符] 或任何在 | 标点字符] 或任何在 | |||
| the Unicode classes `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`. | the Unicode classes `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`. | |||
| ## 制表符 | ## 制表符 | |||
| Tabs in lines are not expanded to [spaces]. However, | Tabs in lines are not expanded to [spaces]. However, | |||
| in contexts where indentation is significant for the | in contexts where whitespace helps to define block structure, | |||
| document's structure, tabs behave as if they were replaced | tabs behave as if they were replaced by spaces with a tab stop | |||
| 以 4 个字符为制表位(tab stop)的空格一样。 | of 4 characters. | |||
| Thus, for example, a tab can be used instead of four spaces | ||||
| in an indented code block. (Note, however, that internal | ||||
| tabs are passed through as literal tabs, not expanded to | ||||
| spaces.) | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| →foo→baz→→bim | →foo→baz→→bim | |||
| . | . | |||
| <pre><code>foo→baz→→bim | <pre><code>foo→baz→→bim | |||
| </code></pre> | </code></pre> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| →foo→baz→→bim | →foo→baz→→bim | |||
| skipping to change at line 288 | skipping to change at line 371 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| a→a | a→a | |||
| ὐ→a | ὐ→a | |||
| . | . | |||
| <pre><code>a→a | <pre><code>a→a | |||
| ὐ→a | ὐ→a | |||
| </code></pre> | </code></pre> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| In the following example, a continuation paragraph of a list | ||||
| item is indented with a tab; this has exactly the same effect | ||||
| as indentation with four spaces would | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| →bar | →bar | |||
| . | . | |||
| <ul> | <ul> | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| <p>bar</p> | <p>bar</p> | |||
| </li> | </li> | |||
| skipping to change at line 315 | skipping to change at line 402 | |||
| . | . | |||
| <ul> | <ul> | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| <pre><code> bar | <pre><code> bar | |||
| </code></pre> | </code></pre> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Normally the `>` that begins a block quote may be followed | ||||
| optionally by a space, which is not considered part of the | ||||
| content. In the following case `>` is followed by a tab, | ||||
| which is treated as if it were expanded into spaces. | ||||
| Since one of theses spaces is considered part of the | ||||
| delimiter, `foo` is considered to be indented six spaces | ||||
| inside the block quote context, so we get an indented | ||||
| code block starting with two spaces. | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| >→→foo | >→→foo | |||
| . | . | |||
| <blockquote> | <blockquote> | |||
| <pre><code> foo | <pre><code> foo | |||
| </code></pre> | </code></pre> | |||
| </blockquote> | </blockquote> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| skipping to change at line 362 | skipping to change at line 458 | |||
| <li>bar | <li>bar | |||
| <ul> | <ul> | |||
| <li>baz</li> | <li>baz</li> | |||
| </ul> | </ul> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ||||
| #→Foo | ||||
| . | ||||
| <h1>Foo</h1> | ||||
| ```````````````````````````````` | ||||
| ```````````````````````````````` 示例 | ||||
| *→*→*→ | ||||
| . | ||||
| <hr /> | ||||
| ```````````````````````````````` | ||||
| ## 不安全字符 | ## 不安全字符 | |||
| 出于安全考虑,Unicode 字符 `U+0000` 必须被替换 | 出于安全考虑,Unicode 字符 `U+0000` 必须被替换 | |||
| 为替换字符 (`U+FFFD`)。 | 为替换字符 (`U+FFFD`)。 | |||
| # 区块与行内元素 | # 区块与行内元素 | |||
| 我们可以将文档视为一系列的 | 我们可以将文档视为一系列的 | |||
| [区块](@)---即段落、区块引用、 | [区块](@)---即段落、区块引用、 | |||
| 列表、标题、分割线和代码块等结构元素。某些区块(例如 | 列表、标题、分割线和代码块等结构元素。某些区块(例如 | |||
| skipping to change at line 675 | skipping to change at line 783 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| #5 bolt | #5 bolt | |||
| #hashtag | #hashtag | |||
| . | . | |||
| <p>#5 bolt</p> | <p>#5 bolt</p> | |||
| <p>#hashtag</p> | <p>#hashtag</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 制表符无法生效 | ||||
| ```````````````````````````````` 示例 | ||||
| #→foo | ||||
| . | ||||
| <p>#→foo</p> | ||||
| ```````````````````````````````` | ||||
| This is not a heading, because the first `#` is escaped | This is not a heading, because the first `#` is escaped | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| \## foo | \## foo | |||
| . | . | |||
| <p>## foo</p> | <p>## foo</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 内容按行内元素解析 | 内容按行内元素解析 | |||
| skipping to change at line 1772 | skipping to change at line 1872 | |||
| ## HTML blocks | ## HTML blocks | |||
| An [HTML block](@) is a group of lines that is treated | An [HTML block](@) is a group of lines that is treated | |||
| as raw HTML (and will not be escaped in HTML output). | as raw HTML (and will not be escaped in HTML output). | |||
| There are seven kinds of [HTML block], which can be defined | There are seven kinds of [HTML block], which can be defined | |||
| by their start and end conditions. The block begins with a line that | by their start and end conditions. The block begins with a line that | |||
| meets a [start condition](@) (after up to three spaces | meets a [start condition](@) (after up to three spaces | |||
| optional indentation). It ends with the first subsequent line that | optional indentation). It ends with the first subsequent line that | |||
| meets a matching [end condition](@), or the last line of | meets a matching [end condition](@), or the last line of | |||
| the document, if no line is encountered that meets the | the document or other [container block](@), if no line is encountered that meets the | |||
| [end condition]. If the first line meets both the [start condition] | [end condition]. If the first line meets both the [start condition] | |||
| and the [end condition], the block will contain just that line. | and the [end condition], the block will contain just that line. | |||
| 1. **Start condition:** line begins with the string `<script`, | 1. **Start condition:** line begins with the string `<script`, | |||
| `<pre`, or `<style` (case-insensitive), followed by whitespace, | `<pre`, or `<style` (case-insensitive), followed by whitespace, | |||
| the string `>`, or the end of the line.\ | the string `>`, or the end of the line.\ | |||
| **End condition:** line contains an end tag | **End condition:** line contains an end tag | |||
| `</script>`, `</pre>`, or `</style>` (case-insensitive; it | `</script>`, `</pre>`, or `</style>` (case-insensitive; it | |||
| need not match the start tag). | need not match the start tag). | |||
| skipping to change at line 2085 | skipping to change at line 2185 | |||
| pre 标签(第 1 类) | pre 标签(第 1 类) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <pre language="haskell"><code> | <pre language="haskell"><code> | |||
| import Text.HTML.TagSoup | import Text.HTML.TagSoup | |||
| main :: IO () | main :: IO () | |||
| main = print $ parseTags tags | main = print $ parseTags tags | |||
| </code></pre> | </code></pre> | |||
| okay | ||||
| . | . | |||
| <pre language="haskell"><code> | <pre language="haskell"><code> | |||
| import Text.HTML.TagSoup | import Text.HTML.TagSoup | |||
| main :: IO () | main :: IO () | |||
| main = print $ parseTags tags | main = print $ parseTags tags | |||
| </code></pre> | </code></pre> | |||
| <p>okay</p> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| script 标签(第 1 类) | script 标签(第 1 类) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <script type="text/javascript"> | <script type="text/javascript"> | |||
| // JavaScript example | // JavaScript example | |||
| document.getElementById("demo").innerHTML = "Hello JavaScript!"; | document.getElementById("demo").innerHTML = "Hello JavaScript!"; | |||
| </script> | </script> | |||
| okay | ||||
| . | . | |||
| <script type="text/javascript"> | <script type="text/javascript"> | |||
| // JavaScript example | // JavaScript example | |||
| document.getElementById("demo").innerHTML = "Hello JavaScript!"; | document.getElementById("demo").innerHTML = "Hello JavaScript!"; | |||
| </script> | </script> | |||
| <p>okay</p> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| style 标签(第 1 类) | style 标签(第 1 类) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <style | <style | |||
| type="text/css"> | type="text/css"> | |||
| h1 {color:red;} | h1 {color:red;} | |||
| p {color:blue;} | p {color:blue;} | |||
| </style> | </style> | |||
| okay | ||||
| . | . | |||
| <style | <style | |||
| type="text/css"> | type="text/css"> | |||
| h1 {color:red;} | h1 {color:red;} | |||
| p {color:blue;} | p {color:blue;} | |||
| </style> | </style> | |||
| <p>okay</p> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| If there is no matching end tag, the block will end at the | If there is no matching end tag, the block will end at the | |||
| end of the document (or the enclosing [block quote][block quotes] | end of the document (or the enclosing [block quote][block quotes] | |||
| or [list item][list items]) | or [list item][list items]) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <style | <style | |||
| type="text/css"> | type="text/css"> | |||
| skipping to change at line 2207 | skipping to change at line 2313 | |||
| </script>1. *bar* | </script>1. *bar* | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 注释(第 2 类) | 注释(第 2 类) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <!-- Foo | <!-- Foo | |||
| bar | bar | |||
| baz --> | baz --> | |||
| okay | ||||
| . | . | |||
| <!-- Foo | <!-- Foo | |||
| bar | bar | |||
| baz --> | baz --> | |||
| <p>okay</p> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 处理指令(第 3 类) | 处理指令(第 3 类) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <?php | <?php | |||
| echo '>'; | echo '>'; | |||
| ?> | ?> | |||
| okay | ||||
| . | . | |||
| <?php | <?php | |||
| echo '>'; | echo '>'; | |||
| ?> | ?> | |||
| <p>okay</p> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 声明(第 4 类) | 声明(第 4 类) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <!DOCTYPE html> | <!DOCTYPE html> | |||
| . | . | |||
| <!DOCTYPE html> | <!DOCTYPE html> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 2253 | skipping to change at line 2363 | |||
| { | { | |||
| if (a < b && a < 0) then { | if (a < b && a < 0) then { | |||
| return 1; | return 1; | |||
| } else { | } else { | |||
| return 0; | return 0; | |||
| } | } | |||
| } | } | |||
| ]]> | ]]> | |||
| okay | ||||
| . | . | |||
| <![CDATA[ | <![CDATA[ | |||
| function matchwo(a,b) | function matchwo(a,b) | |||
| { | { | |||
| if (a < b && a < 0) then { | if (a < b && a < 0) then { | |||
| return 1; | return 1; | |||
| } else { | } else { | |||
| return 0; | return 0; | |||
| } | } | |||
| } | } | |||
| ]]> | ]]> | |||
| <p>okay</p> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 起始标签可以缩进 1-3 个空格,但不能缩进 4 个 | 起始标签可以缩进 1-3 个空格,但不能缩进 4 个 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <!-- foo --> | <!-- foo --> | |||
| <!-- foo --> | <!-- foo --> | |||
| . | . | |||
| <!-- foo --> | <!-- foo --> | |||
| skipping to change at line 2958 | skipping to change at line 3070 | |||
| > # Foo | > # Foo | |||
| > bar | > bar | |||
| > baz | > baz | |||
| . | . | |||
| <pre><code>> # Foo | <pre><code>> # Foo | |||
| > bar | > bar | |||
| > baz | > baz | |||
| </code></pre> | </code></pre> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| The Laziness clause allows us to omit the `>` before a | The Laziness clause allows us to omit the `>` before | |||
| paragraph continuation line: | [paragraph continuation text]: | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| > # Foo | > # Foo | |||
| > bar | > bar | |||
| baz | baz | |||
| . | . | |||
| <blockquote> | <blockquote> | |||
| <h1>Foo</h1> | <h1>Foo</h1> | |||
| <p>bar | <p>bar | |||
| baz</p> | baz</p> | |||
| skipping to change at line 3059 | skipping to change at line 3171 | |||
| foo | foo | |||
| ``` | ``` | |||
| . | . | |||
| <blockquote> | <blockquote> | |||
| <pre><code></code></pre> | <pre><code></code></pre> | |||
| </blockquote> | </blockquote> | |||
| <p>foo</p> | <p>foo</p> | |||
| <pre><code></code></pre> | <pre><code></code></pre> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Note that in the following case, we have a paragraph | Note that in the following case, we have a [lazy | |||
| continuation line: | continuation line]: | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| > foo | > foo | |||
| - bar | - bar | |||
| . | . | |||
| <blockquote> | <blockquote> | |||
| <p>foo | <p>foo | |||
| - bar</p> | - bar</p> | |||
| </blockquote> | </blockquote> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 为了理解原因,请注意:在 | 为了理解原因,请注意:在 | |||
| ```markdown | ```markdown | |||
| > foo | > foo | |||
| > - bar | > - bar | |||
| ``` | ``` | |||
| `- bar` 缩进太深,无法开始列表,且不能 | `- bar` 缩进太深,无法开始列表,且不能 | |||
| 作为缩进代码块,因为缩进代码块不能 | 作为缩进代码块,因为缩进代码块不能 | |||
| interrupt paragraphs, so it is a [paragraph continuation line]. | interrupt paragraphs, so it is [paragraph continuation text]. | |||
| 引用块可以为空 | 引用块可以为空 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| > | > | |||
| . | . | |||
| <blockquote> | <blockquote> | |||
| </blockquote> | </blockquote> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 3295 | skipping to change at line 3407 | |||
| is a sequence of 1--9 arabic digits (`0-9`), followed by either a | is a sequence of 1--9 arabic digits (`0-9`), followed by either a | |||
| `.` character or a `)` character. (The reason for the length | `.` character or a `)` character. (The reason for the length | |||
| limit is that with 10 digits we start seeing integer overflows | limit is that with 10 digits we start seeing integer overflows | |||
| in some browsers.) | in some browsers.) | |||
| The following rules define [list items] | The following rules define [list items] | |||
| 1. **Basic case.** If a sequence of lines *Ls* constitute a sequence of | 1. **Basic case.** If a sequence of lines *Ls* constitute a sequence of | |||
| blocks *Bs* starting with a [non-whitespace character] and not separated | blocks *Bs* starting with a [non-whitespace character] and not separated | |||
| from each other by more than one blank line, and *M* is a list | from each other by more than one blank line, and *M* is a list | |||
| marker of width *W* followed by 0 < *N* < 5 spaces, then the result | marker of width *W* followed by 1 ≤ *N* ≤ 4 spaces, then the result | |||
| of prepending *M* and the following spaces to the first line of | of prepending *M* and the following spaces to the first line of | |||
| *Ls*, and indenting subsequent lines of *Ls* by *W + N* spaces, is a | *Ls*, and indenting subsequent lines of *Ls* by *W + N* spaces, is a | |||
| list item with *Bs* as its contents. The type of the list item | list item with *Bs* as its contents. The type of the list item | |||
| (bullet or ordered) is determined by the type of its list marker. | (bullet or ordered) is determined by the type of its list marker. | |||
| If the list item is ordered, then it is also assigned a start | If the list item is ordered, then it is also assigned a start | |||
| number, based on the ordered list marker. | number, based on the ordered list marker. | |||
| Exceptions: When the list item interrupts a paragraph---that | ||||
| is, when it starts on a line that would otherwise count as | ||||
| [paragraph continuation text]---then (a) the lines *Ls* must | ||||
| not begin with a blank line, and (b) if the list item is | ||||
| ordered, the start number must be 1. | ||||
| For example, let *Ls* be the lines | For example, let *Ls* be the lines | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| A paragraph | A paragraph | |||
| with two lines. | with two lines. | |||
| indented code | indented code | |||
| > A block quote. | > A block quote. | |||
| . | . | |||
| skipping to change at line 3468 | skipping to change at line 3586 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| -one | -one | |||
| 2.two | 2.two | |||
| . | . | |||
| <p>-one</p> | <p>-one</p> | |||
| <p>2.two</p> | <p>2.two</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| A list item may not contain blocks that are separated by more than | A list item may contain blocks that are separated by more than | |||
| one blank line. Thus, two blank lines will end a list, unless the | one blank line. | |||
| two blanks are contained in a [fenced code block]. | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| bar | bar | |||
| - foo | ||||
| bar | ||||
| - ``` | ||||
| foo | ||||
| bar | ||||
| ``` | ||||
| - baz | ||||
| + ``` | ||||
| foo | ||||
| bar | ||||
| ``` | ||||
| . | . | |||
| <ul> | <ul> | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| <p>bar</p> | <p>bar</p> | |||
| </li> | </li> | |||
| <li> | ||||
| <p>foo</p> | ||||
| </li> | ||||
| </ul> | ||||
| <p>bar</p> | ||||
| <ul> | ||||
| <li> | ||||
| <pre><code>foo | ||||
| bar | ||||
| </code></pre> | ||||
| </li> | ||||
| <li> | ||||
| <p>baz</p> | ||||
| <ul> | ||||
| <li> | ||||
| <pre><code>foo | ||||
| bar | ||||
| </code></pre> | ||||
| </li> | ||||
| </ul> | ||||
| </li> | ||||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 列表项可以包含任何类型的块 | 列表项可以包含任何类型的块 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| 1. foo | 1. foo | |||
| ``` | ``` | |||
| bar | bar | |||
| skipping to change at line 3553 | skipping to change at line 3629 | |||
| </code></pre> | </code></pre> | |||
| <p>baz</p> | <p>baz</p> | |||
| <blockquote> | <blockquote> | |||
| <p>bam</p> | <p>bam</p> | |||
| </blockquote> | </blockquote> | |||
| </li> | </li> | |||
| </ol> | </ol> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| A list item that contains an indented code block will preserve | A list item that contains an indented code block will preserve | |||
| empty lines within the code block verbatim, unless there are two | empty lines within the code block verbatim. | |||
| or more empty lines in a row (since as described above, two | ||||
| blank lines end the list) | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - Foo | - Foo | |||
| bar | bar | |||
| baz | baz | |||
| . | . | |||
| <ul> | <ul> | |||
| <li> | <li> | |||
| <p>Foo</p> | <p>Foo</p> | |||
| <pre><code>bar | <pre><code>bar | |||
| baz | baz | |||
| </code></pre> | </code></pre> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ||||
| - Foo | ||||
| bar | ||||
| baz | ||||
| . | ||||
| <ul> | ||||
| <li> | ||||
| <p>Foo</p> | ||||
| <pre><code>bar | ||||
| </code></pre> | ||||
| </li> | ||||
| </ul> | ||||
| <pre><code> baz | ||||
| </code></pre> | ||||
| ```````````````````````````````` | ||||
| 注意,有序列表的起始编号必须为九位数字或更少 | 注意,有序列表的起始编号必须为九位数字或更少 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| 123456789. ok | 123456789. ok | |||
| . | . | |||
| <ol start="123456789"> | <ol start="123456789"> | |||
| <li>ok</li> | <li>ok</li> | |||
| </ol> | </ol> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 3821 | skipping to change at line 3877 | |||
| <pre><code>bar | <pre><code>bar | |||
| </code></pre> | </code></pre> | |||
| </li> | </li> | |||
| <li> | <li> | |||
| <pre><code>baz | <pre><code>baz | |||
| </code></pre> | </code></pre> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| When the list item starts with a blank line, the number of spaces | ||||
| following the list marker doesn't change the required indentation | ||||
| ```````````````````````````````` 示例 | ||||
| - | ||||
| foo | ||||
| . | ||||
| <ul> | ||||
| <li>foo</li> | ||||
| </ul> | ||||
| ```````````````````````````````` | ||||
| 列表项最多可以以一个空行开始。 | 列表项最多可以以一个空行开始。 | |||
| 在以下示例中,`foo` 不是列表项的一部分。 | 在以下示例中,`foo` 不是列表项的一部分。 | |||
| item | item | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - | - | |||
| foo | foo | |||
| . | . | |||
| <ul> | <ul> | |||
| skipping to change at line 3888 | skipping to change at line 3956 | |||
| 列表可以以空的列表项开始或结束 | 列表可以以空的列表项开始或结束 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| * | * | |||
| . | . | |||
| <ul> | <ul> | |||
| <li></li> | <li></li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 然而,空列表项不能中断段落 | ||||
| ```````````````````````````````` 示例 | ||||
| foo | ||||
| * | ||||
| foo | ||||
| 1. | ||||
| . | ||||
| <p>foo | ||||
| *</p> | ||||
| <p>foo | ||||
| 1.</p> | ||||
| ```````````````````````````````` | ||||
| 4. **Indentation.** If a sequence of lines *Ls* constitutes a list item | 4. **Indentation.** If a sequence of lines *Ls* constitutes a list item | |||
| according to rule #1, #2, or #3, then the result of indenting each line | according to rule #1, #2, or #3, then the result of indenting each line | |||
| of *Ls* by 1-3 spaces (the same for each line) also constitutes a | of *Ls* by 1-3 spaces (the same for each line) also constitutes a | |||
| list item with the same contents and attributes. If a line is | list item with the same contents and attributes. If a line is | |||
| empty, then it need not be indented. | empty, then it need not be indented. | |||
| 缩进一个空格 | 缩进一个空格 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| 1. A paragraph | 1. A paragraph | |||
| skipping to change at line 4073 | skipping to change at line 4156 | |||
| The rules for sublists follow from the general rules above. A sublist | The rules for sublists follow from the general rules above. A sublist | |||
| must be indented the same number of spaces a paragraph would need to be | must be indented the same number of spaces a paragraph would need to be | |||
| in order to be included in the list item. | in order to be included in the list item. | |||
| 因此,在这种情况下我们需要两个空格的缩进 | 因此,在这种情况下我们需要两个空格的缩进 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| - bar | - bar | |||
| - baz | - baz | |||
| - boo | ||||
| . | . | |||
| <ul> | <ul> | |||
| <li>foo | <li>foo | |||
| <ul> | <ul> | |||
| <li>bar | <li>bar | |||
| <ul> | <ul> | |||
| <li>baz</li> | <li>baz | |||
| <ul> | ||||
| <li>boo</li> | ||||
| </ul> | ||||
| </li> | ||||
| </ul> | </ul> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 一个空格是不够的 | 一个空格是不够的 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| - bar | - bar | |||
| - baz | - baz | |||
| - boo | ||||
| . | . | |||
| <ul> | <ul> | |||
| <li>foo</li> | <li>foo</li> | |||
| <li>bar</li> | <li>bar</li> | |||
| <li>baz</li> | <li>baz</li> | |||
| <li>boo</li> | ||||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 这里我们需要四个,因为列表标记更宽 | 这里我们需要四个,因为列表标记更宽 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| 10) foo | 10) foo | |||
| - bar | - bar | |||
| . | . | |||
| <ol start="10"> | <ol start="10"> | |||
| skipping to change at line 4445 | skipping to change at line 4535 | |||
| <p>Foo</p> | <p>Foo</p> | |||
| <ul> | <ul> | |||
| <li>bar</li> | <li>bar</li> | |||
| <li>baz</li> | <li>baz</li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| `Markdown.pl` does not allow this, through fear of triggering a list | `Markdown.pl` does not allow this, through fear of triggering a list | |||
| via a numeral in a hard-wrapped line | via a numeral in a hard-wrapped line | |||
| ```````````````````````````````` example | ```````````````````````````````` markdown | |||
| The number of windows in my house is | The number of windows in my house is | |||
| 14. The number of doors is 6. | 14. The number of doors is 6. | |||
| . | ||||
| <p>The number of windows in my house is</p> | ||||
| <ol start="14"> | ||||
| <li>The number of doors is 6.</li> | ||||
| </ol> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Oddly, though, `Markdown.pl` *does* allow a blockquote to | ||||
| interrupt a paragraph, even though the same considerations might | ||||
| apply. | ||||
| Oddly, `Markdown.pl` *does* allow a blockquote to interrupt a paragraph, | In CommonMark, we do allow lists to interrupt paragraphs, for | |||
| even though the same considerations might apply. We think that the two | two reasons. First, it is natural and not uncommon for people | |||
| cases should be treated the same. Here are two reasons for allowing | to start lists without blank lines | |||
| lists to interrupt paragraphs: | ||||
| First, it is natural and not uncommon for people to start lists without | ||||
| blank lines | ||||
| I need to buy | I need to buy | |||
| - new shoes | - new shoes | |||
| - a coat | - a coat | |||
| - a plane ticket | - a plane ticket | |||
| 其次,我们被一种 | 其次,我们被一种 | |||
| > [principle of uniformity](@) | > [principle of uniformity](@) | |||
| > if a chunk of text has a certain | > if a chunk of text has a certain | |||
| skipping to change at line 4495 | skipping to change at line 4579 | |||
| may be rendered without `<p>` tags, since the list is "tight"), | may be rendered without `<p>` tags, since the list is "tight"), | |||
| then | then | |||
| I need to buy | I need to buy | |||
| - new shoes | - new shoes | |||
| - a coat | - a coat | |||
| - a plane ticket | - a plane ticket | |||
| 它本身应该是一个段落后跟一个嵌套子列表。 | 它本身应该是一个段落后跟一个嵌套子列表。 | |||
| Our adherence to the [principle of uniformity] | Since it is well established Markdown practice to allow lists to | |||
| thus inclines us to think that there are two coherent packages: | interrupt paragraphs inside list items, the [principle of | |||
| uniformity] requires us to allow this outside list items as | ||||
| well. ([reStructuredText](http://docutils.sourceforge.net/rst.html) | ||||
| takes a different approach, requiring blank lines before lists | ||||
| even inside other list items.) | ||||
| 1. Require blank lines before *all* lists and blockquotes, | In order to solve of unwanted lists in paragraphs with | |||
| including lists that occur as sublists inside other list items. | hard-wrapped numerals, we allow only lists starting with `1` to | |||
| interrupt paragraphs. Thus, | ||||
| 2. Require blank lines in none of these places. | ```````````````````````````````` 示例 | |||
| The number of windows in my house is | ||||
| 14. The number of doors is 6. | ||||
| . | ||||
| <p>The number of windows in my house is | ||||
| 14. The number of doors is 6.</p> | ||||
| ```````````````````````````````` | ||||
| [reStructuredText](http://docutils.sourceforge.net/rst.html) takes | 在诸如此类的情况下,我们可能仍然会得到非预期的结果 | |||
| the first approach, for which there is much to be said. But the second | ||||
| seems more consistent with established practice with Markdown. | ||||
| There can be blank lines between items, but two blank lines end | ```````````````````````````````` 示例 | |||
| a list | The number of windows in my house is | |||
| 1. The number of doors is 6. | ||||
| . | ||||
| <p>The number of windows in my house is</p> | ||||
| <ol> | ||||
| <li>The number of doors is 6.</li> | ||||
| </ol> | ||||
| ```````````````````````````````` | ||||
| 但该规则应该能防止大多数伪列表捕获。 | ||||
| There can be any number of blank lines between items: | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| - bar | - bar | |||
| - baz | - baz | |||
| . | . | |||
| <ul> | <ul> | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| </li> | </li> | |||
| <li> | <li> | |||
| <p>bar</p> | <p>bar</p> | |||
| </li> | </li> | |||
| </ul> | <li> | |||
| <ul> | <p>baz</p> | |||
| <li>baz</li> | </li> | |||
| </ul> | ||||
| ```````````````````````````````` | ||||
| As illustrated above in the section on [list items], | ||||
| two blank lines between blocks *within* a list item will also end a | ||||
| list | ||||
| ```````````````````````````````` 示例 | ||||
| - foo | ||||
| bar | ||||
| - baz | ||||
| . | ||||
| <ul> | ||||
| <li>foo</li> | ||||
| </ul> | ||||
| <p>bar</p> | ||||
| <ul> | ||||
| <li>baz</li> | ||||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Indeed, two blank lines will end *all* containing lists | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| - bar | - bar | |||
| - baz | - baz | |||
| bim | bim | |||
| . | . | |||
| <ul> | <ul> | |||
| <li>foo | <li>foo | |||
| <ul> | <ul> | |||
| <li>bar | <li>bar | |||
| <ul> | <ul> | |||
| <li>baz</li> | <li> | |||
| <p>baz</p> | ||||
| <p>bim</p> | ||||
| </li> | ||||
| </ul> | </ul> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| <pre><code> bim | ||||
| </code></pre> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Thus, two blank lines can be used to separate consecutive lists of | To separate consecutive lists of the same type, or to separate a | |||
| the same type, or to separate a list from an indented code block | list from an indented code block that would otherwise be parsed | |||
| that would otherwise be parsed as a subparagraph of the final list | as a subparagraph of the final list item, you can insert a blank HTML | |||
| item | comment | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| - bar | - bar | |||
| <!-- --> | ||||
| - baz | - baz | |||
| - bim | - bim | |||
| . | . | |||
| <ul> | <ul> | |||
| <li>foo</li> | <li>foo</li> | |||
| <li>bar</li> | <li>bar</li> | |||
| </ul> | </ul> | |||
| <!-- --> | ||||
| <ul> | <ul> | |||
| <li>baz</li> | <li>baz</li> | |||
| <li>bim</li> | <li>bim</li> | |||
| </ul> | </ul> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - foo | - foo | |||
| notcode | notcode | |||
| - foo | - foo | |||
| <!-- --> | ||||
| code | code | |||
| . | . | |||
| <ul> | <ul> | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| <p>notcode</p> | <p>notcode</p> | |||
| </li> | </li> | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| <!-- --> | ||||
| <pre><code>code | <pre><code>code | |||
| </code></pre> | </code></pre> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 列表项不需要缩进到相同的级别。以下 | 列表项不需要缩进到相同的级别。以下 | |||
| 列表项将被视为同一列表级别的项目, | 列表项将被视为同一列表级别的项目, | |||
| 因为没有一个缩进足够深以属于前一个列表 | 因为没有一个缩进足够深以属于前一个列表 | |||
| item | item | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| skipping to change at line 5499 | skipping to change at line 5589 | |||
| 当且仅当它是 [右侧定界符序列] 的一部分时。 | 当且仅当它是 [右侧定界符序列] 的一部分时。 | |||
| 8. 双 `__` [可以关闭强强调] | 8. 双 `__` [可以关闭强强调] | |||
| it is part of a [right-flanking delimiter run] | it is part of a [right-flanking delimiter run] | |||
| and either (a) not part of a [left-flanking delimiter run] | and either (a) not part of a [left-flanking delimiter run] | |||
| or (b) part of a [left-flanking delimiter run] | or (b) part of a [left-flanking delimiter run] | |||
| followed by punctuation. | followed by punctuation. | |||
| 9. 强调以一个 [可以开启强调] 的定界符开始,并以 | 9. 强调以一个 [可以开启强调] 的定界符开始,并以 | |||
| 一个 [可以关闭强调] 的定界符结束,且使用相同的 | 一个 [可以关闭强调] 的定界符结束,且使用相同的 | |||
| character (`_` or `*`) as the opening delimiter. There must | character (`_` or `*`) as the opening delimiter. The | |||
| be a nonempty sequence of inlines between the open delimiter | opening and closing delimiters must belong to separate | |||
| and the closing delimiter; these form the contents of the emphasis | [delimiter runs]. If one of the delimiters can both | |||
| 内联。 | open and close emphasis, then the sum of the lengths of the | |||
| delimiter runs containing the opening and closing delimiters | ||||
| must not be a multiple of 3. | ||||
| 10. 强强调以一个 | 10. 强强调以一个 | |||
| [可以开启强强调] 的定界符开始,并以一个定界符结束 | [可以开启强强调] 的定界符开始,并以一个定界符结束 | |||
| [can close strong emphasis], and that uses the same character | [can close strong emphasis], and that uses the same character | |||
| (`_` or `*`) as the opening delimiter. | (`_` or `*`) as the opening delimiter. The | |||
| There must be a nonempty sequence of inlines between the open | opening and closing delimiters must belong to separate | |||
| delimiter and the closing delimiter; these form the contents of | [delimiter runs]. If one of the delimiters can both open | |||
| the strong emphasis inline. | and close strong emphasis, then the sum of the lengths of | |||
| the delimiter runs containing the opening and closing | ||||
| delimiters must not be a multiple of 3. | ||||
| 11. A literal `*` character cannot occur at the beginning or end of | 11. A literal `*` character cannot occur at the beginning or end of | |||
| `*`-delimited emphasis or `**`-delimited strong emphasis, unless it | `*`-delimited emphasis or `**`-delimited strong emphasis, unless it | |||
| is backslash-escaped. | is backslash-escaped. | |||
| 12. A literal `_` character cannot occur at the beginning or end of | 12. A literal `_` character cannot occur at the beginning or end of | |||
| `_`-delimited emphasis or `__`-delimited strong emphasis, unless it | `_`-delimited emphasis or `__`-delimited strong emphasis, unless it | |||
| is backslash-escaped. | is backslash-escaped. | |||
| Where rules 1--12 above are compatible with multiple parsings, | Where rules 1--12 above are compatible with multiple parsings, | |||
| skipping to change at line 5534 | skipping to change at line 5628 | |||
| an interpretation `<strong>...</strong>` is always preferred to | an interpretation `<strong>...</strong>` is always preferred to | |||
| `<em><em>...</em></em>`. | `<em><em>...</em></em>`. | |||
| 14. An interpretation `<strong><em>...</em></strong>` is always | 14. An interpretation `<strong><em>...</em></strong>` is always | |||
| preferred to `<em><strong>..</strong></em>`. | preferred to `<em><strong>..</strong></em>`. | |||
| 15. When two potential emphasis or strong emphasis spans overlap, | 15. When two potential emphasis or strong emphasis spans overlap, | |||
| so that the second begins before the first ends and ends after | so that the second begins before the first ends and ends after | |||
| the first ends, the first takes precedence. Thus, for example, | the first ends, the first takes precedence. Thus, for example, | |||
| `*foo _bar* baz_` is parsed as `<em>foo _bar</em> baz_` rather | `*foo _bar* baz_` is parsed as `<em>foo _bar</em> baz_` rather | |||
| than `*foo <em>bar* baz</em>`. For the same reason, | than `*foo <em>bar* baz</em>`. | |||
| `**foo*bar**` is parsed as `<em><em>foo</em>bar</em>*` | ||||
| rather than `<strong>foo*bar</strong>`. | ||||
| 16. When there are two potential emphasis or strong emphasis spans | 16. When there are two potential emphasis or strong emphasis spans | |||
| with the same closing delimiter, the shorter one (the one that | with the same closing delimiter, the shorter one (the one that | |||
| opens later) takes precedence. Thus, for example, | opens later) takes precedence. Thus, for example, | |||
| `**foo **bar baz**` is parsed as `**foo <strong>bar baz</strong>` | `**foo **bar baz**` is parsed as `**foo <strong>bar baz</strong>` | |||
| rather than `<strong>foo **bar baz</strong>`. | rather than `<strong>foo **bar baz</strong>`. | |||
| 17. Inline code spans, links, images, and HTML tags group more tightly | 17. Inline code spans, links, images, and HTML tags group more tightly | |||
| than emphasis. So, when there is a choice between an interpretation | than emphasis. So, when there is a choice between an interpretation | |||
| that contains one of these elements and one that does not, the | that contains one of these elements and one that does not, the | |||
| skipping to change at line 5693 | skipping to change at line 5785 | |||
| . | . | |||
| <p>*foo bar *</p> | <p>*foo bar *</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 换行符也被计为空白字符。 | 换行符也被计为空白字符。 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo bar | *foo bar | |||
| * | * | |||
| . | . | |||
| <p>*foo bar</p> | <p>*foo bar | |||
| <ul> | *</p> | |||
| <li></li> | ||||
| </ul> | ||||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 这不是强调,因为第二个 `*` | 这不是强调,因为第二个 `*` | |||
| 前面是标点符号,后面是字母数字 | 前面是标点符号,后面是字母数字 | |||
| (hence it is not part of a [right-flanking delimiter run] | (hence it is not part of a [right-flanking delimiter run] | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *(*foo) | *(*foo) | |||
| . | . | |||
| <p>*(*foo)</p> | <p>*(*foo)</p> | |||
| skipping to change at line 6055 | skipping to change at line 6145 | |||
| . | . | |||
| <p><em>foo <em>bar</em></em></p> | <p><em>foo <em>bar</em></em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo **bar** baz* | *foo **bar** baz* | |||
| . | . | |||
| <p><em>foo <strong>bar</strong> baz</em></p> | <p><em>foo <strong>bar</strong> baz</em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 但请注意: | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo**bar**baz* | *foo**bar**baz* | |||
| . | . | |||
| <p><em>foo</em><em>bar</em><em>baz</em></p> | <p><em>foo<strong>bar</strong>baz</em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| The difference is that in the preceding case, the internal delimiters | Note that in the preceding case, the interpretation | |||
| [can close emphasis], while in the cases with spaces, they cannot. | ||||
| ``` markdown | ||||
| <p><em>foo</em><em>bar<em></em>baz</em></p> | ||||
| ``` | ||||
| is precluded by the condition that a delimiter that | ||||
| can both open and close (like the `*` after `foo` | ||||
| cannot form emphasis if the sum of the lengths of | ||||
| the delimiter runs containing the opening and | ||||
| closing delimiters is a multiple of 3. | ||||
| The same condition ensures that the following | ||||
| cases are all strong emphasis nested inside | ||||
| emphasis, even when the interior spaces are | ||||
| omitted | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| ***foo** bar* | ***foo** bar* | |||
| . | . | |||
| <p><em><strong>foo</strong> bar</em></p> | <p><em><strong>foo</strong> bar</em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo **bar*** | *foo **bar*** | |||
| . | . | |||
| <p><em>foo <strong>bar</strong></em></p> | <p><em>foo <strong>bar</strong></em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Note, however, that in the following case we get no strong | ```````````````````````````````` 示例 | |||
| emphasis, because the opening delimiter is closed by the first | *foo**bar*** | |||
| `*` before `bar` | . | |||
| <p><em>foo<strong>bar</strong></em></p> | ||||
| ```````````````````````````````` | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo**bar*** | *foo**bar*** | |||
| . | . | |||
| <p><em>foo</em><em>bar</em>**</p> | <p><em>foo<strong>bar</strong></em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 支持无限级的嵌套。 | 支持无限级的嵌套。 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo **bar *baz* bim** bop* | *foo **bar *baz* bim** bop* | |||
| . | . | |||
| <p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p> | <p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 6168 | skipping to change at line 6272 | |||
| . | . | |||
| <p><strong>foo <strong>bar</strong></strong></p> | <p><strong>foo <strong>bar</strong></strong></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| **foo *bar* baz** | **foo *bar* baz** | |||
| . | . | |||
| <p><strong>foo <em>bar</em> baz</strong></p> | <p><strong>foo <em>bar</em> baz</strong></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 但请注意: | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| **foo*bar*baz** | **foo*bar*baz** | |||
| . | . | |||
| <p><em><em>foo</em>bar</em>baz**</p> | <p><strong>foo<em>bar</em>baz</strong></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| The difference is that in the preceding case, the internal delimiters | ||||
| [can close emphasis], while in the cases with spaces, they cannot. | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| ***foo* bar** | ***foo* bar** | |||
| . | . | |||
| <p><strong><em>foo</em> bar</strong></p> | <p><strong><em>foo</em> bar</strong></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| **foo *bar*** | **foo *bar*** | |||
| . | . | |||
| <p><strong>foo <em>bar</em></strong></p> | <p><strong>foo <em>bar</em></strong></p> | |||
| skipping to change at line 6451 | skipping to change at line 6550 | |||
| 规则 15 | 规则 15 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo _bar* baz_ | *foo _bar* baz_ | |||
| . | . | |||
| <p><em>foo _bar</em> baz_</p> | <p><em>foo _bar</em> baz_</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| **foo*bar** | ||||
| . | ||||
| <p><em><em>foo</em>bar</em>*</p> | ||||
| ```````````````````````````````` | ||||
| ```````````````````````````````` 示例 | ||||
| *foo __bar *baz bim__ bam* | *foo __bar *baz bim__ bam* | |||
| . | . | |||
| <p><em>foo <strong>bar *baz bim</strong> bam</em></p> | <p><em>foo <strong>bar *baz bim</strong> bam</em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 规则 16 | 规则 16 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| **foo **bar baz** | **foo **bar baz** | |||
| . | . | |||
| skipping to change at line 7306 | skipping to change at line 7399 | |||
| . | . | |||
| <p><a href="/url" title="title">foo</a> | <p><a href="/url" title="title">foo</a> | |||
| []</p> | []</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| A [shortcut reference link](@) | A [shortcut reference link](@) | |||
| 由一个 [链接标签] 组成,该标签[匹配] | 由一个 [链接标签] 组成,该标签[匹配] | |||
| 文档中其他地方的 [链接引用定义]、可选的 [空白] 和字符串 `[]`。 | 文档中其他地方的 [链接引用定义]、可选的 [空白] 和字符串 `[]`。 | |||
| document and is not followed by `[]` or a link label. | document and is not followed by `[]` or a link label. | |||
| 第一个链接标签的内容作为行内元素解析, | 第一个链接标签的内容作为行内元素解析, | |||
| which are used as the link's text. the link's URI and title | which are used as the link's text. The link's URI and title | |||
| are provided by the matching link reference definition. | are provided by the matching link reference definition. | |||
| Thus, `[foo]` is equivalent to `[foo][]`. | Thus, `[foo]` is equivalent to `[foo][]`. | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| [foo] | [foo] | |||
| [foo]: /url "title" | [foo]: /url "title" | |||
| . | . | |||
| <p><a href="/url" title="title">foo</a></p> | <p><a href="/url" title="title">foo</a></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 8191 | skipping to change at line 8284 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| ### foo | ### foo | |||
| . | . | |||
| <h3>foo</h3> | <h3>foo</h3> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ## Soft line breaks | ## Soft line breaks | |||
| A regular line break (not in a code span or HTML tag) that is not | A regular line break (not in a code span or HTML tag) that is not | |||
| preceded by two or more spaces or a backslash is parsed as a | preceded by two or more spaces or a backslash is parsed as a | |||
| softbreak. (A softbreak may be rendered in HTML either as a | [softbreak](@). (A softbreak may be rendered in HTML either as a | |||
| [line ending] or as a space. The result will be the same in | [line ending] or as a space. The result will be the same in | |||
| browsers. In the examples here, a [line ending] will be used.) | browsers. In the examples here, a [line ending] will be used.) | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| foo | foo | |||
| baz | baz | |||
| . | . | |||
| <p>foo | <p>foo | |||
| baz</p> | baz</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| End of changes. 69 change blocks. | ||||
| 184 lines changed or deleted | 277 lines changed or added | |||
此 HTML 差异由 rfcdiff 1.41 生成。最新版本可从 http://tools.ietf.org/tools/rfcdiff/ 获取 | ||||