diff --git a/CHANGELOG.md b/CHANGELOG.md index c140bb6..40b7eb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Improvements ### Changes +- allow `.` in mentions (like `@bsky.brid.gy@bsky.brid.gy`) ### Bugfixes diff --git a/src/internal/parser.ts b/src/internal/parser.ts index 26029b1..f4c1f49 100644 --- a/src/internal/parser.ts +++ b/src/internal/parser.ts @@ -552,7 +552,7 @@ export const language = P.createLanguage({ const parser = P.seq( notLinkLabel, P.str('@'), - P.regexp(/[a-z0-9_-]+/i), + P.regexp(/[a-z0-9_.-]+/i), P.seq( P.str('@'), P.regexp(/[a-z0-9_.-]+/i), diff --git a/test/parser.ts b/test/parser.ts index 852699c..3155481 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -733,6 +733,12 @@ hoge`; assert.deepStrictEqual(mfm.parse(input), output); }); + test('allow "." in username', () => { + const input = '@bsky.brid.gy@bsky.brid.gy'; + const output = [MENTION('bsky.brid.gy', 'bsky.brid.gy', '@bsky.brid.gy@bsky.brid.gy')]; + assert.deepStrictEqual(mfm.parse(input), output); + }); + test('disallow "-" in head of username', () => { const input = '@-abc'; const output = [TEXT('@-abc')];