mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-07 22:13:37 +01:00
15 lines
No EOL
351 B
Ruby
15 lines
No EOL
351 B
Ruby
module SharedMarkers
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
def autolink(link, _link_type)
|
|
href = if ALLOWED_HOSTS_IN_MARKDOWN.include?(URI(link).host)
|
|
link
|
|
else
|
|
linkfilter_path(url: link)
|
|
end
|
|
|
|
content_tag(:a, link, href: href, target: "_blank", rel: "nofollow")
|
|
rescue
|
|
link
|
|
end
|
|
end |