mirror of
https://activitypub.software/TransFem-org/sfm-js
synced 2024-11-22 14:05:13 +00:00
implement mention
This commit is contained in:
parent
605c6585c7
commit
7cfcf2edcd
1 changed files with 32 additions and 0 deletions
|
@ -155,6 +155,7 @@ inline
|
||||||
/ strike
|
/ strike
|
||||||
/ inlineCode
|
/ inlineCode
|
||||||
/ mathInline
|
/ mathInline
|
||||||
|
/ mention
|
||||||
/ hashtag
|
/ hashtag
|
||||||
/ url
|
/ url
|
||||||
/ link
|
/ 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
|
// inline: hashtag
|
||||||
|
|
||||||
hashtag
|
hashtag
|
||||||
|
|
Loading…
Reference in a new issue