From 96bcd81191d589f69eb538417b93163486cc3c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Sat, 17 May 2025 03:53:15 +0200 Subject: [PATCH] Use ATX headers instead of SETEXT --- discord_rss_bot/custom_message.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/discord_rss_bot/custom_message.py b/discord_rss_bot/custom_message.py index d3ca74d..99a7e11 100644 --- a/discord_rss_bot/custom_message.py +++ b/discord_rss_bot/custom_message.py @@ -68,8 +68,18 @@ def replace_tags_in_text_message(entry: Entry) -> str: first_image: str = get_first_image(summary, content) - summary = markdownify(html=summary, strip=["img", "table", "td", "tr", "tbody", "thead"], escape_misc=False) - content = markdownify(html=content, strip=["img", "table", "td", "tr", "tbody", "thead"], escape_misc=False) + summary = markdownify( + html=summary, + strip=["img", "table", "td", "tr", "tbody", "thead"], + escape_misc=False, + heading_style="ATX", + ) + content = markdownify( + html=content, + strip=["img", "table", "td", "tr", "tbody", "thead"], + escape_misc=False, + heading_style="ATX", + ) if "[https://" in content or "[https://www." in content: content = content.replace("[https://", "[") @@ -189,8 +199,18 @@ def replace_tags_in_embed(feed: Feed, entry: Entry) -> CustomEmbed: first_image: str = get_first_image(summary, content) - summary = markdownify(html=summary, strip=["img", "table", "td", "tr", "tbody", "thead"], escape_misc=False) - content = markdownify(html=content, strip=["img", "table", "td", "tr", "tbody", "thead"], escape_misc=False) + summary = markdownify( + html=summary, + strip=["img", "table", "td", "tr", "tbody", "thead"], + escape_misc=False, + heading_style="ATX", + ) + content = markdownify( + html=content, + strip=["img", "table", "td", "tr", "tbody", "thead"], + escape_misc=False, + heading_style="ATX", + ) if "[https://" in content or "[https://www." in content: content = content.replace("[https://", "[")