Skip to content

Commit 8c74601

Browse files
Merge pull request #651 from Crozzers/code-friendly-issue646
Fix code friendly extra incorrectly converting consecutive em/strongs (#646)
2 parents 4c0534e + fe5b63e commit 8c74601

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
@@ -3007,7 +3007,8 @@ def __init__(self, md, options):
30073007

30083008
def sub(self, match: re.Match) -> str:
30093009
syntax = match.group(1)
3010-
text: str = match.string[match.start(): match.end()]
3010+
# use match.regs because strong/em regex may include preceding text in the match as well
3011+
text: str = match.string[match.regs[1][0]: match.end()]
30113012
if '_' in syntax:
30123013
# if using _this_ syntax, hash it to avoid processing, but don't hash the contents incase of nested syntax
30133014
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)