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