[openstreetmap/openstreetmap-website] Restrict linkify shorthand expansion to plain text (PR #6674)
Marwin Hochfelsner
notifications at github.com
Fri Jan 9 08:52:24 UTC 2026
@hlfan commented on this pull request.
> @@ -88,25 +88,19 @@ def sanitize(text)
end
def linkify(text, mode = :urls)
- ERB::Util.html_escape(text)
- .then { |html| expand_link_shorthands(html) }
- .then { |html| expand_host_shorthands(html) }
- .then { |html| auto_link(html, mode) }
- .html_safe
+ link_attr = 'rel="nofollow noopener noreferrer" dir="auto"'
+ ERB::Util
+ .html_escape(text)
+ .then { |html| expand_link_shorthands(html) }
+ .then { |html| expand_host_shorthands(html) }
+ .then { |html| Rinku.auto_link(html, mode, link_attr) { |url| shorten_link(shorten_hosts(url)) } }
Another option is to not move the path replacement definition but to make it toggleable:
https://github.com/openstreetmap/openstreetmap-website/compare/master...hlfan:openstreetmap-website:structured-linkify
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6674#discussion_r2675354781
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6674/review/3642964049 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260109/acd795b6/attachment-0001.htm>
More information about the rails-dev
mailing list