parses the link in the link node as text node.

This commit is contained in:
marihachi 2021-04-03 15:44:33 +09:00
parent 207134be21
commit 0ecd1de57c
2 changed files with 13 additions and 0 deletions

View file

@ -343,6 +343,7 @@ link
linkLabelPart linkLabelPart
= url { return text(); /* text node */ } = url { return text(); /* text node */ }
/ link { return text(); /* text node */ }
/ !"]" n:inline { return n; } / !"]" n:inline { return n; }
linkUrl linkUrl

View file

@ -457,6 +457,18 @@ describe('link', () => {
]; ];
assert.deepStrictEqual(parse(input), output); assert.deepStrictEqual(parse(input), output);
}); });
it('do not yield link node even if label is recognisable as a link', () => {
const input = 'official instance: [[https://misskey.io/@ai](https://misskey.io/@ai)](https://misskey.io/@ai).';
const output = [
TEXT('official instance: '),
LINK(false, 'https://misskey.io/@ai', [
TEXT('[https://misskey.io/@ai](https://misskey.io/@ai)')
]),
TEXT('.')
];
assert.deepStrictEqual(parse(input), output);
});
}); });
describe('fn', () => { describe('fn', () => {