From fe000d0884d0a83e7444fbf4024aba4a510b898c Mon Sep 17 00:00:00 2001 From: David Date: Sun, 5 Oct 2025 07:54:27 -0700 Subject: [PATCH] fix(telegram): support blocks wrapped in
 for
 syntax highlighting (#1423)

---
 apprise/plugins/telegram.py    | 13 -------------
 tests/test_plugin_telegram.py  |  3 ++-
 tests/var/01_test_example.html |  3 ++-
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/apprise/plugins/telegram.py b/apprise/plugins/telegram.py
index c224f479..9df4a81e 100644
--- a/apprise/plugins/telegram.py
+++ b/apprise/plugins/telegram.py
@@ -307,19 +307,6 @@ class NotifyTelegram(NotifyBase):
             " -",
             {},
         ),
-        # convert pre tags to code (supported by Telegram)
-        (
-            re.compile(r"<\s*pre([^a-z0-9>][^>]*)?>", (re.I | re.M | re.S)),
-            "{}",
-            {"html": "\r\n"},
-        ),
-        (
-            re.compile(
-                r"<\s*/\s*pre([^a-z0-9>][^>]*)?>", (re.I | re.M | re.S)
-            ),
-            "{}",
-            {"html": "\r\n"},
-        ),
         # New Lines
         (
             re.compile(
diff --git a/tests/test_plugin_telegram.py b/tests/test_plugin_telegram.py
index 5dd1eabb..693b6224 100644
--- a/tests/test_plugin_telegram.py
+++ b/tests/test_plugin_telegram.py
@@ -1404,7 +1404,8 @@ def test_plugin_telegram_html_formatting(mock_post):
         == "\r\nBootstrap 101 Template\r\nMy Title\r\n"
         "Heading 1\r\n-Bullet 1\r\n-Bullet 2\r\n-Bullet 3\r\n"
         "-Bullet 1\r\n-Bullet 2\r\n-Bullet 3\r\nHeading 2\r\n"
-        "A div entry\r\nA div entry\r\nA pre entry\r\n"
+        "A div entry\r\nA div entry\r\n"
+        "
print('hello')
\r\n" "Heading 3\r\nHeading 4\r\nHeading 5\r\n" "Heading 6\r\nA set of text\r\n" "Another line after the set of text\r\nMore text\r\nlabel" diff --git a/tests/var/01_test_example.html b/tests/var/01_test_example.html index 07891255..85167984 100644 --- a/tests/var/01_test_example.html +++ b/tests/var/01_test_example.html @@ -44,9 +44,10 @@
A div entry

A div entry -

A pre entry

+
print('hello')
+

Heading 3

Heading 4

Heading 5