From 480fcb9fa82a0f6e59fe365f8cb6d425276d06fb Mon Sep 17 00:00:00 2001 From: Ice Lam Date: Mon, 7 Apr 2025 10:47:00 +0800 Subject: [PATCH] fix(markdown): strip style tags when converting html to markdown --- app/utils/markdown.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/utils/markdown.py b/app/utils/markdown.py index 8ffa06a..92d3bcf 100644 --- a/app/utils/markdown.py +++ b/app/utils/markdown.py @@ -55,12 +55,15 @@ def convert_a(self, el, text, convert_as_inline): convert_as_inline=convert_as_inline ) + def convert_style(self, el, text, convert_as_inline): + return '' + def generate(html, **options): """Convert function with options predefined""" result = TelegramMarkdownConverter( **options, - convert=['br', 'p', 'img', 'code', 'pre', 'ul', 'ol', 'li', 'a', 'sup', 'sub'], + convert=['br', 'p', 'img', 'code', 'pre', 'ul', 'ol', 'li', 'a', 'sup', 'sub', 'style'], bullets='•••' ).convert(html).strip()