diff --git a/src/internal/parser.pegjs b/src/internal/parser.pegjs index 5e3520c..76cc315 100644 --- a/src/internal/parser.pegjs +++ b/src/internal/parser.pegjs @@ -402,9 +402,9 @@ altUrlFormat // inline: link link - = silent:"?"? "[" label:linkLabel "](" url:linkUrl ")" + = silent:"?"? "[" label:linkLabel "](" url:url ")" { - return LINK((silent != null), url, mergeText(label)); + return LINK((silent != null), url.props.url, mergeText(label)); } linkLabel @@ -416,9 +416,6 @@ linkLabelPart / mention { return text(); /* text node */ } / !"]" @inline -linkUrl - = url { return text(); } - // inline: fn fn diff --git a/test/parser.ts b/test/parser.ts index f084f72..11d00e2 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -961,6 +961,17 @@ hoge`; assert.deepStrictEqual(mfm.parse(input), output); }); + it('with angle brackets url', () => { + const input = '[official instance]().'; + const output = [ + LINK(false, 'https://misskey.io/@ai', [ + TEXT('official instance') + ]), + TEXT('.') + ]; + assert.deepStrictEqual(mfm.parse(input), output); + }); + it('do not yield url node even if label is recognisable as a url', () => { const input = 'official instance: [https://misskey.io/@ai](https://misskey.io/@ai).'; const output = [