From e0f78290ef7d14a76a3917efb482b00f37b18408 Mon Sep 17 00:00:00 2001 From: marihachi Date: Fri, 7 May 2021 00:04:01 +0900 Subject: [PATCH] improve detection of mention, hashtag, italic(alt) --- src/parser.pegjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parser.pegjs b/src/parser.pegjs index 5eeaccf..cd86eec 100644 --- a/src/parser.pegjs +++ b/src/parser.pegjs @@ -285,12 +285,12 @@ italicTag } italicAlt - = "*" content:$(!"*" ([a-z0-9]i / _))+ "*" &(EOF / LF / _) + = "*" content:$(!"*" ([a-z0-9]i / _))+ "*" &(EOF / LF / _ / ![a-z0-9]i) { const parsedContent = applyParser(content, 'inlineParser'); return ITALIC(parsedContent); } - / "_" content:$(!"_" ([a-z0-9]i / _))+ "_" &(EOF / LF / _) + / "_" content:$(!"_" ([a-z0-9]i / _))+ "_" &(EOF / LF / _ / ![a-z0-9]i) { const parsedContent = applyParser(content, 'inlineParser'); return ITALIC(parsedContent); @@ -476,7 +476,7 @@ fnContentPart // inline: text inlineText - = !(LF / _) . &(hashtag / mention / italicAlt) . { return text(); } // hashtag, mention, italic ignore + = !(LF / _) [a-z0-9]i &(hashtag / mention / italicAlt) . { return text(); } // hashtag, mention, italic ignore / . /* text node */ // inline: text (for plainParser)