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
7
7
8
8
* Add a special case for initial 's to smarty extension (#1305 ).
9
9
* Unescape any backslash escaped inline raw HTML (#1358 ).
10
+ * Unescape backslash escaped TOC token names (#1360 ).
10
11
11
12
March 23, 2023: version 3.4.3 (a bug-fix release).
12
13
Original file line number Diff line number Diff line change @@ -289,10 +289,10 @@ def run(self, doc):
289
289
toc_tokens .append ({
290
290
'level' : int (el .tag [- 1 ]),
291
291
'id' : el .attrib ["id" ],
292
- 'name' : stashedHTML2text (
292
+ 'name' : unescape ( stashedHTML2text (
293
293
code_escape (el .attrib .get ('data-toc-label' , text )),
294
294
self .md , strip_entities = False
295
- )
295
+ ))
296
296
})
297
297
298
298
# 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):
442
442
self .assertMarkdownRenders (
443
443
r'# escaped\_character' ,
444
444
'<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
+ },
445
462
extensions = ['toc' ]
446
463
)
447
464
You can’t perform that action at this time.
0 commit comments