diff options
-rw-r--r-- | spec.txt | 37 | ||||
-rw-r--r-- | test/normalize.py | 3 |
2 files changed, 37 insertions, 3 deletions
@@ -1953,6 +1953,17 @@ The link destination may not be omitted: <p>[foo]</p> . +Both title and destination can contain backslash escapes +and literal backslashes: + +. +[foo]: /url\bar\*baz "foo\"bar\baz" + +[foo] +. +<p><a href="/url%5Cbar*baz" title="foo"bar\baz">foo</a></p> +. + A link can come before its corresponding definition: . @@ -2022,6 +2033,15 @@ This is not a link reference definition, because there are <p>[foo]: /url "title" ok</p> . +This is a link reference definition, but it has no title: + +. +[foo]: /url +"title" ok +. +<p>"title" ok</p> +. + This is not a link reference definition, because it is indented four spaces: @@ -4356,9 +4376,13 @@ is used as an authoritative source of the valid entity names and their corresponding codepoints. . - & © Æ Ď ¾ ℋ ⅆ ∲ + & © Æ Ď +¾ ℋ ⅆ +∲ ≧̸ . -<p> & © Æ Ď ¾ ℋ ⅆ ∲</p> +<p> & © Æ Ď +¾ ℋ ⅆ +∲ ≧̸</p> . [Decimal entities](@decimal-entities) @@ -5976,6 +6000,15 @@ in Markdown: <p><a href="foo):">link</a></p> . +Note that a backslash before a non-escapable character is +just a backslash: + +. +[link](foo\bar) +. +<p><a href="foo%5Cbar">link</a></p> +. + URL-escaping should be left alone inside the destination, as all URL-escaped characters are also valid URL characters. HTML entities in the destination will be parsed into the corresponding unicode diff --git a/test/normalize.py b/test/normalize.py index 03d958e..70bee46 100644 --- a/test/normalize.py +++ b/test/normalize.py @@ -21,7 +21,8 @@ class MyHTMLParser(HTMLParser): after_block_tag = after_tag and self.is_block_tag(self.last_tag) if after_tag and self.last_tag == "br": data = data.lstrip('\n') - data = whitespace_re.sub(' ', data) + if not self.in_pre: + data = whitespace_re.sub(' ', data) if after_block_tag and not self.in_pre: if self.last == "starttag": data = data.lstrip() |