diff options
-rw-r--r-- | markdown/extensions/toc.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py index b3cf898..56db33c 100644 --- a/markdown/extensions/toc.py +++ b/markdown/extensions/toc.py @@ -180,7 +180,8 @@ class TocTreeprocessor(Treeprocessor): c.text = "" for elem in c: anchor.append(elem) - c.remove(elem) + while c: + c.remove(c[0]) c.append(anchor) def add_permalink(self, c, elem_id): |