Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML not parsed in notifications #118

Closed
utybo opened this issue Jan 7, 2017 · 30 comments · Fixed by #170
Closed

HTML not parsed in notifications #118

utybo opened this issue Jan 7, 2017 · 30 comments · Fixed by #170

Comments

@utybo
Copy link

utybo commented Jan 7, 2017

HTML tags in notifications is not solved, resulting in this :

capture du 2017-01-07 22-15-56

(this example was taken using Rhythmbox for sending the notification, but it does also work with notify-send and other applications as indicated by elcste on the Ubuntu MATE forums.)

Ubuntu MATE 16.10, MATE 1.16.0

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@utybo
Copy link
Author

utybo commented Jan 8, 2017

According to the notification specification on the GNOME website, HTML is supposed to be parsed and interpreted :

Body text may contain markup. The markup is XML-based, and consists of a small subset of HTML along with a few additional tags.
The following tags should be supported by the notification server. Though it is optional, it is recommended. Notification servers that do not support these tags should filter them out.
<b> ... </b> Bold
<i> ... </i> Italic
<u> ... </u> Underline ... ` Hyperlink

(Thanks to chrstphrchvz on the Ubuntu MATE forums for pointing this out here)

@chrstphrchvz
Copy link

chrstphrchvz commented Jan 8, 2017

Thanks for updating here, was about to reply on the forum but was having some issues. There's actually a couple of previous issues and commits on getting markup formatting to work, as well as discussion of how gnome-notification-daemon had implemented it. See issues #106, #111, PRs #107, #110.

I'm trying to test again with mate-settings-daemon 1.16.1, which hasn't made it to Ubuntu MATE yet. Edit: I can no longer reproduce the issue with 1.16.1.

@monsta
Copy link
Contributor

monsta commented Jan 9, 2017

Already fixed in mate-notification-daemon 1.16.1

@monsta monsta closed this as completed Jan 9, 2017
@patrakov
Copy link

The issue still exists in 1.18.1

@patrakov
Copy link

Actually, the following tags work:

'<b>bold</b> <i>italic</i> <s>strike-through</s> &amp; <u>underline</u>'

The problem is only with a and img tags

@flexiondotorg flexiondotorg reopened this Jan 27, 2018
@flexiondotorg
Copy link
Member

Reopening as I can reproduce the issue where a and img tags aren't parsed.

I see this issue when using a browser that supports native notifications. All YouTube notifications exhibit the issue where a links aren't parsed. Some social network notifications exhibit a and img issues.

@monsta
Copy link
Contributor

monsta commented Feb 4, 2018

Did it ever work before for these tags?

@2E0PGS
Copy link

2E0PGS commented Feb 15, 2018

Same issue here with DiscordApp, Whattapp web and Telegram web.

OS: Ubuntu MATE 17.10 x64
Program Version: mate-notification-daemon/artful,now 1.18.0-2ubuntu1 amd64 [installed]

@rilian-la-te
Copy link

rilian-la-te commented Feb 15, 2018

If you want, I can translate to C my QRichTextParser (it is GLib-only vala-written class). It used by me in my SNI realization to translate Qt markup (it more richer) to GMarkup.

@japa-fi
Copy link

japa-fi commented Feb 16, 2018

Not ubuntu user, but mate-fedora. I have two laptops and once I run into this issue with the first one, I too thought it was caused by some mate package. So for the second laptop, I run the update but excluding any mate packages. Still the issue appeared also to the second laptop.
TLDR: It's not a mate package causing the issue.

Unfortunately, I was not able to rollback the update transaction to be able to test which package is the culprit, but it certainly was caused by update to one of the following packages:
Upgraded akmods-0.5.6-10.fc27.noarch @fedora
Upgraded atril-1.19.5-1.fc27.x86_64 @updates
Upgraded atril-caja-1.19.5-1.fc27.x86_64 @updates
Upgraded atril-libs-1.19.5-1.fc27.x86_64 @updates
Upgraded atril-thumbnailer-1.19.5-1.fc27.x86_64 @updates
Upgraded augeas-libs-1.9.0-1.fc27.x86_64 @updates
Upgraded clang-libs-5.0.0-1.fc27.x86_64 @updates
Upgraded compiler-rt-5.0.0-1.fc27.x86_64 @updates
Upgraded coreutils-8.27-17.fc27.x86_64 @updates
Upgraded coreutils-common-8.27-17.fc27.x86_64 @updates
Upgraded cpp-7.2.1-2.fc27.x86_64 @fedora
Upgraded fortune-mod-1.99.1-25.fc27.x86_64 @anaconda
Upgraded gcc-7.2.1-2.fc27.x86_64 @fedora
Upgraded gcc-gdb-plugin-7.2.1-2.fc27.x86_64 @fedora
Upgraded gdb-8.0.1-33.fc27.x86_64 @updates
Upgraded gdb-headless-8.0.1-33.fc27.x86_64 @updates
Upgraded gdouros-symbola-fonts-10.23-1.fc27.noarch @updates
Upgraded glib2-2.54.2-1.fc27.i686 @updates
Upgraded glib2-2.54.2-1.fc27.x86_64 @updates
Upgraded glibc-2.26-21.fc27.i686 @updates
Upgraded glibc-2.26-21.fc27.x86_64 @updates
Upgraded glibc-all-langpacks-2.26-21.fc27.x86_64 @updates
Upgraded glibc-common-2.26-21.fc27.x86_64 @updates
Upgraded glibc-devel-2.26-21.fc27.x86_64 @updates
Upgraded glibc-headers-2.26-21.fc27.x86_64 @updates
Upgraded glibc-langpack-en-2.26-21.fc27.x86_64 @updates
Upgraded gnutls-3.5.16-4.fc27.i686 @updates
Upgraded gnutls-3.5.16-4.fc27.x86_64 @updates
Upgraded ibus-1.5.17-1.fc27.x86_64 @updates
Upgraded ibus-gtk2-1.5.17-1.fc27.x86_64 @updates
Upgraded ibus-gtk3-1.5.17-1.fc27.x86_64 @updates
Upgraded ibus-libs-1.5.17-1.fc27.x86_64 @updates
Upgraded ibus-setup-1.5.17-1.fc27.noarch @updates
Upgraded ibus-wayland-1.5.17-1.fc27.x86_64 @updates
Upgraded imsettings-1.7.3-1.fc27.x86_64 @updates
Upgraded imsettings-gsettings-1.7.3-1.fc27.x86_64 @updates
Upgraded imsettings-libs-1.7.3-1.fc27.x86_64 @updates
Upgraded libassuan-2.4.3-6.fc27.x86_64 @anaconda
Upgraded libcrypt-nss-2.26-21.fc27.i686 @updates
Upgraded libcrypt-nss-2.26-21.fc27.x86_64 @updates
Upgraded libcurl-7.55.1-8.fc27.x86_64 @updates
Upgraded libfastjson-0.99.7-1.fc27.x86_64 @updates
Upgraded libgcc-7.2.1-2.fc27.i686 @fedora
Upgraded libgcc-7.2.1-2.fc27.x86_64 @anaconda
Upgraded libgcrypt-1.8.1-3.fc27.i686 @updates
Upgraded libgcrypt-1.8.1-3.fc27.x86_64 @updates
Upgraded libgfortran-7.2.1-2.fc27.x86_64 @fedora
Upgraded libgomp-7.2.1-2.fc27.x86_64 @anaconda
Upgraded libimagequant-2.11.4-1.fc27.x86_64 @updates
Upgraded libimobiledevice-1.2.0-11.fc27.x86_64 @anaconda
Upgraded libinput-1.9.3-2.fc27.x86_64 @updates
Upgraded libldb-1.3.0-3.fc27.x86_64 @updates
Upgraded libmateweather-1.19.1-3.fc27.x86_64 @anaconda
Upgraded libmateweather-data-1.19.1-3.fc27.noarch @anaconda
Upgraded libnfsidmap-1:2.2.1-3.rc2.fc27.x86_64 @updates
Upgraded libpinyin-2.1.0-1.fc27.x86_64 @anaconda
Upgraded libpinyin-data-2.1.0-1.fc27.x86_64 @anaconda
Upgraded libquadmath-7.2.1-2.fc27.x86_64 @fedora
Upgraded libreswan-3.22-1.fc27.x86_64 @updates
Upgraded libsmbclient-2:4.7.4-1.fc27.x86_64 @updates
Upgraded libsolv-0.6.30-2.fc27.x86_64 @updates
Upgraded libssh-0.7.5-4.fc27.x86_64 @updates
Upgraded libstdc++-7.2.1-2.fc27.i686 @fedora
Upgraded libstdc++-7.2.1-2.fc27.x86_64 @anaconda
Upgraded libstdc++-devel-7.2.1-2.fc27.x86_64 @fedora
Upgraded libtalloc-2.1.10-5.fc27.x86_64 @updates
Upgraded libtasn1-4.12-3.fc27.i686 @fedora
Upgraded libtasn1-4.12-3.fc27.x86_64 @anaconda
Upgraded libtevent-0.9.34-3.fc27.x86_64 @updates
Upgraded libva-1.8.3-3.fc27.x86_64 @fedora
Upgraded libvpx-1.6.1-4.fc27.x86_64 @anaconda
Upgraded libwbclient-2:4.7.4-1.fc27.x86_64 @updates
Upgraded libxml2-2.9.5-2.fc27.i686 @fedora
Upgraded libxml2-2.9.5-2.fc27.x86_64 @anaconda
Upgraded libzhuyin-2.1.0-1.fc27.x86_64 @anaconda
Upgraded lightdm-1.25.0-1.fc27.x86_64 @updates
Upgraded lightdm-gobject-1.25.0-1.fc27.x86_64 @updates
Upgraded lirc-libs-0.10.0-4.fc27.x86_64 @updates
Upgraded llvm-libs-5.0.0-5.fc27.x86_64 @updates
Upgraded man-db-2.7.6.1-10.fc27.x86_64 @updates
Upgraded pcre-8.41-4.fc27.i686 @updates
Upgraded pcre-8.41-4.fc27.x86_64 @updates
Upgraded pcre2-10.30-5.fc27.i686 @updates
Upgraded pcre2-10.30-5.fc27.x86_64 @updates
Upgraded pcre2-utf16-10.30-5.fc27.x86_64 @updates
Upgraded perl-DateTime-TimeZone-2.15-1.fc27.noarch @updates
Upgraded perl-File-Copy-Recursive-0.38-26.fc27.noarch @fedora
Upgraded perl-Module-CoreList-1:5.20171220-1.fc27.noarch @updates
Upgraded perl-Module-CoreList-tools-1:5.20171220-1.fc27.noarch @updates
Upgraded perl-Socket-4:2.025-1.fc27.x86_64 @updates
Upgraded perl-threads-1:2.16-4.fc27.x86_64 @anaconda
Upgraded perl-threads-shared-1.57-4.fc27.x86_64 @anaconda
Upgraded php-bcmath-7.1.13-1.fc27.x86_64 @updates
Upgraded php-cli-7.1.13-1.fc27.x86_64 @updates
Upgraded php-common-7.1.13-1.fc27.x86_64 @updates
Upgraded php-json-7.1.13-1.fc27.x86_64 @updates
Upgraded php-mcrypt-7.1.13-1.fc27.x86_64 @updates
Upgraded php-xml-7.1.13-1.fc27.x86_64 @updates
Upgraded poppler-0.57.0-7.fc27.x86_64 @updates
Upgraded poppler-glib-0.57.0-7.fc27.x86_64 @updates
Upgraded poppler-utils-0.57.0-7.fc27.x86_64 @updates
Upgraded python-qt5-rpm-macros-5.9.1-1.fc27.noarch @updates
Upgraded python-rpm-macros-3-23.fc27.noarch @updates
Upgraded python-srpm-macros-3-23.fc27.noarch @updates
Upgraded python2-rpm-4.14.0-2.fc27.x86_64 @anaconda
Upgraded python2-rpm-macros-3-23.fc27.noarch @updates
Upgraded python2-talloc-2.1.10-5.fc27.x86_64 @updates
Upgraded python3-3.6.3-2.fc27.x86_64 @updates
Upgraded python3-bind-32:9.11.1-10.P3.fc27.noarch @updates
Upgraded python3-libs-3.6.3-2.fc27.x86_64 @updates
Upgraded python3-libxml2-2.9.5-2.fc27.x86_64 @anaconda
Upgraded python3-qt5-5.9.1-1.fc27.x86_64 @updates
Upgraded python3-qt5-base-5.9.1-1.fc27.x86_64 @updates
Upgraded python3-rpm-4.14.0-2.fc27.x86_64 @anaconda
Upgraded python3-speechd-0.8.8-1.fc27.x86_64 @updates
Upgraded qt5-qtbase-5.9.2-6.fc27.x86_64 @updates
Upgraded qt5-qtbase-common-5.9.2-6.fc27.noarch @updates
Upgraded qt5-qtbase-gui-5.9.2-6.fc27.x86_64 @updates
Upgraded qt5-qtconnectivity-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtdeclarative-5.9.2-2.fc27.x86_64 @updates
Upgraded qt5-qtlocation-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtmultimedia-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtscript-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtsensors-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtserialport-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtsvg-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qttools-common-5.9.2-1.fc27.noarch @updates
Upgraded qt5-qttools-libs-designer-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qttools-libs-help-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtwayland-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtwebchannel-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtwebkit-5.212.0-0.12.alpha2.fc27.x86_64 @updates
Upgraded qt5-qtwebsockets-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtx11extras-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-qtxmlpatterns-5.9.2-1.fc27.x86_64 @updates
Upgraded qt5-srpm-macros-5.9.1-2.fc27.noarch @fedora
Upgraded satyr-0.24-1.fc27.x86_64 @updates
Upgraded sed-4.4-3.fc27.x86_64 @anaconda
Upgraded speech-dispatcher-0.8.8-1.fc27.x86_64 @updates
Upgraded speech-dispatcher-espeak-0.8.8-1.fc27.x86_64 @updates
Upgraded timedatex-0.4-5.fc27.x86_64 @anaconda
Upgraded tzdata-2017c-1.fc27.noarch @updates
Upgraded tzdata-java-2017c-1.fc27.noarch @updates
Upgraded unbound-libs-1.6.7-1.fc27.x86_64 @updates
Upgraded webkitgtk4-2.18.5-1.fc27.x86_64 @updates
Upgraded webkitgtk4-jsc-2.18.5-1.fc27.x86_64 @updates
Upgraded webkitgtk4-plugin-process-gtk2-2.18.5-1.fc27.x86_64 @updates
Upgraded wpa_supplicant-1:2.6-12.fc27.x86_64 @updates
Upgraded xapian-core-libs-1.4.4-3.fc27.x86_64 @fedora
(I excluded some of the obvious ones which could not be the reason, like libreoffice, firefox etc)

@anaselli
Copy link

anaselli commented Jun 2, 2018

it isn't clear to me if Hyperlink <a href...> tag is supported or not, it seems that i was able to use it in Ubuntu 16.04 LTS and no more in Ubuntu 18.04 LTS. Other tags quoted above seem to work...

@alete89
Copy link

alete89 commented Jun 13, 2018

I confirm this in MATE Desktop Environment 1.18.0 on debian stretch (mate backported)

@MMachado-uy
Copy link

MMachado-uy commented Aug 1, 2018

This is still happening with Mate 1.20.1
Google Calendar and Slack web notifications not rendering as expected.

@mxcoder
Copy link

mxcoder commented Nov 16, 2018

Hi everyone, indeed this is still happening and its tickling my compulsions quite hard, so I decided to take a peek at the code, but I have a few questions:

  • Would this need to be solved in gnome-notification-daemon or its fine trying to patch it here?
  • The HTML parsing seems to happen in set_notification_text in the themes code, relying in pango_parse_markup and gtk_label_set_markup, there's nothing (as far as I can tell, but this would be my first time debugging gnome/gtk code) obviously wrong. Any recommendations or pointers how to proceed? Would I need to debug also pango and gtk3 code separatedly? I already checked bugzilla.gnome.org for bugs related to these functions, there's nothing.

Any pointers would be appreciated.

@JennToo
Copy link

JennToo commented Jan 4, 2019

Based on the list at the bottom of the pango markup docs it looks like it doesn't support the <a> tag, which might be why it fails to parse with pango_parse_markup.

@mxcoder
Copy link

mxcoder commented Jan 7, 2019

Update: now I see the spotify notifications correctly, it fixed itself with some of the past weeks updates.

ii  mate-notification-daemon              1.20.0-2                                     amd64
ii  mate-notification-daemon-common       1.20.0-2                                     all

Not sure what other packages to query/show, but to me this seems to have been fixed somehow.

@vkareh
Copy link
Member

vkareh commented Jan 23, 2019

Linking this here for reference: mate-desktop/mate-power-manager#272

@kion
Copy link

kion commented Aug 24, 2019

I had mate-notification-daemon-1.20.0-1 originally and issue was still there. Just installed mate-notification-daemon-1.22.0-1 to see if it helps, but the issue is still happening.

@kion
Copy link

kion commented Mar 10, 2020

Just compiled from source and installed version 1.24.0 and the issue is still there. More specifically, the <a> tag is not being parsed.

@rbuj
Copy link
Contributor

rbuj commented Mar 10, 2020

<a> is not a valid pango tag. https://developer.gnome.org/pango/stable/pango-Markup.html

@kion
Copy link

kion commented Mar 10, 2020

According to Desktop Notifications Specification though:

The following tags should be supported by the notification server. Though it is optional, it is recommended. Notification servers that do not support these tags should filter them out.

<b> ...        </b>
<i> ...        </i>
<u> ...        </u>
<a href="..."> ...        </a>
<img src="..." alt="..."/>

So, if <a> is not supported - it would be nice if it was filtered out at least. Otherwise it makes it really hard to read the notification.

@cwendling
Copy link
Member

<a> is not a valid pango tag. https://developer.gnome.org/pango/stable/pango-Markup.html

FWIW, GtkLabel does support <a>. For <img> it'd be a lot trickier though; but should be fairly easy to strip out.

@rbuj
Copy link
Contributor

rbuj commented Mar 11, 2020

Ok, now I see where the problem is...

Test:

$ notify-send "title" "<a href=\"https://mate-desktop.org/es/\">MATE</a> <i>italic</i> <b>bold</b>"

@cwendling are you sure the img tag doesn't work?

VirtualBox_11 Fedora Rawhide_11_03_2020_10_04_27

@cwendling
Copy link
Member

@rbuj I'm not 100% sure notification-daemon doesn't handle it itself, but I would be slightly surprised. What you see in your screenshot looks like the icon that can be registered with a notification, which is not an inline <img> tag but a general property.

@rbuj
Copy link
Contributor

rbuj commented Mar 11, 2020

@cwendling It's because of the engines failed to parse message body, then they show body as a raw text.

VirtualBox_11 Fedora Rawhide_11_03_2020_10_58_26

@cwendling
Copy link
Member

Indeed, so there should probably be a separate validator that supports the <a> tag as GtkLabel does. It could also strip unknown tags, etc… that "merely" requires Somebody™ to do it.

@rilian-la-te
Copy link

Someday I wrote a translator from Qt Rich Text to Pango Markup.
You can use it, if you want.

https://gitlab.com/vala-panel-project/xfce4-sntray-plugin/-/blob/master/src/rtparser.c

@kion
Copy link

kion commented Mar 11, 2020

So, I just compiled latest code with the PR #170 merged in and just wanted to share a couple of notes after testing it:

notify-send "title" "<a href=\"https://mate-desktop.org/es/\">MATE</a> <i>italic</i> <b>bold</b>"

this one works just fine and produces the following notification:

notification-good

notify-send "title" "<a href=\"https://mate-desktop.org/es/\">MATE</a> <i>italic</i> <b>bold</b> <qwert>asdf</qwert>"

this one doesn't work though and produces the following:

notification-bad

Finally, I noticed that when the link is rendered, you can click on it and it actually opens the href URL in the default browser, which is great, BUT... it always opens it twice for me (first time when actual link is clicked on and then the second time, after a short delay, like 5 seconds or so), which is a bit annoying.

@rbuj
Copy link
Contributor

rbuj commented Mar 11, 2020

@kion I tested all notification themes again to be sure, and I saw that all the links only opened once. You can use other types of links for your tests:

$ notify-send "title" "<a href=\"https://mate-desktop.org/es/\">WWW</a> <i>italic</i> <b>bold</b>"
$ notify-send "title" "<a href=\"file:///\">HOME</a> <i>italic</i> <b>bold</b>"
$ notify-send "title" "<a href=\"trash:///\">TRASH</a> <i>italic</i> <b>bold</b>"
$ notify-send "title" "<a href=\"help:mate-user-guide\">HELP</a> <i>italic</i> <b>bold</b>"

@kion
Copy link

kion commented Mar 11, 2020

@rbuj tested all of these and they all (even the local file system ones) open twice for me, except the help:mate-user-guide one, which only opens once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.