# Styling anchors in email digest

**URL:** <https://meta.discourse.org/t/styling-anchors-in-email-digest/38344>\
**Category:** Support\
**Tags:** activity-summary\
**Created:** [January 22, 2016, 3:35pm UTC](https://meta.discourse.org/t/styling-anchors-in-email-digest/38344 "2016-01-22T15:35:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [January 22, 2016, 8:33pm UTC](https://meta.discourse.org/t/styling-anchors-in-email-digest/38344/2 "2016-01-22T20:33:33Z")

</div>

There might be better ways, but you can add styles to emails in a plugin by calling `Email::Styles.register_plugin_style` and passing it a block that acts on the email (the email is a Nokogiri document at this point).

This will make the links red and bold. The problem is that it will make **all** the links red and bold. To target just the ones you want will take a bit of fiddling around.

```rb
# name: email-styles
# version: 0.1

after_initialize do
  require_dependency 'email/styles'
  Email::Styles.register_plugin_style do |doc|
    doc.css('a').each do |element|
      element['style'] = "color:red; font-weight:bold;"
    end
  end
end

```

You’ll need to restart Sidekiq to see the change.

---

_[View the full topic](https://meta.discourse.org/t/styling-anchors-in-email-digest/38344)._
