Skip to content
Open
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
8 changes: 8 additions & 0 deletions markdown_it/rules_inline/state_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ def scanDelims(self, start: int, canSplitWord: bool) -> Scanned:
isLastWhiteSpace = isWhiteSpace(ord(lastChar))
isNextWhiteSpace = isWhiteSpace(ord(nextChar))

# Treat CJK ideographs as punctuation for flanking delimiter checks
# so that emphasis works correctly in mixed CJK/ASCII contexts.
# e.g. 湾岸の**46%**を should render <strong>46%</strong>
if not isNextPunctChar and ord(nextChar) > 0x2E7F:
isNextPunctChar = True
if not isLastPunctChar and ord(lastChar) > 0x2E7F:
isLastPunctChar = True

left_flanking = not (
isNextWhiteSpace
or (isNextPunctChar and not (isLastWhiteSpace or isLastPunctChar))
Expand Down