notifs: skip markdown parsing for plain text bodies

This commit is contained in:
2 * r + 2 * t 2026-03-12 22:34:16 +11:00
parent fe5195ca2e
commit 8e7ce4c6a6

View file

@ -17,6 +17,7 @@ StyledRect {
required property Notifs.Notif modelData required property Notifs.Notif modelData
readonly property bool hasImage: modelData.image.length > 0 readonly property bool hasImage: modelData.image.length > 0
readonly property bool hasAppIcon: modelData.appIcon.length > 0 readonly property bool hasAppIcon: modelData.appIcon.length > 0
readonly property int bodyTextFormat: /[<*_`#\[\]]/.test(modelData.body) ? Text.MarkdownText : Text.PlainText
readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2 readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
property bool expanded: Config.notifs.openExpanded property bool expanded: Config.notifs.openExpanded
@ -347,7 +348,7 @@ StyledRect {
anchors.rightMargin: Appearance.spacing.small anchors.rightMargin: Appearance.spacing.small
animate: true animate: true
textFormat: Text.MarkdownText textFormat: root.bodyTextFormat
text: bodyPreviewMetrics.elidedText text: bodyPreviewMetrics.elidedText
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
@ -378,7 +379,7 @@ StyledRect {
anchors.rightMargin: Appearance.spacing.small anchors.rightMargin: Appearance.spacing.small
animate: true animate: true
textFormat: Text.MarkdownText textFormat: root.bodyTextFormat
text: root.modelData.body text: root.modelData.body
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small