added(colors): comments in code blocks

This commit is contained in:
quenousimporte 2023-11-13 17:18:08 +01:00
parent d5b261cc88
commit 62b28afedd
1 changed files with 8 additions and 2 deletions

10
main.js
View File

@ -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, "<span style='color:" + settings.accentcolor + "'>" + marker + "</span>");
}
@ -2089,11 +2089,17 @@ function rawline2html(line, index, options)
}
else if (options.code)
{
var comment = false;
if (line.match(/^\s*\/\//))
{
line = "<span style='color:grey'>" + line + "</span>";
comment = true;
}
if (settings.darkcode)
{
line = "<div class='color-code'>" + (line || emptyline) + "</div>";
}
if (languagekeywords[options.language])
if (!comment && languagekeywords[options.language])
{
var keywords = languagekeywords[options.language];
keywords.forEach(keyword =>