Skip to content

Commit fe5b63e

Browse files
committed
Fix #646
1 parent 9a88ce1 commit fe5b63e

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

lib/markdown2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3003,7 +3003,8 @@ def __init__(self, md, options):
30033003

30043004
def sub(self, match: re.Match) -> str:
30053005
syntax = match.group(1)
3006-
text: str = match.string[match.start(): match.end()]
3006+
# use match.regs because strong/em regex may include preceding text in the match as well
3007+
text: str = match.string[match.regs[1][0]: match.end()]
30073008
if '_' in syntax:
30083009
# if using _this_ syntax, hash it to avoid processing, but don't hash the contents incase of nested syntax
30093010
text = text.replace(syntax, _hash_text(self.name + syntax))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>A_<strong>B</strong></p>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"extras":["code-friendly"]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A_**B**

0 commit comments

Comments
 (0)