summaryrefslogtreecommitdiff
path: root/markdown/extensions/toc.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-08-11 08:35:15 -0400
committerWaylan Limberg <waylan@gmail.com>2013-08-11 08:35:15 -0400
commit72012c35273cef24b57af833cb38ac4cca6db98e (patch)
tree20165ae59468bc5d6f0964a8258c05e78030c743 /markdown/extensions/toc.py
parentd12d2c95b42c5fc0910b13859001755d71ad3438 (diff)
downloadpython-markdown-72012c35273cef24b57af833cb38ac4cca6db98e.tar.gz
Extended headerid's rawHTML in id handling to toc ext.
Diffstat (limited to 'markdown/extensions/toc.py')
-rw-r--r--markdown/extensions/toc.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index 73b0844..99afba0 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -14,7 +14,7 @@ from __future__ import unicode_literals
from . import Extension
from ..treeprocessors import Treeprocessor
from ..util import etree
-from .headerid import slugify, unique, itertext
+from .headerid import slugify, unique, itertext, stashedHTML2text
import re
@@ -160,7 +160,8 @@ class TocTreeprocessor(Treeprocessor):
# Do not override pre-existing ids
if not "id" in c.attrib:
- elem_id = unique(self.config["slugify"](text, '-'), used_ids)
+ elem_id = stashedHTML2text(text, self.markdown)
+ elem_id = unique(self.config["slugify"](elem_id, '-'), used_ids)
c.attrib["id"] = elem_id
else:
elem_id = c.attrib["id"]