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

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6518#discussion_r2589936578">config/settings.yml</a>:</p>
<pre style='color:#555'>> +      path_template: "user/\\k<username>"
+    - patterns: ["(?<key>[^\"?#<>/\\s]+)=\\*?"]
+      path_template: "wiki/Key:\\k<key>"
+      host: "https://wiki.openstreetmap.org"
+    - patterns: ["(?<key>[^\"?#<>/\\s]+)=(?<value>[^\"?#<>\\s]+)"]
+      path_template: "wiki/Tag:\\k<key>=\\k<value>"
+      host: "https://wiki.openstreetmap.org"
+  display_rules:
+    - pattern: "osm\\.org/user/"
+      replacement: "@"
+    - pattern: "osm\\.org/(?<type>node|way|relation|changeset|note)/"
+      replacement: "\\k<type>/"
+    - pattern: "osm\\.wiki/Key:(?<key>[^\"?#<>/\\s]+)"
+      replacement: "\\k<key>=*"
+    - pattern: "osm\\.wiki/Tag:(?<key>[^\"?#<>/\\s]+)(?:=|%3D)(?<value>[^\"?#<>\\s]+)"
+      replacement: "\\k<key>=\\k<value>"
</pre>
<p dir="auto">Would taginfo be a better target here? Many keys and/or key-value pairs won't actually have a wiki page?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6518#discussion_r2589957226">lib/rich_text.rb</a>:</p>
<pre style='color:#555'>>      end
 
     private
 
+    def expand_link_shorthands(text)
+      Array.wrap(Settings.linkify&.detection_rules)
+           .select { |rule| rule.path_template && rule.patterns.is_a?(Array) }
+           .flat_map { |rule| linkify_detection_rule_to_gsub(rule) }
+           .reduce(text) { |text, (pattern, replacement)| text.gsub(pattern, replacement) }
+    end
+
+    def linkify_detection_rule_to_gsub(rule)
+      expanded_path = "#{rule.host || "#{Settings.server_protocol}://#{Settings.server_url}"}/#{rule.path_template}"
+      rule.patterns
+          .select { |pattern| pattern.is_a?(String) }
+          .map do |pattern|
+        [
+          Regexp.new("(?<before>\\s|^|>)#{pattern}(?<after>\\s|$|<)", Regexp::IGNORECASE),
</pre>
<p dir="auto">Would  looking for a word boundary with <code class="notranslate">\b</code> before and after work here and make this a bit simpler?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6518#discussion_r2589975477">lib/rich_text.rb</a>:</p>
<pre style='color:#555'>>      end
 
     private
 
+    def expand_link_shorthands(text)
+      Array.wrap(Settings.linkify&.detection_rules)
+           .select { |rule| rule.path_template && rule.patterns.is_a?(Array) }
+           .flat_map { |rule| linkify_detection_rule_to_gsub(rule) }
</pre>
<p dir="auto">Is <code class="notranslate">flat_map</code> correct here? We want a list of pattern and replacement pairs and <code class="notranslate">linkify_detection_rule_to_gsub</code> returns a pattern/replacement pair so running it on each rule will give us what we want and flattening will destroy that?</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/6518#pullrequestreview-3541156197">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLKILDXROJM3G3BQM4T4ABWBTAVCNFSM6AAAAACLXBWDSCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKNBRGE2TMMJZG4">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLKFOYOP47V3TWC3KL34ABWBTA5CNFSM6AAAAACLXBWDSCWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTWTCHAWK.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/6518/review/3541156197</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/6518#pullrequestreview-3541156197",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6518#pullrequestreview-3541156197",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>