Skip to content

Commit cd752c0

Browse files
committed
Added footnote BACKLINK_TEXT test.
1 parent fd4d1d2 commit cd752c0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_extensions.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,3 +932,27 @@ def testCustomSubstitutions(self):
932932
is the ‚mdash‘: \u2014
933933
Must not be confused with &sbquo;ndash&lsquo; (\u2013) \u2026 ]</p>"""
934934
self.assertEqual(self.md.convert(text), correct)
935+
936+
937+
class TestFootnotes(unittest.TestCase):
938+
""" Test Footnotes extension. """
939+
940+
def testBacklinkText(self):
941+
md = markdown.Markdown(
942+
extensions=['markdown.extensions.footnotes'],
943+
extension_configs={'markdown.extensions.footnotes': {'BACKLINK_TEXT': 'back'}}
944+
)
945+
text = 'paragraph[^1]\n\n[^1]: A Footnote'
946+
self.assertEqual(
947+
md.convert(text),
948+
'<p>paragraph<sup id="fnref:1"><a class="footnote-ref" href="#fn:1" rel="footnote">1</a></sup></p>\n'
949+
'<div class="footnote">\n'
950+
'<hr />\n'
951+
'<ol>\n'
952+
'<li id="fn:1">\n'
953+
'<p>A Footnote&#160;<a class="footnote-backref" href="#fnref:1" rev="footnote"'
954+
' title="Jump back to footnote 1 in the text">back</a></p>\n'
955+
'</li>\n'
956+
'</ol>\n'
957+
'</div>'
958+
)

0 commit comments

Comments
 (0)