diff --git a/src/backend/html_markdown.py b/src/backend/html_markdown.py
index c5822a39..0c9196c2 100644
--- a/src/backend/html_markdown.py
+++ b/src/backend/html_markdown.py
@@ -124,6 +124,7 @@ class HTMLProcessor:
inline_tags = {
"span", "font", "a", "sup", "sub", "b", "i", "s", "u", "code",
+ "mx-reply",
}
block_tags = {
@@ -479,7 +480,7 @@ class HTMLProcessor:
def _reply_to_inline(self, el: HtmlElement) -> HtmlElement:
- """Turn into a plaintext inline form."""
+ """Shorten to only include the replied to event's sender."""
if el.tag != "mx-reply":
return el
@@ -487,11 +488,10 @@ class HTMLProcessor:
try:
user_id = el.find("blockquote").findall("a")[1].text
text = f"↩ {user_id[1:].split(':')[0]}: " # U+21A9 arrow
- except (AttributeError, IndexError):
- text = "↩ " # U+21A9 arrow
+ except (AttributeError, IndexError) as e:
+ return el
el.clear()
- el.tag = "span"
el.text = text
return el
diff --git a/src/gui/MainPane/RoomDelegate.qml b/src/gui/MainPane/RoomDelegate.qml
index 2d327fa6..e7b9aca0 100644
--- a/src/gui/MainPane/RoomDelegate.qml
+++ b/src/gui/MainPane/RoomDelegate.qml
@@ -127,8 +127,10 @@ HTile {
return text.replace(
/< *span +class=['"]?quote['"]? *>(.+?)<\/ *span *>/g,
- `` +
- `$1`,
+ `$1`,
+ ).replace(
+ /< *mx-reply *>(.+?)<\/ *mx-reply *>/g,
+ `$1`,
)
}
}