feat: Enable Markdown Parsing in emails (#1663)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2021-01-18 11:43:31 +05:30
committed by GitHub
parent 54f15b73d3
commit 13073629bb
7 changed files with 36 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
<% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true) %>
<% @messages.each do |message| %>
<tr>
<td>
@@ -7,7 +8,7 @@
<tr>
<td style="padding-bottom: 16px;">
<% if message.content %>
<%= message.content %>
<%= markdown.render(message.content).html_safe %>
<% end %>
<% if message.attachments %>
<% message.attachments.each do |attachment| %>

View File

@@ -1,3 +1,4 @@
<% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true) %>
<p>Hi <%= @contact.name %>,</p>
<p>You have new messages on your conversation.</p>
@@ -11,7 +12,7 @@
<tr>
<td style="padding: 10px 20px; margin: 5px 0 20px 0; background: #F2F3F7; border-radius: 10px; display: inline-block; font-family: "Helvetica Neue",Tahoma,Arial,sans-serif; text-align: start; unicode-bidi: plaintext;">
<% if message.content %>
<%= message.content %>
<%= markdown.render(message.content).html_safe %>
<% end %>
<% if message.attachments %>
<% message.attachments.each do |attachment| %>

View File

@@ -1,7 +1,9 @@
<% markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true) %>
<% @messages.each do |message| %>
<p style="font-family: Roboto,"Helvetica Neue",Tahoma,Arial,sans-serif; text-align: start; unicode-bidi: plaintext;">
<% if message.content %>
<%= message.content.gsub("\n", "<br/>").html_safe %>
<%= markdown.render(message.content).html_safe %>
<% end %>
<% if message.attachments %>
<% message.attachments.each do |attachment| %>