2018-05-24 18:01:40 +02:00
|
|
|
module StringToHtmlHelper
|
|
|
|
def string_to_html(str)
|
|
|
|
html_formatted = simple_format(str)
|
|
|
|
with_links = html_formatted.gsub(URI.regexp, '<a target="_blank" href="\0">\0</a>')
|
2018-10-01 13:55:12 +02:00
|
|
|
sanitize(with_links, attributes: ['href', 'target'])
|
2018-05-24 18:01:40 +02:00
|
|
|
end
|
|
|
|
end
|