File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
tests/test_syntax/extensions Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Python-Markdown Change Log
77
88* Add a special case for initial 's to smarty extension (#1305 ).
99* Unescape any backslash escaped inline raw HTML (#1358 ).
10+ * Unescape backslash escaped TOC token names (#1360 ).
1011
1112March 23, 2023: version 3.4.3 (a bug-fix release).
1213
Original file line number Diff line number Diff line change @@ -289,10 +289,10 @@ def run(self, doc):
289289 toc_tokens .append ({
290290 'level' : int (el .tag [- 1 ]),
291291 'id' : el .attrib ["id" ],
292- 'name' : stashedHTML2text (
292+ 'name' : unescape ( stashedHTML2text (
293293 code_escape (el .attrib .get ('data-toc-label' , text )),
294294 self .md , strip_entities = False
295- )
295+ ))
296296 })
297297
298298 # Remove the data-toc-label attribute as it is no longer needed
Original file line number Diff line number Diff line change @@ -442,6 +442,23 @@ def test_escaped_char_in_id(self):
442442 self .assertMarkdownRenders (
443443 r'# escaped\_character' ,
444444 '<h1 id="escaped_character">escaped_character</h1>' ,
445+ expected_attrs = {
446+ 'toc' : (
447+ '<div class="toc">\n '
448+ '<ul>\n ' # noqa
449+ '<li><a href="#escaped_character">escaped_character</a></li>\n ' # noqa
450+ '</ul>\n ' # noqa
451+ '</div>\n ' # noqa
452+ ),
453+ 'toc_tokens' : [
454+ {
455+ 'level' : 1 ,
456+ 'id' : 'escaped_character' ,
457+ 'name' : 'escaped_character' ,
458+ 'children' : []
459+ }
460+ ]
461+ },
445462 extensions = ['toc' ]
446463 )
447464
You can’t perform that action at this time.
0 commit comments