Skip to content
Snippets Groups Projects
Commit 7cfcf2ed authored by marihachi's avatar marihachi
Browse files

implement mention

parent 605c6585
No related branches found
No related tags found
No related merge requests found
......@@ -155,6 +155,7 @@ inline
/ strike
/ inlineCode
/ mathInline
/ mention
/ hashtag
/ url
/ link
......@@ -259,6 +260,37 @@ mathInline
});
}
// inline: mention
mention
= "@" name:mentionName host:("@" host:mentionHost { return host; })?
{
return createNode('mention', {
name: name,
host: host
});
}
mentionName
= !"-" mentionNamePart+ // first char is not "-".
{
return text();
}
mentionNamePart
= "-" &mentionNamePart // last char is not "-".
/ [a-z0-9_]i
mentionHost
= ![.-] mentionHostPart+ // first char is neither "." nor "-".
{
return text();
}
mentionHostPart
= [.-] &mentionHostPart // last char is neither "." nor "-".
/ [a-z0-9_]i
// inline: hashtag
hashtag
......
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