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:
parent
a7747c9e84
commit
0a2f528269
7 changed files with 37 additions and 4 deletions
|
|
@ -263,4 +263,26 @@ module ApplicationHelper
|
|||
stylesheet_link_tag foodcoop_css_path, media: 'all'
|
||||
end
|
||||
end
|
||||
|
||||
# renders html from markdown input
|
||||
def markdown(text)
|
||||
options = {
|
||||
filter_html: true,
|
||||
hard_wrap: true,
|
||||
link_attributes: { rel: 'nofollow', target: "_blank" },
|
||||
fenced_code_blocks: true
|
||||
}
|
||||
extensions = {
|
||||
autolink: true,
|
||||
superscript: true,
|
||||
disable_indented_code_blocks: true,
|
||||
tables: true,
|
||||
strikethrough: true,
|
||||
footnotes: true
|
||||
}
|
||||
|
||||
renderer = ::Redcarpet::Render::HTML.new(options)
|
||||
markdown = ::Redcarpet::Markdown.new(renderer, extensions)
|
||||
markdown.render(text).html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue