2021-12-30 09:13:52 -08:00
|
|
|
module SharedMarkers
|
2021-12-31 13:21:05 -08:00
|
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
|
2021-12-30 09:13:52 -08:00
|
|
|
def autolink(link, _link_type)
|
2021-12-31 13:21:05 -08:00
|
|
|
href = if ALLOWED_HOSTS_IN_MARKDOWN.include?(URI(link).host)
|
|
|
|
link
|
|
|
|
else
|
|
|
|
linkfilter_path(url: link)
|
|
|
|
end
|
2021-12-30 09:13:52 -08:00
|
|
|
|
2021-12-31 13:21:05 -08:00
|
|
|
content_tag(:a, link, href: href, target: "_blank", rel: "nofollow")
|
2021-12-30 09:13:52 -08:00
|
|
|
end
|
|
|
|
end
|