From 029ae18a07c8c8692e7ae8836fcdb6ccfbe94e84 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Sat, 13 Feb 2021 13:48:37 -0500 Subject: Format markdown as HTML in notifications --- src/notifications/ManagerLinux.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/notifications/ManagerLinux.cpp') diff --git a/src/notifications/ManagerLinux.cpp b/src/notifications/ManagerLinux.cpp index a222bd36..70f131c2 100644 --- a/src/notifications/ManagerLinux.cpp +++ b/src/notifications/ManagerLinux.cpp @@ -13,6 +13,7 @@ #include "MatrixClient.h" #include "Utils.h" #include +#include NotificationsManager::NotificationsManager(QObject *parent) : QObject(parent) @@ -58,6 +59,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if const auto sender = cache::displayName( room_id, QString::fromStdString(mtx::accessors::sender(notification.event))); const auto text = utils::event_body(notification.event); + const auto formattedText = cmark_markdown_to_html(text.toStdString().c_str(), text.length(), CMARK_OPT_UNSAFE); QVariantMap hints; hints["image-data"] = icon; @@ -71,9 +73,9 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if // body if (mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote) - argumentList << "* " + sender + " " + text; + argumentList << "* " + sender + " " + formattedText; else - argumentList << sender + ": " + text; + argumentList << sender + ": " + formattedText; // The list of actions has always the action name and then a localized version of that // action. Currently we just use an empty string for that. -- cgit 1.5.1