Skip to content

feat: parse html markup to rich_text#144

Merged
mmstick merged 2 commits into
pop-os:masterfrom
hepp3n:markup
Mar 11, 2026
Merged

feat: parse html markup to rich_text#144
mmstick merged 2 commits into
pop-os:masterfrom
hepp3n:markup

Conversation

@hepp3n
Copy link
Copy Markdown
Contributor

@hepp3n hepp3n commented Mar 9, 2026

Hey!

This PR adds additional dependency, tl for HTML parsing. It's also provide new module markup with simple parser of HTML tags allowed by https://specifications.freedesktop.org/notification/1.2/markup.html

From my simple testing, cosmic-notifications display correct rich_text and also works with nested tags.

This will display like those:
obraz
obraz
obraz

However I did not test this properly with third party applications like Vivaldi, or Slack which displays HTML in notifications. I just used some website which sends defined body via Zen Browser.

Links are not clickable, just styled text. Also images are skipped for now.

#edit

btw. Notification applet require new changes, I can implement this if this PR seems OK to you.


  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

@jackpot51 jackpot51 requested review from a team March 9, 2026 17:04
mmstick
mmstick previously approved these changes Mar 9, 2026
@jacobgkau jacobgkau self-assigned this Mar 9, 2026
Copy link
Copy Markdown
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing this with the examples at: https://web-push-book.gauntface.com/demos/notification-examples/

Links & icons before:

Screenshot_2026-03-09_15-15-03 Screenshot_2026-03-09_15-15-35

Links & icons after:

Screenshot_2026-03-09_15-21-19 Screenshot_2026-03-09_15-21-33

Both "Title & Body" tests triggered a crash that caused the panel to disappear and restart before. After, those two work:

Screenshot_2026-03-09_15-21-41

The only problem I'm seeing is that the hyperlink color is too dark in dark mode. It probably needs to be sourced from the COSMIC theme somehow instead of being hard-coded to that blue color. Can you either set the color more intelligently, or leave it the default text color for now (especially as the links aren't clickable, yet, anyway)?

CC @pop-os/ux-- not sure what the correct color to use for hyperlink text would be. Notifications use the window background color for the background. Would accent color suffice? It looks like we currently use accent color for the links in the View -> About menus in some of our COSMIC apps (although the links in those cases use a tinted version of the container background, rather than the window background, for their background color). We also have an "Interface text hint" setting, but I'm not sure what actually uses that right now.

@mmstick
Copy link
Copy Markdown
Member

mmstick commented Mar 10, 2026

Link text color would be accent_text_color.

@maria-komarova
Copy link
Copy Markdown

We also have an "Interface text hint" setting, but I'm not sure what actually uses that right now.

Interface text tint is used as the base color to derive the text color if it was customized by the user. It's black/white by default depending on the mode.

@hepp3n
Copy link
Copy Markdown
Contributor Author

hepp3n commented Mar 10, 2026

Both "Title & Body" tests triggered a crash that caused the panel to disappear and restart before

Hmm, wonder what was the issue here.

Copy link
Copy Markdown
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link color's appearing correctly now:

Image

We'll probably want them to be clickable eventually, but this is definitely a net improvement for handling other markup as well as preventing that crash.

@mmstick mmstick merged commit e351645 into pop-os:master Mar 11, 2026
10 checks passed
@KaKi87
Copy link
Copy Markdown

KaKi87 commented Apr 17, 2026

Hi,

Turns out this fixes notifications as they appear, but the issue remains when opening notification history.

Thanks

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notifications from other browsers like Vivaldi just display information in HTML

5 participants