| spec.txt | spec.txt | |||
|---|---|---|---|---|
| --- | --- | |||
| 标题: CommonMark 规范 | 标题: CommonMark 规范 | |||
| 作者: John MacFarlane | 作者: John MacFarlane | |||
| version: 0.27 | version: 0.28 | |||
| date: '2016-11-18' | date: '2017-08-01' | |||
| 许可: '[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 是一种用于编写结构化文档的纯文本格式, | |||
| based on conventions used for indicating formatting in email and | based on conventions for indicating formatting in email | |||
| 它由 John Gruber 于 2004 年开发,他编写了 | and usenet posts. It was developed by John Gruber (with | |||
| the first Markdown-to-HTML converter in Perl, and it soon became | help from Aaron Swartz) and released in 2004 in the form of a | |||
| ubiquitous. In the next decade, dozens of implementations were | [syntax description](http://daringfireball.net/projects/markdown/syntax) | |||
| and a Perl script (`Markdown.pl`) for converting Markdown to | ||||
| HTML. In the next decade, dozens of implementations were | ||||
| developed in many languages. Some extended the original | developed in many languages. Some extended the original | |||
| Markdown syntax with conventions for footnotes, tables, and | Markdown syntax with conventions for footnotes, tables, and | |||
| other document elements. Some allowed Markdown documents to be | other document elements. Some allowed Markdown documents to be | |||
| rendered in formats other than HTML. Websites like Reddit, | rendered in formats other than HTML. Websites like Reddit, | |||
| StackOverflow, and GitHub had millions of people using Markdown. | StackOverflow, and GitHub had millions of people using Markdown. | |||
| And Markdown started to be used beyond the web, to author books, | And Markdown started to be used beyond the web, to author books, | |||
| articles, slide shows, letters, and lecture notes. | articles, slide shows, letters, and lecture notes. | |||
| What distinguishes Markdown from many other lightweight markup | What distinguishes Markdown from many other lightweight markup | |||
| syntaxes, which are often easier to write, is its readability. | syntaxes, which are often easier to write, is its readability. | |||
| skipping to change at line 315 ¶ | skipping to change at line 317 ¶ | |||
| 本规范将使用以下字符类定义: | 本规范将使用以下字符类定义: | |||
| A [whitespace character](@) is a space | A [whitespace character](@) is a space | |||
| (`U+0020`)、制表符(`U+0009`)、换行符(`U+000A`)、行制表符(`U+000B`)、 | (`U+0020`)、制表符(`U+0009`)、换行符(`U+000A`)、行制表符(`U+000B`)、 | |||
| 换页符(`U+000C`)或回车符(`U+000D`)。 | 换页符(`U+000C`)或回车符(`U+000D`)。 | |||
| [Whitespace](@) is a sequence of one or more [whitespace | [Whitespace](@) is a sequence of one or more [whitespace | |||
| characters]. | characters]. | |||
| A [Unicode whitespace character](@) is | A [Unicode whitespace character](@) is | |||
| any code point in the Unicode `Zs` class, or a tab (`U+0009`), | any code point in the Unicode `Zs` general category, or a tab (`U+0009`), | |||
| 回车符(`U+000D`)、换行符(`U+000A`)或换页符 | 回车符(`U+000D`)、换行符(`U+000A`)或换页符 | |||
| (`U+000C`)。 | (`U+000C`)。 | |||
| [Unicode whitespace](@) is a sequence of one | [Unicode whitespace](@) is a sequence of one | |||
| or more [Unicode whitespace characters]. | or more [Unicode whitespace characters]. | |||
| A [space](@) is `U+0020`. | A [space](@) is `U+0020`. | |||
| A [non-whitespace character](@) is any character | A [non-whitespace character](@) is any character | |||
| [空白字符] 的字符。 | [空白字符] 的字符。 | |||
| An [ASCII punctuation character](@) | An [ASCII punctuation character](@) | |||
| 是 `!`, `"`, `#`, `$`, `%`, `&`, `'`, `(`, `)`, | 是 `!`, `"`, `#`, `$`, `%`, `&`, `'`, `(`, `)`, | |||
| `*`, `+`, `,`, `-`, `.`, `/`, `:`, `;`, `<`, `=`, `>`, `?`, `@`, | `*`, `+`, `,`, `-`, `.`, `/`, `:`, `;`, `<`, `=`, `>`, `?`, `@`, | |||
| `[`, `\`, `]`, `^`, `_`, `` ` ``, `{`, `|`, `}`, 或 `~`。 | `[`, `\`, `]`, `^`, `_`, `` ` ``, `{`, `|`, `}`, 或 `~`。 | |||
| A [punctuation character](@) is an [ASCII | A [punctuation character](@) is an [ASCII | |||
| 标点字符] 或任何在 | 标点字符] 或任何在 | |||
| the Unicode classes `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`. | the general Unicode categories `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 whitespace helps to define block structure, | in contexts where whitespace helps to define block structure, | |||
| tabs behave as if they were replaced by spaces with a tab stop | tabs behave as if they were replaced by spaces with a tab stop | |||
| of 4 characters. | of 4 characters. | |||
| Thus, for example, a tab can be used instead of four spaces | Thus, for example, a tab can be used instead of four spaces | |||
| in an indented code block. (Note, however, that internal | in an indented code block. (Note, however, that internal | |||
| skipping to change at line 405 ¶ | skipping to change at line 407 ¶ | |||
| <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 | Normally the `>` that begins a block quote may be followed | |||
| optionally by a space, which is not considered part of the | optionally by a space, which is not considered part of the | |||
| content. In the following case `>` is followed by a tab, | content. In the following case `>` is followed by a tab, | |||
| which is treated as if it were expanded into spaces. | which is treated as if it were expanded into three spaces. | |||
| Since one of theses spaces is considered part of the | Since one of these spaces is considered part of the | |||
| delimiter, `foo` is considered to be indented six spaces | delimiter, `foo` is considered to be indented six spaces | |||
| inside the block quote context, so we get an indented | inside the block quote context, so we get an indented | |||
| code block starting with two spaces. | code block starting with two spaces. | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| >→→foo | >→→foo | |||
| . | . | |||
| <blockquote> | <blockquote> | |||
| <pre><code> foo | <pre><code> foo | |||
| </code></pre> | </code></pre> | |||
| skipping to change at line 482 ¶ | skipping to change at line 484 ¶ | |||
| 出于安全考虑,Unicode 字符 `U+0000` 必须被替换 | 出于安全考虑,Unicode 字符 `U+0000` 必须被替换 | |||
| 为替换字符 (`U+FFFD`)。 | 为替换字符 (`U+FFFD`)。 | |||
| # 区块与行内元素 | # 区块与行内元素 | |||
| 我们可以将文档视为一系列的 | 我们可以将文档视为一系列的 | |||
| [区块](@)---即段落、区块引用、 | [区块](@)---即段落、区块引用、 | |||
| 列表、标题、分割线和代码块等结构元素。某些区块(例如 | 列表、标题、分割线和代码块等结构元素。某些区块(例如 | |||
| block quotes and list items) contain other blocks; others (like | block quotes and list items) contain other blocks; others (like | |||
| headings and paragraphs) contain [inline](@) content---text, | headings and paragraphs) contain [inline](@) content---text, | |||
| links, emphasized text, images, code, and so on. | links, emphasized text, images, code spans, and so on. | |||
| ## Precedence | ## Precedence | |||
| Indicators of block structure always take precedence over indicators | Indicators of block structure always take precedence over indicators | |||
| of inline structure. So, for example, the following is a list with | of inline structure. So, for example, the following is a list with | |||
| two items, not a list with one item containing a code span | two items, not a list with one item containing a code span | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| - `one | - `one | |||
| - two` | - two` | |||
| skipping to change at line 1559 ¶ | skipping to change at line 1561 ¶ | |||
| ~~~ | ~~~ | |||
| < | < | |||
| > | > | |||
| ~~~ | ~~~ | |||
| . | . | |||
| <pre><code>< | <pre><code>< | |||
| > | > | |||
| </code></pre> | </code></pre> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 少于三个反引号是不够的 | ||||
| ```````````````````````````````` 示例 | ||||
| `` | ||||
| foo | ||||
| `` | ||||
| . | ||||
| <p><code>foo</code></p> | ||||
| ```````````````````````````````` | ||||
| The closing code fence must use the same character as the opening | The closing code fence must use the same character as the opening | |||
| fence | fence | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| ``` | ``` | |||
| aaa | aaa | |||
| ~~~ | ~~~ | |||
| ``` | ``` | |||
| . | . | |||
| <pre><code>aaa | <pre><code>aaa | |||
| skipping to change at line 1918 ¶ | skipping to change at line 1930 ¶ | |||
| [空白]、行尾、字符串 `>` 或 | [空白]、行尾、字符串 `>` 或 | |||
| 字符串 `/>`。\ | 字符串 `/>`。\ | |||
| **结束条件:** 行后紧跟一个 [空行]。 | **结束条件:** 行后紧跟一个 [空行]。 | |||
| 7. **Start condition:** line begins with a complete [open tag] | 7. **Start condition:** line begins with a complete [open tag] | |||
| or [closing tag] (with any [tag name] other than `script`, | or [closing tag] (with any [tag name] other than `script`, | |||
| `style`, or `pre`) followed only by [whitespace] | `style`, or `pre`) followed only by [whitespace] | |||
| All types of [HTML blocks] except type 7 may interrupt | All types of [HTML blocks] except type 7 may interrupt | |||
| **结束条件:** 行后紧跟一个 [空行]。 | **结束条件:** 行后紧跟一个 [空行]。 | |||
| HTML blocks continue until they are closed by their appropriate | ||||
| [end condition], or the last line of the document or other [container block]. | ||||
| This means any HTML **within an HTML block** that might otherwise be recognised | ||||
| as a start condition will be ignored by the parser and passed through as-is, | ||||
| without changing the parser's state. | ||||
| For instance, `<pre>` within a HTML block started by `<table>` will not affect | ||||
| the parser state; as the HTML block was started in by start condition 6, it | ||||
| will end at any blank line. This can be surprising | ||||
| ```````````````````````````````` 示例 | ||||
| <table><tr><td> | ||||
| <pre> | ||||
| **Hello**, | ||||
| _world_. | ||||
| </pre> | ||||
| </td></tr></table> | ||||
| . | ||||
| <table><tr><td> | ||||
| <pre> | ||||
| **Hello**, | ||||
| <p><em>world</em>. | ||||
| </pre></p> | ||||
| </td></tr></table> | ||||
| ```````````````````````````````` | ||||
| In this case, the HTML block is terminated by the newline — the `**hello**` | ||||
| text remains verbatim — and regular parsing resumes, with a paragraph, | ||||
| emphasised `world` and inline and block HTML following. | ||||
| 除第 7 类之外的所有 [HTML 块] 类型都可以中断 | 除第 7 类之外的所有 [HTML 块] 类型都可以中断 | |||
| 一个段落。第 7 类块不能中断段落。 | 一个段落。第 7 类块不能中断段落。 | |||
| (This restriction is intended to prevent unwanted interpretation | (This restriction is intended to prevent unwanted interpretation | |||
| 进行意外的 HTML 块起始解释。) | 进行意外的 HTML 块起始解释。) | |||
| 下面是一些简单的例子。以下是第 6 类的一些基本 HTML 块 | 下面是一些简单的例子。以下是第 6 类的一些基本 HTML 块 | |||
| of type 6 | of type 6 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| <table> | <table> | |||
| skipping to change at line 3416 ¶ | skipping to change at line 3459 ¶ | |||
| 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 1 ≤ *N* ≤ 4 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 first list item in a [list] interrupts | 例外 | |||
| a paragraph---that is, when it starts on a line that would | ||||
| otherwise count as [paragraph continuation text]---then (a) | 1. When the first list item in a [list] interrupts | |||
| the lines *Ls* must not begin with a blank line, and (b) if | a paragraph---that is, when it starts on a line that would | |||
| the list item is ordered, the start number must be 1. | 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. | ||||
| 2. If any line is a [thematic break][thematic breaks] then | ||||
| that line is not a list item. | ||||
| 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 5458 ¶ | skipping to change at line 5505 ¶ | |||
| . | . | |||
| <p>```foo``</p> | <p>```foo``</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| `foo | `foo | |||
| . | . | |||
| <p>`foo</p> | <p>`foo</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| The following case also illustrates the need for opening and | ||||
| closing backtick strings to be equal in length | ||||
| ```````````````````````````````` 示例 | ||||
| `foo``bar`` | ||||
| . | ||||
| <p>`foo<code>bar</code></p> | ||||
| ```````````````````````````````` | ||||
| ## Emphasis and strong emphasis | ## Emphasis and strong emphasis | |||
| John Gruber's original [Markdown syntax | John Gruber's original [Markdown syntax | |||
| description](http://daringfireball.net/projects/markdown/syntax#em) says | description](http://daringfireball.net/projects/markdown/syntax#em) says | |||
| > Markdown treats asterisks (`*`) and underscores (`_`) as indicators of | > Markdown treats asterisks (`*`) and underscores (`_`) as indicators of | |||
| > emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML | > emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML | |||
| > `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML `<strong>` | > `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML `<strong>` | |||
| > tag. | > tag. | |||
| skipping to change at line 5506 ¶ | skipping to change at line 5562 ¶ | |||
| ``` markdown | ``` markdown | |||
| internal emphasis: foo*bar*baz | internal emphasis: foo*bar*baz | |||
| no emphasis: foo_bar_baz | no emphasis: foo_bar_baz | |||
| ``` | ``` | |||
| 下面给出的规则涵盖了所有这些模式,同时允许 | 下面给出的规则涵盖了所有这些模式,同时允许 | |||
| 使用不需要回溯的高效解析策略。 | 使用不需要回溯的高效解析策略。 | |||
| First, some definitions. A [delimiter run](@) is either | First, some definitions. A [delimiter run](@) is either | |||
| 一个或多个 `*` 字符组成的序列,且其前后没有 | 一个或多个 `*` 字符组成的序列,且其前后没有 | |||
| followed by a `*` character, or a sequence of one or more `_` | followed by a non-backslash-escaped `*` character, or a sequence | |||
| 字符组成的序列,且其前后没有 `_` 字符。 | of one or more `_` characters that is not preceded or followed by | |||
| a non-backslash-escaped `_` character. | ||||
| A [left-flanking delimiter run](@) is | A [left-flanking delimiter run](@) is | |||
| a [delimiter run] that is (a) not followed by [Unicode whitespace], | a [delimiter run] that is (a) not followed by [Unicode whitespace], | |||
| and (b) either not followed by a [punctuation character], or | and (b) not followed by a [punctuation character], or | |||
| preceded by [Unicode whitespace] or a [punctuation character]. | preceded by [Unicode whitespace] or a [punctuation character]. | |||
| 就此定义而言,行的开头和结尾 | 就此定义而言,行的开头和结尾 | |||
| the line count as Unicode whitespace. | the line count as Unicode whitespace. | |||
| A [right-flanking delimiter run](@) is | A [right-flanking delimiter run](@) is | |||
| a [delimiter run] that is (a) not preceded by [Unicode whitespace], | a [delimiter run] that is (a) not preceded by [Unicode whitespace], | |||
| and (b) either not preceded by a [punctuation character], or | and (b) not preceded by a [punctuation character], or | |||
| followed by [Unicode whitespace] or a [punctuation character]. | followed by [Unicode whitespace] or a [punctuation character]. | |||
| 就此定义而言,行的开头和结尾 | 就此定义而言,行的开头和结尾 | |||
| the line count as Unicode whitespace. | the line count as Unicode whitespace. | |||
| 以下是一些定界符序列的示例。 | 以下是一些定界符序列的示例。 | |||
| - 左侧分隔但非右侧分隔 | - 左侧分隔但非右侧分隔 | |||
| ``` | ``` | |||
| ***abc | ***abc | |||
| skipping to change at line 5597 ¶ | skipping to change at line 5654 ¶ | |||
| 6. A double `__` [can open strong emphasis] iff | 6. A double `__` [can open strong emphasis] iff | |||
| 它是 [左侧定界符序列] 的一部分 | 它是 [左侧定界符序列] 的一部分 | |||
| and either (a) 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 delimiter run] | or (b) part of a [right-flanking delimiter run] | |||
| preceded by punctuation. | preceded by punctuation. | |||
| 7. A double `**` [can close strong emphasis](@) | 7. A double `**` [can close strong emphasis](@) | |||
| 当且仅当它是 [右侧定界符序列] 的一部分时。 | 当且仅当它是 [右侧定界符序列] 的一部分时。 | |||
| 8. 双 `__` [可以关闭强强调] | 8. A double `__` [can close strong emphasis] iff | |||
| 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. The | character (`_` or `*`) as the opening delimiter. The | |||
| opening and closing delimiters must belong to separate | opening and closing delimiters must belong to separate | |||
| [delimiter runs]. If one of the delimiters can both | [delimiter runs]. If one of the delimiters can both | |||
| skipping to change at line 5637 ¶ | skipping to change at line 5694 ¶ | |||
| `_`-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, | |||
| the following principles resolve ambiguity | the following principles resolve ambiguity | |||
| 13. The number of nestings should be minimized. Thus, for example, | 13. The number of nestings should be minimized. Thus, for example, | |||
| 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 `<em><strong>...</strong></em>` is always | |||
| preferred to `<em><strong>..</strong></em>`. | preferred to `<strong><em>...</em></strong>`. | |||
| 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>`. | than `*foo <em>bar* baz</em>`. | |||
| 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, | |||
| skipping to change at line 6542 ¶ | skipping to change at line 6599 ¶ | |||
| ******foo****** | ******foo****** | |||
| . | . | |||
| <p><strong><strong><strong>foo</strong></strong></strong></p> | <p><strong><strong><strong>foo</strong></strong></strong></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 规则 14 | 规则 14 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| ***foo*** | ***foo*** | |||
| . | . | |||
| <p><strong><em>foo</em></strong></p> | <p><em><strong>foo</strong></em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| _____foo_____ | _____foo_____ | |||
| . | . | |||
| <p><strong><strong><em>foo</em></strong></strong></p> | <p><em><strong><strong>foo</strong></strong></em></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 规则 15 | 规则 15 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| *foo _bar* baz_ | *foo _bar* baz_ | |||
| . | . | |||
| <p><em>foo _bar</em> baz_</p> | <p><em>foo _bar</em> baz_</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 6674 ¶ | skipping to change at line 6731 ¶ | |||
| A [link destination](@) consists of either | A [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 spaces, line breaks, or unescaped | closing `>` that contains no spaces, line breaks, or unescaped | |||
| `<` or `>` characters, or | `<` 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. (Implementations | |||
| inside a balanced pair of unescaped parentheses. | may impose limits on parentheses nesting to avoid performance | |||
| issues, but at least three levels of nesting should be supported.) | ||||
| A [link title](@) consists of either | A [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 6774 ¶ | skipping to change at line 6832 ¶ | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 链接目标内的圆括号可以进行转义 | 链接目标内的圆括号可以进行转义 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| [link](\(foo\)) | [link](\(foo\)) | |||
| . | . | |||
| <p><a href="(foo)">link</a></p> | <p><a href="(foo)">link</a></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| 在不进行转义的情况下,允许使用一层平衡的圆括号。 | Any number of parentheses are allowed without escaping, as long as they are | |||
| balanced | ||||
| ```````````````````````````````` 示例 | ||||
| [link]((foo)and(bar)) | ||||
| . | ||||
| <p><a href="(foo)and(bar)">link</a></p> | ||||
| ```````````````````````````````` | ||||
| 然而,如果括号内包含括号,你需要进行转义 | ||||
| 或使用 `<...>` 形式 | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| [link](foo(and(bar))) | [link](foo(and(bar))) | |||
| . | . | |||
| <p>[link](foo(and(bar)))</p> | <p><a href="foo(and(bar))">link</a></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| However, if you have unbalanced parentheses, you need to escape or use the | ||||
| `<...>` form | ||||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| [link](foo(and\(bar\))) | [link](foo\(and\(bar\)) | |||
| . | . | |||
| <p><a href="foo(and(bar))">link</a></p> | <p><a href="foo(and(bar)">link</a></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| [link](<foo(and(bar))>) | [link](<foo(and(bar)>) | |||
| . | . | |||
| <p><a href="foo(and(bar))">link</a></p> | <p><a href="foo(and(bar)">link</a></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| Parentheses and other symbols can also be escaped, as usual | Parentheses and other symbols can also be escaped, as usual | |||
| in Markdown | in Markdown | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| [link](foo\)\:) | [link](foo\)\:) | |||
| . | . | |||
| <p><a href="foo):">link</a></p> | <p><a href="foo):">link</a></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| skipping to change at line 7056 ¶ | skipping to change at line 7109 ¶ | |||
| [full](#full-reference-link), [collapsed](#collapsed-reference-link), | [full](#full-reference-link), [collapsed](#collapsed-reference-link), | |||
| and [shortcut](#shortcut-reference-link). | and [shortcut](#shortcut-reference-link). | |||
| A [full reference link](@) | A [full reference link](@) | |||
| consists of a [link text] immediately followed by a [link label] | consists of a [link text] immediately followed by a [link label] | |||
| that [matches] a [link reference definition] elsewhere in the document. | that [matches] a [link reference definition] elsewhere in the document. | |||
| A [link label](@) begins with a left bracket (`[`) and ends | A [link label](@) begins with a left bracket (`[`) and ends | |||
| 并以第一个未被反斜杠转义的右方括号(`]`)结束。 | 并以第一个未被反斜杠转义的右方括号(`]`)结束。 | |||
| 在这些方括号之间必须至少有一个 [非空白字符]。 | 在这些方括号之间必须至少有一个 [非空白字符]。 | |||
| 未转义的方括号字符在 [链接标签] 中是不允许的。 | Unescaped square bracket characters are not allowed inside the | |||
| [link labels]. A link label can have at most 999 | opening and closing square brackets of [link labels]. A link | |||
| characters inside the square brackets. | label can have at most 999 characters inside the square | |||
| brackets. | ||||
| One label [matches](@) | One label [matches](@) | |||
| 另一个。要归一化一个标签,执行 *unicode 大小写折叠* 并将连续的内部 | 另一个。要归一化一个标签,执行 *unicode 大小写折叠* 并将连续的内部 | |||
| label, perform the *Unicode case fold* and collapse consecutive internal | label, strip off the opening and closing brackets, | |||
| perform the *Unicode case fold*, strip leading and trailing | ||||
| [whitespace] and collapse consecutive internal | ||||
| 匹配的引用链接定义,则使用文档中首先出现的那个。 | 匹配的引用链接定义,则使用文档中首先出现的那个。 | |||
| (在这种情况下,发出警告是可取的。) | (在这种情况下,发出警告是可取的。) | |||
| 第一个链接标签的内容被解析为行内内容, | 第一个链接标签的内容被解析为行内内容, | |||
| 并用作链接的文本。链接的 URI 和标题由 | 并用作链接的文本。链接的 URI 和标题由 | |||
| 匹配的 [链接引用定义] 提供。 | 匹配的 [链接引用定义] 提供。 | |||
| matching [link reference definition]. | matching [link reference definition]. | |||
| 这是一个简单的例子 | 这是一个简单的例子 | |||
| skipping to change at line 7752 ¶ | skipping to change at line 7808 ¶ | |||
| 链接标签不区分大小写。 | 链接标签不区分大小写。 | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| ![Foo] | ![Foo] | |||
| [foo]: /url "title" | [foo]: /url "title" | |||
| . | . | |||
| <p><img src="/url" alt="Foo" title="title" /></p> | <p><img src="/url" alt="Foo" title="title" /></p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| If you just want bracketed text, you can backslash-escape the | If you just want a literal `!` followed by bracketed text, you can | |||
| opening `!` and `[`: | backslash-escape the opening `[`: | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| \!\[foo] | !\[foo] | |||
| [foo]: /url "title" | [foo]: /url "title" | |||
| . | . | |||
| <p>![foo]</p> | <p>![foo]</p> | |||
| ```````````````````````````````` | ```````````````````````````````` | |||
| If you want a link after a literal `!`, backslash-escape the | If you want a link after a literal `!`, backslash-escape the | |||
| `!`: | `!`: | |||
| ```````````````````````````````` 示例 | ```````````````````````````````` 示例 | |||
| End of changes. 29 change blocks. | ||||
| 49 lines changed or deleted | 105 lines changed or added | |||
This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||