From 62b28afedddca82fd38e2d5951fd6e7b1b27cf01 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 13 Nov 2023 17:18:08 +0100 Subject: [PATCH] added(colors): comments in code blocks --- main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index c27dd73..eb79ddf 100644 --- a/main.js +++ b/main.js @@ -2047,7 +2047,7 @@ function rawline2html(line, index, options) // lists markerslist.forEach(marker => { - if (line.startsWith(marker)) + if (line.startsWith(marker) && marker.trim()) { line = line.replace(marker, "" + marker + ""); } @@ -2089,11 +2089,17 @@ function rawline2html(line, index, options) } else if (options.code) { + var comment = false; + if (line.match(/^\s*\/\//)) + { + line = "" + line + ""; + comment = true; + } if (settings.darkcode) { line = "
" + (line || emptyline) + "
"; } - if (languagekeywords[options.language]) + if (!comment && languagekeywords[options.language]) { var keywords = languagekeywords[options.language]; keywords.forEach(keyword =>