HTML tags with attributes


I have an HTML template I use for mailing lists where <p> and <a> tags have certain attributes on them. I want to pass my Draft body into the template, but the HTML Drafts produces is just bare <p> and <a> tags. I want to add some attributes to those tags. Is there a way to produce HTML from my Markdown with attributes on different tags as I need?


Using an Action in the Action Directory for reference, I produced this script:

var conv = draft.processTemplate("[[template|SGPemail.txt]]");

conv = conv.replace(/<p>/gi, "<p style=\"font-family: sans-serif\; font-size: 14px\; font-weight: normal\; margin: 0\; Margin-bottom: 15px\;\">");
conv = conv.replace(/<a href=/gi, "<a style=\"color: #6AB023\;text-decoration:underline\;\" href=");


If anyone thinks they can improve upon this, please do :slight_smile: