From 3522cdfa9c6b9d181d0144b190a35fc45f9f71fa Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 6 Jul 2014 16:28:37 -0600 Subject: [PATCH] Fix for when tag.text is None --- markdown/extensions/headeranchor.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/markdown/extensions/headeranchor.py b/markdown/extensions/headeranchor.py index a9ac9f8c..6c15111c 100644 --- a/markdown/extensions/headeranchor.py +++ b/markdown/extensions/headeranchor.py @@ -40,10 +40,13 @@ def run(self, root): id = stashedHTML2text(''.join(itertext(tag)), self.md) id = unique(slugify(id, self.config.get('sep')), used_ids) tag.set('id', id) - tag.text = self.markdown.htmlStash.store( + text = self.markdown.htmlStash.store( LINK % {"id": id}, safe=True - ) + tag.text + ) + if tag.text is not None: + text + tag.text + tag.text = text return root