diff options
author | Isaac Muse <faceless.shop@gmail.com> | 2018-10-30 09:09:40 -0600 |
---|---|---|
committer | Waylan Limberg <waylan.limberg@icloud.com> | 2018-10-30 11:09:40 -0400 |
commit | a38fd1bb8b15e5de44e322b3345d0b5c29d5bf6b (patch) | |
tree | d39d28e0c81666602763afaa3e7e9c65c2912aae /tests | |
parent | 7c78ac347b5dcad2be3d8d18b37ec33c96c1eb0b (diff) | |
download | python-markdown-a38fd1bb8b15e5de44e322b3345d0b5c29d5bf6b.tar.gz |
Collapse all whitespace in reference ids (#743)
Previously only newlines preceded by whitespace were collapsed. Fixes #742.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_syntax/inline/test_links.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_syntax/inline/test_links.py b/tests/test_syntax/inline/test_links.py index e147c82..988e041 100644 --- a/tests/test_syntax/inline/test_links.py +++ b/tests/test_syntax/inline/test_links.py @@ -134,3 +134,40 @@ class TestAdvancedLinks(TestCase): '[title](http://example.com/?a=1&b=2)', '<p><a href="http://example.com/?a=1&b=2">title</a></p>' ) + + def test_reference_newlines(self): + """Test reference id whitespace cleanup.""" + + self.assertMarkdownRenders( + self.dedent( + """ + Two things: + + - I would like to tell you about the [code of + conduct][] we are using in this project. + - Only one in fact. + + [code of conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md + """ + ), + '<p>Two things:</p>\n<ul>\n<li>I would like to tell you about the ' + '<a href="https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md">code of\n' + ' conduct</a> we are using in this project.</li>\n<li>Only one in fact.</li>\n</ul>' + ) + + def test_reference_across_blocks(self): + """Test references across blocks.""" + + self.assertMarkdownRenders( + self.dedent( + """ + I would like to tell you about the [code of + + conduct][] we are using in this project. + + [code of conduct]: https://github.com/Python-Markdown/markdown/blob/master/CODE_OF_CONDUCT.md + """ + ), + '<p>I would like to tell you about the [code of</p>\n' + '<p>conduct][] we are using in this project.</p>' + ) |