diff options
-rw-r--r-- | markdown/extensions/toc.py | 6 | ||||
-rw-r--r-- | tests/extensions/toc_nested.html | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py index eba0e69..89468d6 100644 --- a/markdown/extensions/toc.py +++ b/markdown/extensions/toc.py @@ -13,7 +13,7 @@ from __future__ import absolute_import from __future__ import unicode_literals from . import Extension from ..treeprocessors import Treeprocessor -from ..util import etree, parseBoolValue +from ..util import etree, parseBoolValue, AMP_SUBSTITUTE from .headerid import slugify, unique, itertext, stashedHTML2text import re @@ -101,8 +101,8 @@ class TocTreeprocessor(Treeprocessor): def add_permalink(self, c, elem_id): permalink = etree.Element("a") - permalink.text = ("\xb6" if self.use_permalinks is True - else self.use_permalinks) + permalink.text = ("%spara;" % AMP_SUBSTITUTE + if self.use_permalinks is True else self.use_permalinks) permalink.attrib["href"] = "#" + elem_id permalink.attrib["class"] = "headerlink" permalink.attrib["title"] = "Permanent link" diff --git a/tests/extensions/toc_nested.html b/tests/extensions/toc_nested.html index b913640..27af9df 100644 --- a/tests/extensions/toc_nested.html +++ b/tests/extensions/toc_nested.html @@ -1,7 +1,7 @@ -<h1 id="header-a">Header A<a class="headerlink" href="#header-a" title="Permanent link">¶</a></h1> -<h2 id="header-1">Header 1<a class="headerlink" href="#header-1" title="Permanent link">¶</a></h2> -<h3 id="header-i">Header i<a class="headerlink" href="#header-i" title="Permanent link">¶</a></h3> -<h1 id="header-b">Header <em>B</em><a class="headerlink" href="#header-b" title="Permanent link">¶</a></h1> +<h1 id="header-a">Header A<a class="headerlink" href="#header-a" title="Permanent link">¶</a></h1> +<h2 id="header-1">Header 1<a class="headerlink" href="#header-1" title="Permanent link">¶</a></h2> +<h3 id="header-i">Header i<a class="headerlink" href="#header-i" title="Permanent link">¶</a></h3> +<h1 id="header-b">Header <em>B</em><a class="headerlink" href="#header-b" title="Permanent link">¶</a></h1> <div class="toc"> <ul> <li><a href="#header-a">Header A</a><ul> |