diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py index d8caae27c..5cb0331e3 100644 --- a/markdown/extensions/footnotes.py +++ b/markdown/extensions/footnotes.py @@ -311,7 +311,9 @@ def run(self, text): text = text.replace( FN_BACKLINK_TEXT, self.footnotes.getConfig("BACKLINK_TEXT") ) - return text.replace(NBSP_PLACEHOLDER, " ") + result = text.replace(NBSP_PLACEHOLDER, " ") + self.footnotes.reset() + return result def makeExtension(*args, **kwargs): diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 38f0be3c9..9427c376d 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -858,3 +858,40 @@ def testCustomSubstitutions(self): is the ‚mdash‘: \u2014 Must not be confused with ‚ndash‘ (\u2013) \u2026 ]
""" self.assertEqual(self.md.convert(text), correct) + + +class TestFootnotes(unittest.TestCase): + """ Test Footnotes extension. """ + + def setUp(self): + self.md = markdown.Markdown(extensions=['markdown.extensions.footnotes']) + + def testSimpleFootnotes(self): + """ Test Footnotes. """ + text = "Foo[^1] Bar\n[^1]: Baz" + self.assertEqual( + self.md.convert(text), + 'Foo1 Bar
\n' + 'Baz ' + '' + '↩' + '' + '
\n' + 'Foo
' + )