From 5fe950ce8c63166e73d08d6bee2c87e40fe7ffaf Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Fri, 29 Sep 2023 11:39:02 +0200 Subject: [PATCH] fixed: italics and bold in a * list --- main.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 5892139..3d0fe9d 100644 --- a/main.js +++ b/main.js @@ -2099,6 +2099,23 @@ function applycolors() line = "" + line + ""; } + // bold and italics + var temp = line; + if (line.startsWith("* ")) + { + temp = line.substring(2); + } + temp = temp.replace(/\*\*([^\*]*)\*\*/g, "**$1**"); + temp = temp.replace(/\*([^\*]*)\*/g, "*$1*"); + if (line.startsWith("* ")) + { + line = "* " + temp; + } + else + { + line = temp; + } + // lists markerslist.forEach(marker => { @@ -2151,10 +2168,6 @@ function applycolors() // internal links line = line.replace(/(\[\[.*\]\])/g, "$1"); - // bold and italics - line = line.replace(/\*\*([^\*]*)\*\*/g, "**$1**"); - line = line.replace(/\*([^\*]*)\*/g, "*$1*"); - // comments line = line.replace(/<\!/g, "<!"); line = line.replace(/\-\->/g, "-->");