Skip to content

Commit 87b16e2

Browse files
authored
🔧 simplify logic in scanDelims (#365)
ports markdown-it/markdown-it@5e90063
1 parent e400964 commit 87b16e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

markdown_it/rules_inline/state_inline.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ def scanDelims(self, start: int, canSplitWord: bool) -> Scanned:
155155
or (isLastPunctChar and not (isNextWhiteSpace or isNextPunctChar))
156156
)
157157

158-
if not canSplitWord:
159-
can_open = left_flanking and ((not right_flanking) or isLastPunctChar)
160-
can_close = right_flanking and ((not left_flanking) or isNextPunctChar)
161-
else:
162-
can_open = left_flanking
163-
can_close = right_flanking
158+
can_open = left_flanking and (
159+
canSplitWord or (not right_flanking) or isLastPunctChar
160+
)
161+
can_close = right_flanking and (
162+
canSplitWord or (not left_flanking) or isNextPunctChar
163+
)
164164

165165
return Scanned(can_open, can_close, count)

0 commit comments

Comments
 (0)