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