diff --git a/src/parser/core-parser.pegjs b/src/parser/core-parser.pegjs index f6c80e2..8f529f0 100644 --- a/src/parser/core-parser.pegjs +++ b/src/parser/core-parser.pegjs @@ -42,7 +42,7 @@ inline / inlineCode / mathInline // / mention - // / hashtag + / hashtag // / url // / link / customEmoji @@ -253,6 +253,26 @@ mathInline } +// inline: hashtag + +hashtag + = "#" content:hashtag_content +{ + return createTree('hashtag', { hashtag: content }); +} + +hashtag_content + = (![\s!"#$%&'*+,\-./:;<=>?@\\^_`{|}~【】<>] (hashtag_bracket / hashtag_char))+ { return text(); } + +hashtag_bracket + = "(" hashtag_content* ")" + / "[" hashtag_content* "]" + / "「" hashtag_content* "」" + +hashtag_char + = ![()\[\]「」] CHAR + + // inline: custom emoji customEmoji