summaryrefslogtreecommitdiff
path: root/tests/test_syntax/extensions/test_toc.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2019-11-26 13:53:40 -0500
committerGitHub <noreply@github.com>2019-11-26 13:53:40 -0500
commit66517465786b90ccb7fcffeef7996b593374d889 (patch)
tree2a2c09d632e230ef5654d772121297e81fc84a9a /tests/test_syntax/extensions/test_toc.py
parent1f3ec538a2acf25607253fc7c7a992950463931d (diff)
downloadpython-markdown-66517465786b90ccb7fcffeef7996b593374d889.tar.gz
Add permalink_title option (#886)
Addes a new `permalink_title` option to the TOC extension, which allows the title attribute of a permalink to be set to something other than the default English string "Permanent link". Fixes #781.
Diffstat (limited to 'tests/test_syntax/extensions/test_toc.py')
-rw-r--r--tests/test_syntax/extensions/test_toc.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_syntax/extensions/test_toc.py b/tests/test_syntax/extensions/test_toc.py
index 65fc0c2..5b9ad92 100644
--- a/tests/test_syntax/extensions/test_toc.py
+++ b/tests/test_syntax/extensions/test_toc.py
@@ -99,3 +99,23 @@ class TestTOC(TestCase):
'</h1>', # noqa
extensions=[TocExtension(permalink=True, permalink_class="custom1 custom2")]
)
+
+ def testPermalinkWithCustomTitle(self):
+ self.assertMarkdownRenders(
+ '# Header',
+ '<h1 id="header">' # noqa
+ 'Header' # noqa
+ '<a class="headerlink" href="#header" title="custom">&para;</a>' # noqa
+ '</h1>', # noqa
+ extensions=[TocExtension(permalink=True, permalink_title="custom")]
+ )
+
+ def testPermalinkWithEmptyTitle(self):
+ self.assertMarkdownRenders(
+ '# Header',
+ '<h1 id="header">' # noqa
+ 'Header' # noqa
+ '<a class="headerlink" href="#header">&para;</a>' # noqa
+ '</h1>', # noqa
+ extensions=[TocExtension(permalink=True, permalink_title="")]
+ )