Merge PR #204: fix Telegram italic regex newline bug
Authored by 0xbyt4. The italic regex [^*]+ matched across newlines, corrupting bullet lists using * markers (e.g. '* Item one\n* Item two' became italic garbage). Fixed by adding \n to the negated character class: [^*\n]+.
This commit is contained in:
commit
90e6fa2612
2 changed files with 365 additions and 1 deletions
|
|
@ -406,8 +406,10 @@ class TelegramAdapter(BasePlatformAdapter):
|
|||
)
|
||||
|
||||
# 6) Convert italic: *text* (single asterisk) → _text_ (MarkdownV2 italic)
|
||||
# [^*\n]+ prevents matching across newlines (which would corrupt
|
||||
# bullet lists using * markers and multi-line content).
|
||||
text = re.sub(
|
||||
r'\*([^*]+)\*',
|
||||
r'\*([^*\n]+)\*',
|
||||
lambda m: _ph(f'_{_escape_mdv2(m.group(1))}_'),
|
||||
text,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue