summaryrefslogtreecommitdiff
path: root/tests/test_syntax/inline
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2022-01-10 13:47:41 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2022-01-10 13:57:57 -0500
commitaf38c42706f8dff93694d4a7572003dbd8b0ddc0 (patch)
treed2f879bce807e6be77967388c3543002d8b77181 /tests/test_syntax/inline
parent1d41f13c774696d651921601c827ed500e2aa285 (diff)
downloadpython-markdown-af38c42706f8dff93694d4a7572003dbd8b0ddc0.tar.gz
Disallow square brackets in reference link ids.
We already disallow right square brackets. This also disallows left square brackets, which ensures link references will be less likely to collide with standard links in some weird edge cases. Fixes #1209.
Diffstat (limited to 'tests/test_syntax/inline')
-rw-r--r--tests/test_syntax/inline/test_links.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_syntax/inline/test_links.py b/tests/test_syntax/inline/test_links.py
index 7a3e1c3..0458756 100644
--- a/tests/test_syntax/inline/test_links.py
+++ b/tests/test_syntax/inline/test_links.py
@@ -350,3 +350,37 @@ class TestReferenceLinks(TestCase):
'<p>I would like to tell you about the [code of</p>\n'
'<p>conduct][] we are using in this project.</p>'
)
+
+ def test_ref_link_nested_left_bracket(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ [Text[]
+
+ [Text[]: http://example.com
+ """
+ ),
+ self.dedent(
+ """
+ <p>[Text[]</p>
+ <p>[Text[]: http://example.com</p>
+ """
+ )
+ )
+
+ def test_ref_link_nested_right_bracket(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ [Text]]
+
+ [Text]]: http://example.com
+ """
+ ),
+ self.dedent(
+ """
+ <p>[Text]]</p>
+ <p>[Text]]: http://example.com</p>
+ """
+ )
+ )