feat(messages): render markdown in message body

uses redcarpet gem to render markdown to html. Also a html email template
is added.
This commit is contained in:
Philipp Rothmann 2023-01-30 13:14:37 +01:00
parent fb8ccfea4a
commit d2d7d0c4f9
5 changed files with 19 additions and 3 deletions

View file

@ -132,9 +132,14 @@ class Message < ApplicationRecord
user.role_admin?
end
def render_markdown
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true, strikethrough: true, footnotes: true)
return markdown.render(body)
end
private
def create_salt
self.salt = [Array.new(6) { rand(256).chr }.join].pack("m").chomp
end
end
end