diff --git a/packages/linkifyjs/src/parser.mjs b/packages/linkifyjs/src/parser.mjs index 7bb4ab5..5bbded5 100644 --- a/packages/linkifyjs/src/parser.mjs +++ b/packages/linkifyjs/src/parser.mjs @@ -144,6 +144,7 @@ export function init({ groups }) { // Hyphen can jump back to a domain name const EmailDomainHyphen = tt(EmailDomain, tk.HYPHEN); // parsed string starts with local email info + @ with a potential domain name + tt(EmailDomainHyphen, tk.HYPHEN, EmailDomainHyphen); ta(EmailDomainHyphen, groups.domain, EmailDomain); ta(Email, groups.domain, EmailDomain); tt(Email, tk.DOT, EmailDomainDot); @@ -157,6 +158,7 @@ export function init({ groups }) { // (but not TLDs) const DomainHyphen = tt(Domain, tk.HYPHEN); // domain followed by hyphen const DomainDot = tt(Domain, tk.DOT); // domain followed by DOT + tt(DomainHyphen, tk.HYPHEN, DomainHyphen); ta(DomainHyphen, groups.domain, Domain); ta(DomainDot, localpartAccepting, Localpart); ta(DomainDot, groups.domain, Domain); diff --git a/test/spec/linkifyjs/parser.test.mjs b/test/spec/linkifyjs/parser.test.mjs index c17318d..94c75f9 100644 --- a/test/spec/linkifyjs/parser.test.mjs +++ b/test/spec/linkifyjs/parser.test.mjs @@ -324,6 +324,8 @@ const tests = [ ['https://google.com', '\ufffcthis'], ], ['some string with somefile.mp4 token', [Text], ['some string with somefile.mp4 token']], + ['hp--community.force.com', [Url], ['hp--community.force.com']], + ['example@hp--community.force.com', [Email], ['example@hp--community.force.com']], ]; describe('linkifyjs/parser#run()', () => {