Skip to content

Commit b4c931c

Browse files
committed
Merge branch 'develop'
2 parents 12559c0 + a609045 commit b4c931c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/utils/markdown.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Convert HTML to Telegram markdown syntax"""
1+
"""Convert HTML to Telegram MarkdownV2 syntax"""
22

33
import re
44
from markdownify import MarkdownConverter, BACKSLASH
@@ -36,7 +36,8 @@ def convert_pre(self, el, text, convert_as_inline):
3636
if el.previous_sibling and el.previous_sibling.name in ['p']:
3737
after_paragraph = True
3838

39-
return ('\n' if not after_paragraph else '') + f"```{self.options['code_language']}\n{text.strip()}\n```\n\n"
39+
unescaped_text = text.strip().replace(r'\_', '_')
40+
return ('\n' if not after_paragraph else '') + f"```{self.options['code_language']}\n{unescaped_text}\n```\n\n"
4041

4142
def convert_sub(self, el, text, convert_as_inline):
4243
return f'_{text}'

0 commit comments

Comments
 (0)