| spec.txt | spec.txt | |||
|---|---|---|---|---|
| --- | --- | |||
| 标题: CommonMark 规范 | 标题: CommonMark 规范 | |||
| 作者: John MacFarlane | 作者: John MacFarlane | |||
| version: 0.18 | version: 0.19 | |||
| date: 2015-03-03 | date: 2015-04-27 | |||
| 许可: '[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 年开发,他编写了 | |||
| skipping to change at line 195 | skipping to change at line 195 | |||
| Since this document describes how Markdown is to be parsed into | Since this document describes how Markdown is to be parsed into | |||
| an abstract syntax tree, it would have made sense to use an abstract | an abstract syntax tree, it would have made sense to use an abstract | |||
| representation of the syntax tree instead of HTML. But HTML is capable | representation of the syntax tree instead of HTML. But HTML is capable | |||
| of representing the structural distinctions we need to make, and the | of representing the structural distinctions we need to make, and the | |||
| choice of HTML for the tests makes it possible to run the tests against | choice of HTML for the tests makes it possible to run the tests against | |||
| an implementation without writing an abstract syntax tree renderer. | an implementation without writing an abstract syntax tree renderer. | |||
| This document is generated from a text file, `spec.txt`, written | This document is generated from a text file, `spec.txt`, written | |||
| in Markdown with a small extension for the side-by-side tests. | in Markdown with a small extension for the side-by-side tests. | |||
| The script `spec2md.pl` can be used to turn `spec.txt` into pandoc | The script `tools/makespec.py` can be used to convert `spec.txt` into | |||
| Markdown, which can then be converted into other formats. | HTML or CommonMark (which can then be converted into other formats). | |||
| 在示例中,使用 `→` 字符来表示制表符(tab)。 | 在示例中,使用 `→` 字符来表示制表符(tab)。 | |||
| # 序言 | # 序言 | |||
| ## 字符与行 | ## 字符与行 | |||
| Any sequence of [character]s is a valid CommonMark | Any sequence of [character]s is a valid CommonMark | |||
| 文档。 | 文档。 | |||
| skipping to change at line 727 | skipping to change at line 727 | |||
| ### ### | ### ### | |||
| . | . | |||
| <h2></h2> | <h2></h2> | |||
| <h1></h1> | <h1></h1> | |||
| <h3></h3> | <h3></h3> | |||
| . | . | |||
| ## Setext headers | ## Setext headers | |||
| A [setext header](@setext-header) | A [setext header](@setext-header) | |||
| consists of a line of text, containing at least one | consists of a line of text, containing at least one [non-space character], | |||
| [non-space character], | ||||
| with no more than 3 spaces indentation, followed by a [setext header | with no more than 3 spaces indentation, followed by a [setext header | |||
| underline]. The line of text must be | underline]. The line of text must be | |||
| one that, were it not followed by the setext header underline, | one that, were it not followed by the setext header underline, | |||
| would be interpreted as part of a paragraph: it cannot be a code | would be interpreted as part of a paragraph: it cannot be | |||
| block, header, blockquote, horizontal rule, or list. | interpretable as a [code fence], [ATX header][ATX headers], | |||
| [block quote][block quotes], [horizontal rule][horizontal rules], | ||||
| [list item][list items], or [HTML block][HTML blocks]. | ||||
| A [setext header underline](@setext-header-underline) is a sequence of | A [setext header underline](@setext-header-underline) is a sequence of | |||
| `=` characters or a sequence of `-` characters, with no more than 3 | `=` characters or a sequence of `-` characters, with no more than 3 | |||
| spaces indentation and any number of trailing spaces. If a line | spaces indentation and any number of trailing spaces. If a line | |||
| containing a single `-` can be interpreted as an | containing a single `-` can be interpreted as an | |||
| empty [list items], it should be interpreted this way | empty [list items], it should be interpreted this way | |||
| and not as a [setext header underline]. | and not as a [setext header underline]. | |||
| The header is a level 1 header if `=` characters are used in the | The header is a level 1 header if `=` characters are used in the | |||
| [setext header underline], and a level 2 | [setext header underline], and a level 2 | |||
| skipping to change at line 1804 | skipping to change at line 1805 | |||
| A [link reference definition](@link-reference-definition) | A [link reference definition](@link-reference-definition) | |||
| 由[链接标签]组成,缩进最多三个空格,然后是 | 由[链接标签]组成,缩进最多三个空格,然后是 | |||
| by a colon (`:`), optional [whitespace] (including up to one | by a colon (`:`), optional [whitespace] (including up to one | |||
| [line ending]), a [link destination], | [line ending]), a [link destination], | |||
| 可选的[空白](包括最多一个 | 可选的[空白](包括最多一个 | |||
| [line ending]), and an optional [link | [line ending]), and an optional [link | |||
| title], which if it is present must be separated | title], which if it is present must be separated | |||
| from the [link destination] by [whitespace]. | from the [link destination] by [whitespace]. | |||
| No further [non-space character]s may occur on the line. | No further [non-space character]s may occur on the line. | |||
| A [link reference-definition] | A [link reference definition] | |||
| does not correspond to a structural element of a document. Instead, it | does not correspond to a structural element of a document. Instead, it | |||
| defines a label which can be used in [reference link]s | defines a label which can be used in [reference link]s | |||
| and reference-style [images] elsewhere in the document. [Link | and reference-style [images] elsewhere in the document. [Link | |||
| reference definitions] can come either before or after the links that use | reference definitions] can come either before or after the links that use | |||
| them. | them. | |||
| . | . | |||
| [foo]: /url "title" | [foo]: /url "title" | |||
| [foo] | [foo] | |||
| skipping to change at line 2573 | skipping to change at line 2574 | |||
| An [ordered list marker](@ordered-list-marker) | An [ordered list marker](@ordered-list-marker) | |||
| is a sequence of one of more digits (`0-9`), followed by either a | is a sequence of one of more digits (`0-9`), followed by either a | |||
| `.` character or a `)` character. | `.` character or a `)` character. | |||
| 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-space character] and not separated | blocks *Bs* starting with a [non-space 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 *M* of width *W* followed by 0 < *N* < 5 spaces, then the result | marker of width *W* followed by 0 < *N* < 5 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. | |||
| For example, let *Ls* be the lines | For example, let *Ls* be the lines | |||
| . | . | |||
| skipping to change at line 2712 | skipping to change at line 2713 | |||
| <p>one</p> | <p>one</p> | |||
| <p>two</p> | <p>two</p> | |||
| </li> | </li> | |||
| </ol> | </ol> | |||
| </blockquote> | </blockquote> | |||
| </blockquote> | </blockquote> | |||
| . | . | |||
| Here `two` occurs in the same column as the list marker `1.`, | Here `two` occurs in the same column as the list marker `1.`, | |||
| but is actually contained in the list item, because there is | but is actually contained in the list item, because there is | |||
| sufficent indentation after the last containing blockquote marker. | sufficient indentation after the last containing blockquote marker. | |||
| The converse is also possible. In the following example, the word `two` | The converse is also possible. In the following example, the word `two` | |||
| occurs far to the right of the initial text of the list item, `one`, but | occurs far to the right of the initial text of the list item, `one`, but | |||
| it is not considered part of the list item, because it is not indented | it is not considered part of the list item, because it is not indented | |||
| far enough past the blockquote marker | far enough past the blockquote marker | |||
| . | . | |||
| >>- one | >>- one | |||
| >> | >> | |||
| > > two | > > two | |||
| skipping to change at line 2833 | skipping to change at line 2834 | |||
| <blockquote> | <blockquote> | |||
| <p>bam</p> | <p>bam</p> | |||
| </blockquote> | </blockquote> | |||
| </li> | </li> | |||
| </ol> | </ol> | |||
| . | . | |||
| 2. **Item starting with indented code.** If a sequence of lines *Ls* | 2. **Item starting with indented code.** If a sequence of lines *Ls* | |||
| constitute a sequence of blocks *Bs* starting with an indented code | constitute a sequence of blocks *Bs* starting with an indented code | |||
| 块,且彼此之间没有被超过一个空行隔开, | 块,且彼此之间没有被超过一个空行隔开, | |||
| and *M* is a list marker *M* of width *W* followed by | 且*M*是一个宽度为*W*的列表标记,后跟 | |||
| 一个空格,则预置*M*和其后的 | 一个空格,则预置*M*和其后的 | |||
| space to the first line of *Ls*, and indenting subsequent lines of | space to the first line of *Ls*, and indenting subsequent lines of | |||
| *Ls* by *W + 1* spaces, is a list item with *Bs* as its contents. | *Ls* by *W + 1* spaces, is a list item with *Bs* as its contents. | |||
| If a line is empty, then it need not be indented. The type of the | If a line is empty, then it need not be indented. The type of the | |||
| list item (bullet or ordered) is determined by the type of its list | list item (bullet or ordered) is determined by the type of its list | |||
| marker. If the list item is ordered, then it is also assigned a | marker. If the list item is ordered, then it is also assigned a | |||
| start number, based on the ordered list marker. | start number, based on the ordered list marker. | |||
| 一个缩进的代码块需要比段落多缩进四个空格。 | 一个缩进的代码块需要比段落多缩进四个空格。 | |||
| the edge of the region where text will be included in the list item. | the edge of the region where text will be included in the list item. | |||
| skipping to change at line 2982 | skipping to change at line 2983 | |||
| <li> | <li> | |||
| <p>foo</p> | <p>foo</p> | |||
| <p>bar</p> | <p>bar</p> | |||
| </li> | </li> | |||
| </ul> | </ul> | |||
| . | . | |||
| 3. **Item starting with a blank line.** If a sequence of lines *Ls* | 3. **Item starting with a blank line.** If a sequence of lines *Ls* | |||
| starting with a single [blank line] constitute a (possibly empty) | starting with a single [blank line] constitute a (possibly empty) | |||
| sequence of blocks *Bs*, not separated from each other by more than | sequence of blocks *Bs*, not separated from each other by more than | |||
| one blank line, and *M* is a list marker *M* of width *W*, | one blank line, and *M* is a list marker of width *W*, | |||
| then the result of prepending *M* to the first line of *Ls*, and | then the result of prepending *M* to the first line of *Ls*, and | |||
| indenting subsequent lines of *Ls* by *W + 1* spaces, is a list | indenting subsequent lines of *Ls* by *W + 1* spaces, is a list | |||
| item with *Bs* as its contents. | item with *Bs* as its contents. | |||
| If a line is empty, then it need not be indented. The type of the | If a line is empty, then it need not be indented. The type of the | |||
| list item (bullet or ordered) is determined by the type of its list | list item (bullet or ordered) is determined by the type of its list | |||
| marker. If the list item is ordered, then it is also assigned a | marker. If the list item is ordered, then it is also assigned a | |||
| start number, based on the ordered list marker. | start number, based on the ordered list marker. | |||
| 以下是一些以空行开头但不为空的列表项 | 以下是一些以空行开头但不为空的列表项 | |||
| skipping to change at line 3070 | skipping to change at line 3071 | |||
| . | . | |||
| * | * | |||
| . | . | |||
| <ul> | <ul> | |||
| <li></li> | <li></li> | |||
| </ul> | </ul> | |||
| . | . | |||
| 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 *L* 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 | |||
| with two lines. | with two lines. | |||
| indented code | indented code | |||
| skipping to change at line 4245 | skipping to change at line 4246 | |||
| 对应码位。 | 对应码位。 | |||
| . | . | |||
| & © Æ Ď ¾ ℋ ⅆ ∲ | & © Æ Ď ¾ ℋ ⅆ ∲ | |||
| . | . | |||
| <p> & © Æ Ď ¾ ℋ ⅆ ∲</p> | <p> & © Æ Ď ¾ ℋ ⅆ ∲</p> | |||
| . | . | |||
| [十进制实体](@decimal-entities) | [十进制实体](@decimal-entities) | |||
| 由 `&#` + 1-8 个阿拉伯数字字符串 + `;` 组成。同样,这些 | 由 `&#` + 1-8 个阿拉伯数字字符串 + `;` 组成。同样,这些 | |||
| entities need to be recognised and tranformed into their corresponding | entities need to be recognised and transformed into their corresponding | |||
| UTF8 codepoints. Invalid Unicode codepoints will be written as the | unicode codepoints. Invalid unicode codepoints will be written as the | |||
| "unknown codepoint" character (`0xFFFD`) | "unknown codepoint" character (`0xFFFD`) | |||
| . | . | |||
| # Ӓ Ϡ � | # Ӓ Ϡ � | |||
| . | . | |||
| <p># Ӓ Ϡ �</p> | <p># Ӓ Ϡ �</p> | |||
| . | . | |||
| [十六进制实体](@hexadecimal-entities) | [十六进制实体](@hexadecimal-entities) | |||
| + 1-8 个十六进制数字字符串 + `;` 组成。它们也 | + 1-8 个十六进制数字字符串 + `;` 组成。它们也 | |||
| + `;`. They will also be parsed and turned into their corresponding UTF8 values | + `;`. They will also be parsed and turned into the corresponding | |||
| in the AST. | unicode codepoints in the AST. | |||
| . | . | |||
| " ആ ಫ | " ആ ಫ | |||
| . | . | |||
| <p>" ആ ಫ</p> | <p>" ആ ಫ</p> | |||
| . | . | |||
| 这里是一些非实体引用 | 这里是一些非实体引用 | |||
| . | . | |||
| skipping to change at line 4551 | skipping to change at line 4553 | |||
| 使用不需要回溯的高效解析策略。 | 使用不需要回溯的高效解析策略。 | |||
| 首先,是一些定义。[分隔符序列](@delimiter-run)(delimiter run)是指 | 首先,是一些定义。[分隔符序列](@delimiter-run)(delimiter run)是指 | |||
| 一个或多个 `*` 字符组成的序列,且其前后没有 | 一个或多个 `*` 字符组成的序列,且其前后没有 | |||
| `*` 字符,或者一个或多个 `_` | `*` 字符,或者一个或多个 `_` | |||
| 字符组成的序列,且其前后没有 `_` 字符。 | 字符组成的序列,且其前后没有 `_` 字符。 | |||
| 一个 [左侧分隔符运行](@left-flanking-delimiter-run) 是 | 一个 [左侧分隔符运行](@left-flanking-delimiter-run) 是 | |||
| a [delimiter run] that is (a) not followed by [unicode whitespace], | a [delimiter run] that is (a) not followed by [unicode whitespace], | |||
| 并且 (b) 要么后面没有 [标点字符],或者 | 并且 (b) 要么后面没有 [标点字符],或者 | |||
| preceded by [unicode whitespace] or a [punctuation character] or | preceded by [unicode whitespace] or a [punctuation character]. | |||
| the beginning of a line. | For purposes of this definition, the beginning and the end of | |||
| the line count as unicode whitespace. | ||||
| 一个 [右侧分隔符运行](@right-flanking-delimiter-run) 是 | 一个 [右侧分隔符运行](@right-flanking-delimiter-run) 是 | |||
| a [delimiter run] that is (a) not preceded by [unicode whitespace], | a [delimiter run] that is (a) not preceded by [unicode whitespace], | |||
| 并且 (b) 要么前面没有 [标点字符],或者 | 并且 (b) 要么前面没有 [标点字符],或者 | |||
| followed by [unicode whitespace] or a [punctuation character] or | followed by [unicode whitespace] or a [punctuation character]. | |||
| the end of a line. | For purposes of this definition, the beginning and the end of | |||
| the line count as unicode whitespace. | ||||
| 以下是一些定界符序列的示例。 | 以下是一些定界符序列的示例。 | |||
| - 左侧分隔但非右侧分隔 | - 左侧分隔但非右侧分隔 | |||
| ``` | ``` | |||
| ***abc | ***abc | |||
| _abc | _abc | |||
| **"abc" | **"abc" | |||
| _"abc" | _"abc" | |||
| ``` | ``` | |||
| - right-flanking but not left-flanking | - right-flanking but not left-flanking | |||
| ``` | ``` | |||
| abc*** | abc*** | |||
| abc_ | abc_ | |||
| "abc"** | "abc"** | |||
| _"abc" | "abc"_ | |||
| ``` | ``` | |||
| - Both right and right-flanking | - Both left and right-flanking | |||
| ``` | ``` | |||
| abc***def | abc***def | |||
| "abc"_"def" | "abc"_"def" | |||
| ``` | ``` | |||
| - Neither right nor right-flanking | - Neither left nor right-flanking | |||
| ``` | ``` | |||
| abc *** def | abc *** def | |||
| a _ b | a _ b | |||
| ``` | ``` | |||
| (The idea of distinguishing left-flanking and right-flanking | (The idea of distinguishing left-flanking and right-flanking | |||
| delimiter runs based on the character before and the character | delimiter runs based on the character before and the character | |||
| 之后来自 Roopesh Chander 的 | 之后来自 Roopesh Chander 的 | |||
| [vfmd](http://www.vfmd.org/vfmd-spec/specification/#procedure-for-identifying-em phasis-tags)。 | [vfmd](http://www.vfmd.org/vfmd-spec/specification/#procedure-for-identifying-em phasis-tags)。 | |||
| vfmd 使用术语“强调指示字符串”而不是“分隔符 | vfmd 使用术语“强调指示字符串”而不是“分隔符 | |||
| 序列”,并且其区分左侧和右侧分隔序列的规则 | 序列”,并且其区分左侧和右侧分隔序列的规则 | |||
| 比此处给出的规则要复杂一些。) | 比此处给出的规则要复杂一些。) | |||
| 以下规则定义了强调和强强调。 | 以下规则定义了强调和强强调。 | |||
| 1. 单个 `*` 字符 [可以开启强调](@can-open-emphasis) | 1. 单个 `*` 字符 [可以开启强调](@can-open-emphasis) | |||
| 当且仅当它是 [左侧定界符序列] 的一部分时。 | iff (if and only if) it is part of a [left-flanking delimiter run]. | |||
| 2. 单个 `_` 字符 [可以开启强调] 当且仅当 | 2. 单个 `_` 字符 [可以开启强调] 当且仅当 | |||
| 它是 [左侧定界符序列] 的一部分 | 它是 [左侧定界符序列] 的一部分 | |||
| and not part of a [right-flanking delimiter run]. | and either (a) not part of a [right-flanking delimiter run] | |||
| or (b) part of a [right-flanking delimeter run] | ||||
| preceded by punctuation. | ||||
| 3. 单个 `*` 字符 [可以关闭强调](@can-close-emphasis) | 3. 单个 `*` 字符 [可以关闭强调](@can-close-emphasis) | |||
| 当且仅当它是 [右侧定界符序列] 的一部分时。 | 当且仅当它是 [右侧定界符序列] 的一部分时。 | |||
| 4. A single `_` character [can close emphasis] | 4. A single `_` character [can close emphasis] iff | |||
| iff it is part of a [right-flanking delimiter run] | it is part of a [right-flanking delimiter run] | |||
| and 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 delimeter run] | ||||
| followed by punctuation. | ||||
| 5. 双 `**` [可以开启强强调](@can-open-strong-emphasis) | 5. 双 `**` [可以开启强强调](@can-open-strong-emphasis) | |||
| 当且仅当它是 [左侧定界符序列] 的一部分时。 | 当且仅当它是 [左侧定界符序列] 的一部分时。 | |||
| 6. A double `__` [can open strong emphasis] | 6. A double `__` [can open strong emphasis] iff | |||
| iff it is part of a [left-flanking delimiter run] | 它是 [左侧定界符序列] 的一部分 | |||
| and not part of a [right-flanking delimiter run]. | and either (a) not part of a [right-flanking delimiter run] | |||
| or (b) part of a [right-flanking delimeter run] | ||||
| preceded by punctuation. | ||||
| 7. 双 `**` [可以关闭强强调](@can-close-strong-emphasis) | 7. 双 `**` [可以关闭强强调](@can-close-strong-emphasis) | |||
| 当且仅当它是 [右侧定界符序列] 的一部分时。 | 当且仅当它是 [右侧定界符序列] 的一部分时。 | |||
| 8. 双 `__` [可以关闭强强调] | 8. 双 `__` [可以关闭强强调] | |||
| iff it is part of a [right-flanking delimiter run] | it is part of a [right-flanking delimiter run] | |||
| and 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 delimeter run] | ||||
| followed by punctuation. | ||||
| 9. 强调以一个 [可以开启强调] 的定界符开始,并以 | 9. 强调以一个 [可以开启强调] 的定界符开始,并以 | |||
| 一个 [可以关闭强调] 的定界符结束,且使用相同的 | 一个 [可以关闭强调] 的定界符结束,且使用相同的 | |||
| 字符(`_` 或 `*`)作为起始分隔符。起始分隔符和 | 字符(`_` 或 `*`)作为起始分隔符。起始分隔符和 | |||
| 结束分隔符之间必须有一个非空的内联序列;这些形成了强调 | 结束分隔符之间必须有一个非空的内联序列;这些形成了强调 | |||
| 内联的内容。 | 内联的内容。 | |||
| 内联。 | 内联。 | |||
| 10. 强强调以一个 | 10. 强强调以一个 | |||
| [可以开启强强调] 的定界符开始,并以一个定界符结束 | [可以开启强强调] 的定界符开始,并以一个定界符结束 | |||
| skipping to change at line 4792 | 跳至更改处 第 4804 行 | |||
| 此处 `_` 不会生成强调,因为第一个定界符序列 | 此处 `_` 不会生成强调,因为第一个定界符序列 | |||
| 是右侧定界符序列,而第二个是左侧定界符序列 | 是右侧定界符序列,而第二个是左侧定界符序列 | |||
| . | . | |||
| aa_"bb"_cc | aa_"bb"_cc | |||
| . | . | |||
| <p>aa_"bb"_cc</p> | <p>aa_"bb"_cc</p> | |||
| . | . | |||
| Here there is no emphasis, because the delimiter runs are | This is emphasis, even though the opening delimiter is | |||
| both left- and right-flanking: | both left- and right-flanking, because it is preceded by | |||
| 标点符号 | ||||
| . | . | |||
| "aa"_"bb"_"cc" | foo-_(bar)_ | |||
| . | . | |||
| <p>"aa"_"bb"_"cc"</p> | <p>foo-<em>(bar)</em></p> | |||
| . | . | |||
| 规则 3 | 规则 3 | |||
| 这不是强调,因为关闭的定界符 | 这不是强调,因为关闭的定界符 | |||
| 不匹配开启的定界符 | 不匹配开启的定界符 | |||
| . | . | |||
| _foo* | _foo* | |||
| . | . | |||
| skipping to change at line 4908 | skipping to change at line 4921 | |||
| . | . | |||
| <p>_пристаням_стремятся</p> | <p>_пристаням_стремятся</p> | |||
| . | . | |||
| . | . | |||
| _foo_bar_baz_ | _foo_bar_baz_ | |||
| . | . | |||
| <p><em>foo_bar_baz</em></p> | <p><em>foo_bar_baz</em></p> | |||
| . | . | |||
| This is emphasis, even though the closing delimiter is | ||||
| 左右两侧都有,因为它后面跟着 | ||||
| 标点符号 | ||||
| . | ||||
| _(bar)_. | ||||
| . | ||||
| <p><em>(bar)</em>.</p> | ||||
| . | ||||
| 规则 5 | 规则 5 | |||
| . | . | |||
| **foo bar** | **foo bar** | |||
| . | . | |||
| <p><strong>foo bar</strong></p> | <p><strong>foo bar</strong></p> | |||
| . | . | |||
| This is not strong emphasis, because the opening delimiter is | This is not strong emphasis, because the opening delimiter is | |||
| 后跟空白字符 | 后跟空白字符 | |||
| skipping to change at line 5004 | skipping to change at line 5027 | |||
| . | . | |||
| <p>пристаням__стремятся__</p> | <p>пристаням__стремятся__</p> | |||
| . | . | |||
| . | . | |||
| __foo, __bar__, baz__ | __foo, __bar__, baz__ | |||
| . | . | |||
| <p><strong>foo, <strong>bar</strong>, baz</strong></p> | <p><strong>foo, <strong>bar</strong>, baz</strong></p> | |||
| . | . | |||
| 这是强强调,尽管起始分隔符是 | ||||
| 左右两侧都有,因为它前面是 | ||||
| 标点符号 | ||||
| . | ||||
| foo-_(bar)_ | ||||
| . | ||||
| <p>foo-<em>(bar)</em></p> | ||||
| . | ||||
| 规则 7 | 规则 7 | |||
| 这不是强强调,因为结束分隔符前面有 | 这不是强强调,因为结束分隔符前面有 | |||
| 空格 | 空格 | |||
| . | . | |||
| **foo bar ** | **foo bar ** | |||
| . | . | |||
| <p>**foo bar **</p> | <p>**foo bar **</p> | |||
| . | . | |||
| skipping to change at line 5107 | skipping to change at line 5140 | |||
| . | . | |||
| <p>__пристаням__стремятся</p> | <p>__пристаням__стремятся</p> | |||
| . | . | |||
| . | . | |||
| __foo__bar__baz__ | __foo__bar__baz__ | |||
| . | . | |||
| <p><strong>foo__bar__baz</strong></p> | <p><strong>foo__bar__baz</strong></p> | |||
| . | . | |||
| 这是强强调,尽管结束分隔符是 | ||||
| 左右两侧都有,因为它后面跟着 | ||||
| 标点符号 | ||||
| . | ||||
| _(bar)_. | ||||
| . | ||||
| <p><em>(bar)</em>.</p> | ||||
| . | ||||
| 规则 9 | 规则 9 | |||
| 任何非空的行内元素序列都可以作为 | 任何非空的行内元素序列都可以作为 | |||
| 强调跨度的内容。 | 强调跨度的内容。 | |||
| . | . | |||
| *foo [bar](/url)* | *foo [bar](/url)* | |||
| . | . | |||
| <p><em>foo <a href="/url">bar</a></em></p> | <p><em>foo <a href="/url">bar</a></em></p> | |||
| . | . | |||
| skipping to change at line 5668 | skipping to change at line 5711 | |||
| A [link destination](@link-destination) consists of either | A [link destination](@link-destination) consists of either | |||
| - a sequence of zero or more characters between an opening `<` and a | - a sequence of zero or more characters between an opening `<` and a | |||
| closing `>` that contains no line breaks or unescaped `<` or `>` | closing `>` that contains no line breaks or unescaped `<` or `>` | |||
| characters, or | characters, or | |||
| - a nonempty sequence of characters that does not include | - a nonempty sequence of characters that does not include | |||
| ASCII space or control characters, and includes parentheses | ASCII space or control characters, and includes parentheses | |||
| only if (a) they are backslash-escaped or (b) they are part of | only if (a) they are backslash-escaped or (b) they are part of | |||
| a balanced pair of unescaped parentheses that is not itself | a balanced pair of unescaped parentheses that is not itself | |||
| inside a balanced pair of unescaped paretheses. | inside a balanced pair of unescaped parentheses. | |||
| A [link title](@link-title) consists of either | A [link title](@link-title) consists of either | |||
| - a sequence of zero or more characters between straight double-quote | - a sequence of zero or more characters between straight double-quote | |||
| characters (`"`), including a `"` character only if it is | characters (`"`), including a `"` character only if it is | |||
| backslash-escaped, or | backslash-escaped, or | |||
| - a sequence of zero or more characters between straight single-quote | - a sequence of zero or more characters between straight single-quote | |||
| characters (`'`), including a `'` character only if it is | characters (`'`), including a `'` character only if it is | |||
| backslash-escaped, or | backslash-escaped, or | |||
| skipping to change at line 5801 | skipping to change at line 5844 | |||
| in Markdown | in Markdown | |||
| . | . | |||
| [link](foo\)\:) | [link](foo\)\:) | |||
| . | . | |||
| <p><a href="foo):">link</a></p> | <p><a href="foo):">link</a></p> | |||
| . | . | |||
| URL 转义在目的地内部应保持原样,因为所有 | URL 转义在目的地内部应保持原样,因为所有 | |||
| URL 转义字符也是有效的 URL 字符。目的地中的 HTML 实体 | URL 转义字符也是有效的 URL 字符。目的地中的 HTML 实体 | |||
| the destination will be parsed into their UTF-8 codepoints, as usual, and | the destination will be parsed into the corresponding unicode | |||
| optionally URL-escaped when written as HTML. | codepoints, as usual, and optionally URL-escaped when written as HTML. | |||
| . | . | |||
| [link](foo%20bä) | [link](foo%20bä) | |||
| . | . | |||
| <p><a href="foo%20b%C3%A4">link</a></p> | <p><a href="foo%20b%C3%A4">link</a></p> | |||
| . | . | |||
| 注意,由于标题通常可以被解析为目的地, | 注意,由于标题通常可以被解析为目的地, | |||
| 如果你尝试省略目的地而保留标题,你会 | 如果你尝试省略目的地而保留标题,你会 | |||
| 得到意想不到的结果。 | 得到意想不到的结果。 | |||
| skipping to change at line 7175 | skipping to change at line 7218 | |||
| . | . | |||
| ### 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 is parsed as a softbreak. (A | preceded by two or more spaces or a backslash is parsed as 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 | [line ending] or as a space. The result will be the same in | |||
| 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> | |||
| . | . | |||
| Spaces at the end of the line and beginning of the next line are | Spaces at the end of the line and beginning of the next line are | |||
| End of changes. 33 change blocks. | ||||
| 49 lines changed or deleted | 91 lines changed or added | |||
此 HTML 差异由 rfcdiff 1.41 生成。最新版本可从 http://tools.ietf.org/tools/rfcdiff/ 获取 | ||||