Compare commits

..

1 Commits

Author SHA1 Message Date
Marc Koch 37982b43c7 implement markdown rendering 2024-07-05 15:30:48 +02:00
1 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import asyncio
from html import escape
import json
from typing import Any, Dict, Tuple, List, Awaitable, Callable
import markdown
from aiohttp import ClientTimeout
from maubot import MessageEvent, Plugin
@ -639,9 +640,11 @@ class NtfyBot(Plugin):
if click and not title:
html_content += "%s<a href=\"%s\">%s</a>" % (
emoji, escape(click),
escape(body).replace("\n", "<br />"))
markdown.markdown(escape(body))
.replace("\n", "<br />"))
else:
html_content += emoji + escape(body).replace("\n", "<br />")
html_content += (emoji + markdown.markdown(escape(body))
.replace("\n", "<br />"))
# add non-emoji tags
if tags: