From 09b733001cad0117ca7260b386ff6b91b4947c13 Mon Sep 17 00:00:00 2001 From: Ice Lam Date: Sun, 12 Dec 2021 12:57:19 +0800 Subject: [PATCH] fix(markdown): handle inline image conversion --- app/utils/markdown.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/utils/markdown.py b/app/utils/markdown.py index 4fe2c27..6cde88b 100644 --- a/app/utils/markdown.py +++ b/app/utils/markdown.py @@ -8,7 +8,11 @@ class TelegramMarkdownConverter(MarkdownConverter): def convert_img(self, el, text, convert_as_inline): src = el.attrs.get('src', None) or '' - return f'Image: [{src}]({src})' + + if convert_as_inline: + return f'(Image: [{src}]({src}))' + + return f'\nImage: [{src}]({src})\n' def convert_br(self, el, text, convert_as_inline): if convert_as_inline: