dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.52k stars 338 forks source link

Link URL is not detected when reference is single quoted: `href='url'` #1143

Closed akinokonomi closed 1 year ago

akinokonomi commented 1 year ago

Issue description

If href in a link element is quoted with single quotes ('), the URL does not seem to be detected.

# URL is detected
notify-send 'test' "test: <a href=\"test\">test</a>"
# URL is not detected
notify-send 'test' "test: <a href='test'>test</a>"

In HTML, both are valid, but I'm not sure if it's the same here.

Was this done intentionally?

Thank you.

Installation info

Minimal dunstrc ```ini [global] mouse_right_click = context ```
bebehei commented 1 year ago

Yes, this is correct.

The relevant functions are notification_extract_urls and markup_strip_a (possibly also markup_strip_img).

Both markup_strip_* are not written with single quotes in mind. This is a crude HTML parser. I think, calling this a parser would be an insult for any real parser.

bebehei commented 1 year ago

Oh, well. I found the real reason, why this does not cover single quotes.

From the Notification spec:

A full-blown HTML implementation is not required of this spec, and notifications should never take advantage of tags that are not listed above.

Explicitly stating, that a hyperlink will consist of double quotes: <a href="..."> ... </a>

Dunst primarily complies to notification spec, but might enhance it. This might need to be documented.

akinokonomi commented 1 year ago

From the Notification spec:

@bebehei I see. Thanks!