|
|
|
@ -335,15 +335,19 @@ module ApplicationHelper
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def to_markdown(text)
|
|
|
|
|
nil if text.blank?
|
|
|
|
|
html_render_options = {
|
|
|
|
|
fenced_code_blocks: true,
|
|
|
|
|
tables: true,
|
|
|
|
|
autolink: true
|
|
|
|
|
return nil if text.blank?
|
|
|
|
|
options = {
|
|
|
|
|
:autolink => true,
|
|
|
|
|
:no_intra_emphasis => true,
|
|
|
|
|
:fenced_code_blocks => true,
|
|
|
|
|
:lax_html_blocks => true,
|
|
|
|
|
:strikethrough => true,
|
|
|
|
|
:superscript => true,
|
|
|
|
|
:tables => true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
markdown = Redcarpet::Markdown.new(html_render_options)
|
|
|
|
|
raw markdown.render(h(text)).html_safe
|
|
|
|
|
markdown = Redcarpet::Markdown.new(options)
|
|
|
|
|
markdown.render(h(text)).html_safe
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|