This commit is contained in:
quenousimporte 2023-10-20 11:26:40 +02:00
parent 4920358533
commit 80e1824790
1 changed files with 7 additions and 6 deletions

13
main.js
View File

@ -1966,7 +1966,8 @@ function rawline(index)
return md.value.split("\n")[index]; return md.value.split("\n")[index];
} }
function applycolorsonline(line, index, options) var emptyline = "<br>";
function rawline2html(line, index, options)
{ {
line = escapeHtml(line); line = escapeHtml(line);
@ -2015,7 +2016,7 @@ function applycolorsonline(line, index, options)
{ {
options.header = false; options.header = false;
} }
line = line || "&nbsp;"; line = line || "<br>";
line = "<span style='color:lightgrey'>" + line + "</span>"; line = "<span style='color:lightgrey'>" + line + "</span>";
} }
@ -2059,7 +2060,7 @@ function applycolorsonline(line, index, options)
} }
else if (options.comment) else if (options.comment)
{ {
line = line || "&nbsp;"; line = line || emptyline;
line = "<span style='color:lightgrey'>" + line line = "<span style='color:lightgrey'>" + line
if (line.includes("--&gt;")) if (line.includes("--&gt;"))
{ {
@ -2124,8 +2125,8 @@ function applycolors(currentonly)
var linediv = document.getElementById("line" + index); var linediv = document.getElementById("line" + index);
options = JSON.parse(linediv.getAttribute("tag")); options = JSON.parse(linediv.getAttribute("tag"));
var line = rawline(index); var line = rawline(index);
line = applycolorsonline(line, index, options); line = rawline2html(line, index, options);
linediv.innerHTML = line || "&nbsp;"; linediv.innerHTML = line || emptyline;
} }
else else
{ {
@ -2142,7 +2143,7 @@ function applycolors(currentonly)
} }
linediv.setAttribute("id", "line" + i); linediv.setAttribute("id", "line" + i);
linediv.setAttribute("tag", JSON.stringify(options)); linediv.setAttribute("tag", JSON.stringify(options));
linediv.innerHTML = applycolorsonline(lines[i], i, options) || "&nbsp;"; linediv.innerHTML = rawline2html(lines[i], i, options) || emptyline;
}; };
// remove remanining // remove remanining