Skip to content

Style more Markdown in email notifications

Steve Mokris requested to merge smokris/gitlab:notify-formatting into master

What does this MR do and why?

Currently, email notifications have minimal styling. The lack of styling makes it difficult to follow conversations where there is quoted text (Markdown >) or inline code (Markdown backtick), and makes it difficult to understand tables (which currently have no borders and minimal padding).

This MR applies part of the main GitLab UI framework to email notifications, making Markdown in email notifications look much more like it does in the GitLab web UI.

Screenshots or screen recordings

Comment in GitLab web UI ️ Email notification, before Email notification, After
Screen_Shot_2022-01-19_at_11.51.24 Screenshot_2022-01-19_at_14-47-36_LetterOpenerWeb Screenshot_2022-01-19_at_15-18-21_LetterOpenerWeb

How to set up and validate locally

  1. Open branch in a development environment
  2. Create a new issue, or a new comment on an issue, with this Markdown text: test.md
  3. View the email notification in /rails/letter_opener/ and /rails/mailers/notify/…

Caveats/concerns

  • I haven't tested all types of email notifications, but for those that I have tested (new issue, comment on issue, reassign, change milestone, comment on merge request) I haven't seen any problems. It doesn't affect some emails (e.g. "Reset password instructions" and "sign-in from new location"), which is good since those already have their own styling.Update: I think I've pretty thoroughly tested many types of email notifications, but I still may have missed some
  • I've tested the emails in macOS Mail.app, iPhone Mail, Gmail, Yahoo webmail, and Microsoft Outlook/365 webmail. There's a minor problem with label rendering in Gmail and Yahoo webmail, which I'm unsure how to resolve.
  • This increases the number of CSS rules evaluated and bundled in emails. For test.md, the email size increases from about 5 KB to about 20 KB (before.html, after.html). Update: After some changes suggested by @pslaughter, styled emails are about 2x the size of unstyled emails (instead of the previous 4x).

MR acceptance checklist

Closes #335713 (closed)
Related: #215652
/cc @pslaughter @hollyreynolds

Edited by Steve Mokris

Merge request reports