diff --git a/lib/rehype-sn.js b/lib/rehype-sn.js index d65b3f7c..98a17dbd 100644 --- a/lib/rehype-sn.js +++ b/lib/rehype-sn.js @@ -6,7 +6,7 @@ import { toString } from 'mdast-util-to-string' const userGroup = '[\\w_]+' const subGroup = '[A-Za-z][\\w_]+' -const mentionRegex = new RegExp('@(' + userGroup + '(?:\\/' + userGroup + ')?)', 'gi') +const mentionRegex = new RegExp('(?:^|\\s)@(' + userGroup + '(?:\\/' + userGroup + ')?)', 'gi') const subRegex = new RegExp('~(' + subGroup + '(?:\\/' + subGroup + ')?)', 'gi') const nostrIdRegex = /\b((npub1|nevent1|nprofile1|note1|naddr1)[02-9ac-hj-np-z]+)\b/g