From aa81d6cb4f8e363abd8e2f67cbee8ee11b32ef69 Mon Sep 17 00:00:00 2001 From: Sander van Dragt Date: Mon, 1 Jun 2026 13:55:02 +0100 Subject: [PATCH] Match hyphens in @mentions The mention matcher used /@(\w+)/, where \w excludes hyphens, so a mention of a user whose slug contains a hyphen (e.g. @dominic-huxley) only captured the part before the hyphen. The truncated slug matched no user, so the mention rendered as plain text instead of a link. Allow hyphens in the captured username with /@([\w-]+)/. WordPress nicenames are limited to lowercase letters, digits, and hyphens, so this covers all valid slugs. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/matchers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matchers.js b/src/matchers.js index e0f24cb2..fc937073 100644 --- a/src/matchers.js +++ b/src/matchers.js @@ -20,7 +20,7 @@ export class MentionMatcher extends Matcher { } match( string ) { - return this.doMatch( string, /@(\w+)/, matches => ( { username: matches[1] } ) ); + return this.doMatch( string, /@([\w-]+)/, matches => ( { username: matches[1] } ) ); } }