Skip to content

Commit

Permalink
fix #144
Browse files Browse the repository at this point in the history
  • Loading branch information
easrng authored and easrng committed Oct 29, 2024
1 parent 9cd9aae commit 554b1fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
### Improvements
### Changes
- allow `.` in mentions (like `@bsky.brid.gy@bsky.brid.gy`)
### Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion src/internal/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export const language = P.createLanguage<TypeTable>({
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),
Expand Down
6 changes: 6 additions & 0 deletions test/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')];
Expand Down

0 comments on commit 554b1fc

Please sign in to comment.