<p></p>
<p><b>@hlfan</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5862#discussion_r2607073292">lib/rich_text.rb</a>:</p>
<pre style='color:#555'>> +        shorten_host(normalised_url, rule.hosts, rule.host_replacement) do |path|
+          path.sub(Regexp.new(rule.optional_path_prefix || ""), "")
+        end
</pre>
<p dir="auto">Could we just pass <code class="notranslate">shorten_host</code> the whole rule and handle it there?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5862#discussion_r2607094697">lib/rich_text.rb</a>:</p>
<pre style='color:#555'>> @@ -133,9 +131,12 @@ def auto_link(text, mode)
     end
 
     def format_link_text(url)
-      url = shorten_host(url, Settings.linkify_hosts, Settings.linkify_hosts_replacement)
-      url = shorten_host(url, Settings.linkify_wiki_hosts, Settings.linkify_wiki_hosts_replacement) do |path|
-        path.sub(Regexp.new(Settings.linkify_wiki_optional_path_prefix || ""), "")
+      url = Array
</pre>
<p dir="auto">Splitting the host and path related stuff made the expansion easier to read:</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/c1dc08b5308b47ba5579fde79123f5588e4f2427/lib/rich_text.rb#L92-L93">https://github.com/openstreetmap/openstreetmap-website/blob/c1dc08b5308b47ba5579fde79123f5588e4f2427/lib/rich_text.rb#L92-L93</a></p>
<p dir="auto">Doing that here too instead of reassigning the URL could be an option.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5862#pullrequestreview-3563070378">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLI5FAMCEEHZMR7XTQT4BA277AVCNFSM6AAAAAB2ADPIXOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKNRTGA3TAMZXHA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLKOFRKP2M4ANOQFPFD4BA277A5CNFSM6AAAAAB2ADPIXOWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTWUMAR2U.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5862/review/3563070378</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5862#pullrequestreview-3563070378",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5862#pullrequestreview-3563070378",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>