Open goose121 opened 4 years ago
Well markup = strip
should have worked, but our parser is simplistic and only understands '
for apostrophes.
Why not set markup = full
? This will hand over the parsing to pango and should support/properly display all characters along with formatting?
One possible solution to similar issues where modifying the content or other attributes of a notification in arbitrary ways is desirable could be to allow scripts to modify the attributes of a notification, rather than simply replacing the notification.
All in all, I'm also open to this idea, it would allow for some interesting customizations, perhaps even alternative rule implementations.
Why not set
markup = full
? This will hand over the parsing to pango and should support/properly display all characters along with formatting?
Discord doesn't properly escape angle brackets in notifications, which confuses pango (I've opened a bug with them as well, but it would be nice to be able to work around things like this with scripts).
For this issue I see 2 ways forward, either the solution mentioned above (implementing filter scripts), or expanding our makeshift markup parser to accept all escaped characters, I'm fine with both, however I don't know when/if I'll pick this one up but I am open to PRs.
For the first one, the person implementing it can use notification_run_script
as a reference, however I think I'd prefer json over NULL-separated values as it gives more flexibility (and preferably using a single-header/simple C library to avoid adding extra dependencies just for that).
~For the second solution, the quote/unqote
functions would need to be expanded in the markup parser.~ Edit: On second thought on this, this would also involve modifying the parser so it doesn't strip out arbitrary tags, the spec says not to use them anyway so this change should be fine (but not simple), otherwise any unescaped <...>
will end up getting stripped out. So I retract that, let's focus on the filter scripts instead, much more flexible.
It seems that Discord escapes some markup characters, including apostrophes, but does not properly escape angle brackets. This means that without setting
markup = strip
, any message with angle brackets will render incorrectly, but when settingmarkup = strip
, any character Discord does escape shows up as an HTML entity in the notification (e.g. a notification will say "aren't" instead of "aren't").One solution I have tried was to use the
script
attribute together with a script which replaced the angle brackets with their HTML entity representation then sent a new notification, using its command line arguments for the information. However, this did not work very well because it seems that the custom icons used by Discord are not passed in to the script as the icon argument is empty. Additionally, Discord replaces certain old notifications in a channel with new ones, but since this solution replaces the notification entirely, including its ID, that does not work.One possible solution to similar issues where modifying the content or other attributes of a notification in arbitrary ways is desirable could be to allow scripts to modify the attributes of a notification, rather than simply replacing the notification. This could potentially be done by having the script print the desired attributes to standard output (possibly null-separated).
I am running version 1.4.1 of Dunst on Artix Linux (which is basically Arch but with OpenRC).