Commits

David Chambers committed 1a79535

Added a call to `Markdown#reset` to fix a regression affecting heading ids.

Comments (0)

Files changed (2)

         md.reset()
         # discern link definitions
         md.convert(self.source)
-        references = md.references
+        references = md.references.copy()
+
+        # Having invoked `Markdown#convert` we've populated our
+        # `Markdown` instance with unwanted values. The HeaderId
+        # extension, for example, stores the ids it encounters on
+        # the `Markdown` instance. We must reset the instance to
+        # remove this unwanted data.
+        md.reset()
 
         self.meta = processmetalists(getattr(md, 'Meta', {}))
 

tests/__init__.py

                          '%smango-0.5-released/' % self.mount_point)
 
 
+class HeaderIdTests(unittest.TestCase):
+
+    def setUp(self):
+        mango.settings.MARKDOWN_EXTENSIONS = ('headerid',)
+
+    def test_basic_functionality(self):
+        document = create_document('## Internationalization {#i18n}')
+        self.assertTrue('<h2 id="i18n">' in document.html)
+
+
 class RelatedDocumentsTests(unittest.TestCase):
 
     def create(self, tags):