From d08b0dcb059be8c77d660f7fe12b6cc677563d9a Mon Sep 17 00:00:00 2001 From: marihachi <marihachi0620@gmail.com> Date: Thu, 15 Apr 2021 17:19:08 +0900 Subject: [PATCH] fix italic syntax --- src/parser.pegjs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/parser.pegjs b/src/parser.pegjs index 868652d..26733fa 100644 --- a/src/parser.pegjs +++ b/src/parser.pegjs @@ -219,16 +219,22 @@ small // inline: italic italic + = italicTag + / italicAlt + +italicTag = "<i>" content:(!"</i>" i:inline { return i; })+ "</i>" { return ITALIC(mergeText(content)); } - / "*" content:$(!"*" ([a-z0-9]i / _))+ "*" + +italicAlt + = "*" content:$(!"*" ([a-z0-9]i / _))+ "*" &(LF / _) { const parsedContent = applyParser(content, 'inlineParser'); return ITALIC(parsedContent); } - / "_" content:$(!"_" ([a-z0-9]i / _))+ "_" + / "_" content:$(!"_" ([a-z0-9]i / _))+ "_" &(LF / _) { const parsedContent = applyParser(content, 'inlineParser'); return ITALIC(parsedContent); @@ -383,7 +389,7 @@ fnArg // inline: text inlineText - = !(LF / _) . &(hashtag / mention) . { return text(); } // hashtag, mention ignore + = !(LF / _) . &(hashtag / mention / italicAlt) . { return text(); } // hashtag, mention, italic ignore / . /* text node */ // inline: text (for plainParser) -- GitLab