Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ def _h_tag_sub(self, match: re.Match[str]) -> str:
text = match.string[match.start(): match.end()]
h_level = int(match.group(1))
# extract id= attr from tag, trying to account for regex "misses"
id_attr = (re.match(r'.*?id=(\S+)?.*', match.group(2) or '') or '')
id_attr = (re.match(r'.*?id="(\S+)?".*', match.group(2) or '') or '')
if id_attr:
# if id attr exists, extract that
id_attr = id_attr.group(1) or ''
Expand Down
1 change: 1 addition & 0 deletions test/tm-cases/toc_with_inline_code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1 id="bla"><code>bla</code></h1>
1 change: 1 addition & 0 deletions test/tm-cases/toc_with_inline_code.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"extras": {"toc": {"depth": 1}, "header-ids": {"mixed": True }}}
1 change: 1 addition & 0 deletions test/tm-cases/toc_with_inline_code.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
toc extra issue675
1 change: 1 addition & 0 deletions test/tm-cases/toc_with_inline_code.text
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `bla`
3 changes: 3 additions & 0 deletions test/tm-cases/toc_with_inline_code.toc_html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ul>
<li><a href="#bla"><code>bla</code></a></li>
</ul>