summaryrefslogtreecommitdiff
path: root/markdown/extensions/toc.py
diff options
context:
space:
mode:
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 dc80c7e..8f2b13f 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -15,7 +15,7 @@ License: [BSD](https://opensource.org/licenses/bsd-license.php)
from . import Extension
from ..treeprocessors import Treeprocessor
-from ..util import parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE
+from ..util import code_escape, parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE
from ..postprocessors import UnescapePostprocessor
import re
import unicodedata
@@ -264,7 +264,8 @@ class TocTreeprocessor(Treeprocessor):
'level': int(el.tag[-1]),
'id': el.attrib["id"],
'name': unescape(stashedHTML2text(
- el.attrib.get('data-toc-label', text), self.md, strip_entities=False
+ code_escape(el.attrib.get('data-toc-label', text)),
+ self.md, strip_entities=False
))
})