aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_extensions.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 6d47e0e..a5b739e 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -775,6 +775,21 @@ class TestTOC(TestCaseWithAssertStartsWith):
'<h2 id="header-2"><a class="toclink" href="#header-2">Header <em>2</em></a></h2>'
)
+ def testAnchorLinkWithInlineCode(self):
+ """ Test TOC Anchorlink with inline code. """
+ md = markdown.Markdown(
+ extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)]
+ )
+ text = '# This is `code` and `this` too.'
+ self.assertEqual(
+ md.convert(text),
+ '<h1 id="this-is-code-and-this-too">' # noqa
+ '<a class="toclink" href="#this-is-code-and-this-too">' # noqa
+ 'This is <code>code</code> and <code>this</code> too.' # noqa
+ '</a>' # noqa
+ '</h1>' # noqa
+ )
+
def testTitle(self):
""" Test TOC Title. """
md = markdown.Markdown(