aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Groß <stephan@minddust.com>2016-03-17 15:32:57 +0000
committerStephan Groß <stephan@minddust.com>2016-03-17 15:32:57 +0000
commit56f491eeeeddb9651d68a0fd6d21aac139abca52 (patch)
tree4d596a5c36a0181667fd3127927fa128d629b46f
parent935d55bc1320612bf7f2e46c3510f43eb0531108 (diff)
downloadmarkdown-56f491eeeeddb9651d68a0fd6d21aac139abca52.tar.gz
markdown-56f491eeeeddb9651d68a0fd6d21aac139abca52.tar.bz2
markdown-56f491eeeeddb9651d68a0fd6d21aac139abca52.zip
Add toc permalink tests
-rw-r--r--tests/test_extensions.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index a5b739e..7a18b94 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -790,6 +790,34 @@ class TestTOC(TestCaseWithAssertStartsWith):
'</h1>' # noqa
)
+ def testPermalink(self):
+ """ Test TOC Permalink. """
+ md = markdown.Markdown(
+ extensions=[markdown.extensions.toc.TocExtension(permalink=True)]
+ )
+ text = '# Header'
+ self.assertEqual(
+ md.convert(text),
+ '<h1 id="header">' # noqa
+ 'Header' # noqa
+ '<a class="headerlink" href="#header" title="Permanent link">&para;</a>' # noqa
+ '</h1>' # noqa
+ )
+
+ def testPermalinkWithInlineCode(self):
+ """ Test TOC Permalink with inline code. """
+ md = markdown.Markdown(
+ extensions=[markdown.extensions.toc.TocExtension(permalink=True)]
+ )
+ text = '# This is `code` and `this` too.'
+ self.assertEqual(
+ md.convert(text),
+ '<h1 id="this-is-code-and-this-too">' # noqa
+ 'This is <code>code</code> and <code>this</code> too.' # noqa
+ '<a class="headerlink" href="#this-is-code-and-this-too" title="Permanent link">&para;</a>' # noqa
+ '</h1>' # noqa
+ )
+
def testTitle(self):
""" Test TOC Title. """
md = markdown.Markdown(