spec.txt | spec.txt | |||
---|---|---|---|---|
--- | --- | |||
title: CommonMark Spec | title: CommonMark Spec | |||
author: John MacFarlane | author: John MacFarlane | |||
version: 0.18 | version: 0.19 | |||
date: 2015-03-03 | date: 2015-04-27 | |||
license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)' | license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)' | |||
... | ... | |||
# Introduction | # Introduction | |||
## What is Markdown? | ## What is Markdown? | |||
Markdown is a plain text format for writing structured documents, | Markdown is a plain text format for writing structured documents, | |||
based on conventions used for indicating formatting in email and | based on conventions used for indicating formatting in email and | |||
usenet posts. It was developed in 2004 by John Gruber, who wrote | usenet posts. It was developed in 2004 by John Gruber, who wrote | |||
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). | |||
In the examples, the `→` character is used to represent tabs. | In the examples, the `→` character is used to represent tabs. | |||
# Preliminaries | # Preliminaries | |||
## Characters and lines | ## Characters and lines | |||
Any sequence of [character]s is a valid CommonMark | Any sequence of [character]s is a valid CommonMark | |||
document. | document. | |||
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) | |||
consists of a [link label], indented up to three spaces, followed | consists of a [link label], indented up to three spaces, followed | |||
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], | |||
optional [whitespace] (including up to one | optional [whitespace] (including up to one | |||
[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 | |||
block and not separated from each other by more than one blank line, | block and not separated from each other by more than one blank line, | |||
and *M* is a list marker *M* of width *W* followed by | and *M* is a list marker of width *W* followed by | |||
one space, then the result of prepending *M* and the following | one space, then the result of prepending *M* and the following | |||
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. | |||
An indented code block will have to be indented four spaces beyond | An indented code block will have to be indented four spaces beyond | |||
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. | |||
Here are some list items that start with a blank line but are not empty: | Here are some list items that start with a blank line but are not empty: | |||
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. | |||
Indented one space: | Indented one space: | |||
. | . | |||
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 | |||
corresponding codepoints. | corresponding codepoints. | |||
. | . | |||
& © Æ Ď ¾ ℋ ⅆ &Cl ockwiseContourIntegral; | & © Æ Ď ¾ ℋ ⅆ &Cl ockwiseContourIntegral; | |||
. | . | |||
<p> & © Æ Ď ¾ ℋ ⅆ ∲</p> | <p> & © Æ Ď ¾ ℋ ⅆ ∲</p> | |||
. | . | |||
[Decimal entities](@decimal-entities) | [Decimal entities](@decimal-entities) | |||
consist of `&#` + a string of 1--8 arabic digits + `;`. Again, these | consist of `&#` + a string of 1--8 arabic digits + `;`. Again, these | |||
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) | [Hexadecimal entities](@hexadecimal-entities) | |||
consist of `&#` + either `X` or `x` + a string of 1-8 hexadecimal digits | consist of `&#` + either `X` or `x` + a string of 1-8 hexadecimal digits | |||
+ `;`. 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> | |||
. | . | |||
Here are some nonentities: | Here are some nonentities: | |||
. | . | |||
skipping to change at line 4551 | skipping to change at line 4553 | |||
for efficient parsing strategies that do not backtrack. | for efficient parsing strategies that do not backtrack. | |||
First, some definitions. A [delimiter run](@delimiter-run) is either | First, some definitions. A [delimiter run](@delimiter-run) is either | |||
a sequence of one or more `*` characters that is not preceded or | a sequence of one or more `*` characters that is not preceded or | |||
followed by a `*` character, or a sequence of one or more `_` | followed by a `*` character, or a sequence of one or more `_` | |||
characters that is not preceded or followed by a `_` character. | characters that is not preceded or followed by a `_` character. | |||
A [left-flanking delimiter run](@left-flanking-delimiter-run) is | A [left-flanking delimiter run](@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) either not followed by a [punctuation character], or | |||
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. | ||||
A [right-flanking delimiter run](@right-flanking-delimiter-run) is | A [right-flanking delimiter run](@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) either not preceded by a [punctuation character], or | |||
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. | ||||
Here are some examples of delimiter runs. | Here are some examples of delimiter runs. | |||
- left-flanking but not right-flanking: | - left-flanking but not right-flanking: | |||
``` | ``` | |||
***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 | |||
after comes from Roopesh Chander's | after comes from Roopesh Chander's | |||
[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 uses the terminology "emphasis indicator string" instead of "delimiter | vfmd uses the terminology "emphasis indicator string" instead of "delimiter | |||
run," and its rules for distinguishing left- and right-flanking runs | run," and its rules for distinguishing left- and right-flanking runs | |||
are a bit more complex than the ones given here.) | are a bit more complex than the ones given here.) | |||
The following rules define emphasis and strong emphasis: | The following rules define emphasis and strong emphasis: | |||
1. A single `*` character [can open emphasis](@can-open-emphasis) | 1. A single `*` character [can open emphasis](@can-open-emphasis) | |||
iff it is part of a [left-flanking delimiter run]. | iff (if and only if) it is part of a [left-flanking delimiter run]. | |||
2. A single `_` character [can open emphasis] iff | 2. A single `_` character [can open emphasis] iff | |||
it is part of a [left-flanking delimiter run] | 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. | ||||
3. A single `*` character [can close emphasis](@can-close-emphasis) | 3. A single `*` character [can close emphasis](@can-close-emphasis) | |||
iff it is part of a [right-flanking delimiter run]. | iff it is part of a [right-flanking delimiter run]. | |||
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. A double `**` [can open strong emphasis](@can-open-strong-emphasis) | 5. A double `**` [can open strong emphasis](@can-open-strong-emphasis) | |||
iff it is part of a [left-flanking delimiter run]. | iff it is part of a [left-flanking delimiter run]. | |||
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] | 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. A double `**` [can close strong emphasis](@can-close-strong-emphasis) | 7. A double `**` [can close strong emphasis](@can-close-strong-emphasis) | |||
iff it is part of a [right-flanking delimiter run]. | iff it is part of a [right-flanking delimiter run]. | |||
8. A double `__` [can close strong emphasis] | 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 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. Emphasis begins with a delimiter that [can open emphasis] and ends | 9. Emphasis begins with a delimiter that [can open emphasis] and ends | |||
with a delimiter that [can close emphasis], and that uses the same | with a delimiter that [can close emphasis], and that uses the same | |||
character (`_` or `*`) as the opening delimiter. There must | character (`_` or `*`) as the opening delimiter. There must | |||
be a nonempty sequence of inlines between the open delimiter | be a nonempty sequence of inlines between the open delimiter | |||
and the closing delimiter; these form the contents of the emphasis | and the closing delimiter; these form the contents of the emphasis | |||
inline. | inline. | |||
10. Strong emphasis begins with a delimiter that | 10. Strong emphasis begins with a delimiter that | |||
[can open strong emphasis] and ends with a delimiter that | [can open strong emphasis] and ends with a delimiter that | |||
skipping to change at line 4792 | skipping to change at line 4804 | |||
Here `_` does not generate emphasis, because the first delimiter run | Here `_` does not generate emphasis, because the first delimiter run | |||
is right-flanking and the second left-flanking: | is right-flanking and the second left-flanking: | |||
. | . | |||
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 | |||
punctuation: | ||||
. | . | |||
"aa"_"bb"_"cc" | foo-_(bar)_ | |||
. | . | |||
<p>"aa"_"bb"_"cc"</p> | <p>foo-<em>(bar)</em></p> | |||
. | . | |||
Rule 3: | Rule 3: | |||
This is not emphasis, because the closing delimiter does | This is not emphasis, because the closing delimiter does | |||
not match the opening delimiter: | not match the opening delimiter: | |||
. | . | |||
_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 | ||||
both left- and right-flanking, because it is followed by | ||||
punctuation: | ||||
. | ||||
_(bar)_. | ||||
. | ||||
<p><em>(bar)</em>.</p> | ||||
. | ||||
Rule 5: | Rule 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 | |||
followed by whitespace: | followed by whitespace: | |||
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> | |||
. | . | |||
This is strong emphasis, even though the opening delimiter is | ||||
both left- and right-flanking, because it is preceded by | ||||
punctuation: | ||||
. | ||||
foo-_(bar)_ | ||||
. | ||||
<p>foo-<em>(bar)</em></p> | ||||
. | ||||
Rule 7: | Rule 7: | |||
This is not strong emphasis, because the closing delimiter is preceded | This is not strong emphasis, because the closing delimiter is preceded | |||
by whitespace: | by whitespace: | |||
. | . | |||
**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> | |||
. | . | |||
This is strong emphasis, even though the closing delimiter is | ||||
both left- and right-flanking, because it is followed by | ||||
punctuation: | ||||
. | ||||
_(bar)_. | ||||
. | ||||
<p><em>(bar)</em>.</p> | ||||
. | ||||
Rule 9: | Rule 9: | |||
Any nonempty sequence of inline elements can be the contents of an | Any nonempty sequence of inline elements can be the contents of an | |||
emphasized span. | emphasized span. | |||
. | . | |||
*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-escaping should be left alone inside the destination, as all | URL-escaping should be left alone inside the destination, as all | |||
URL-escaped characters are also valid URL characters. HTML entities in | URL-escaped characters are also valid URL characters. HTML entities in | |||
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> | |||
. | . | |||
Note that, because titles can often be parsed as destinations, | Note that, because titles can often be parsed as destinations, | |||
if you try to omit the destination and keep the title, you'll | if you try to omit the destination and keep the title, you'll | |||
get unexpected results: | get unexpected results: | |||
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 | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |