diff --git a/Iceshrimp.Parsing/Mfm.fs b/Iceshrimp.Parsing/Mfm.fs index a73fc280..6d14c7cc 100644 --- a/Iceshrimp.Parsing/Mfm.fs +++ b/Iceshrimp.Parsing/Mfm.fs @@ -237,7 +237,7 @@ module private MfmParser = |>> fun c -> MfmCenterNode(aggregateTextInline c) :> MfmNode let mentionNode = - previousCharSatisfiesNot isNotWhitespace + (previousCharSatisfiesNot isNotWhitespace <|> previousCharSatisfies (isAnyOf <| "()")) >>. skipString "@" >>. many1Chars ( satisfy isLetterOrNumber diff --git a/Iceshrimp.Tests/Parsing/MfmTests.cs b/Iceshrimp.Tests/Parsing/MfmTests.cs index f5975620..d7333e7f 100644 --- a/Iceshrimp.Tests/Parsing/MfmTests.cs +++ b/Iceshrimp.Tests/Parsing/MfmTests.cs @@ -75,7 +75,7 @@ public class MfmTests public void TestMention() { const string input = - "test @test test @test@instance.tld @test_ @_test @test_@ins-tance.tld @_test@xn--mastodn-f1a.de @_test@-xn--mastodn-f1a.de"; + "test @test test @test@instance.tld @test_ @_test @test_@ins-tance.tld @_test@xn--mastodn-f1a.de @_test@-xn--mastodn-f1a.de (@test@domain.tld)"; List expected = [ new MfmTextNode("test "), @@ -90,7 +90,9 @@ public class MfmTests new MfmMentionNode("test_@ins-tance.tld", "test_", "ins-tance.tld"), new MfmTextNode(" "), new MfmMentionNode("_test@xn--mastodn-f1a.de", "_test", "xn--mastodn-f1a.de"), - new MfmTextNode(" @_test@-xn--mastodn-f1a.de") + new MfmTextNode(" @_test@-xn--mastodn-f1a.de ("), + new MfmMentionNode("test@domain.tld", "test", "domain.tld"), + new MfmTextNode(")"), ]; var res = Mfm.parse(input);