implement link

This commit is contained in:
marihachi 2021-03-19 01:09:06 +09:00
parent 18ca201a77
commit c1eb9eed76

View file

@ -157,6 +157,7 @@ inline
/ mathInline
/ hashtag
/ url
/ link
/ text
// inline: emoji
@ -307,6 +308,23 @@ urlBracketPair
= "(" urlContentPart* ")"
/ "[" urlContentPart* "]"
// inline: link
link
= silent:"?"? "[" label:linkLabel "](" url:$(url) ")"
{
return createNode('link', {
silent: (silent != null),
url: url
}, mergeText(label));
}
linkLabel
= (!"]" n:inline { return n; })+
linkUrl
= url { return text(); }
// inline: text
text