Skip to content
Snippets Groups Projects
Unverified Commit d037c278 authored by marihachi's avatar marihachi Committed by GitHub
Browse files

linkノードのurlプロパティを修正 (#84)

* add test

* fix bug
parent 238ac6b9
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -961,6 +961,17 @@ hoge`;
assert.deepStrictEqual(mfm.parse(input), output);
});
it('with angle brackets url', () => {
const input = '[official instance](<https://misskey.io/@ai>).';
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 = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment