diff --git a/main.js b/main.js
index 57d1d2c..cb6cac1 100644
--- a/main.js
+++ b/main.js
@@ -2108,10 +2108,12 @@ function applycolors()
var lines = md.value.split("\n");
var header = false;
var code = false;
+ var comment = false;
var language = "";
- var result = [];
+ var resulthtml = "";
lines.every( (line, i) =>
{
+ resulthtml += "
";
line = escapeHtml(line);
// headings
@@ -2190,21 +2192,40 @@ function applycolors()
}
// internal links
- line = line.replace(/(\[\[.*\]\])/g, "$1");
+ line = line.replace(/(\[\[.*\]\])/g, "$1");
// comments
- line = line.replace(/<\!/g, "<!");
- line = line.replace(/\-\->/g, "-->");
+ line = line.replace(/<\!--(.*)/g, "<!--$1");
+
+ if (line.includes("<!--") && !line.includes("-->"))
+ {
+ comment = true;
+ }
+ else if (comment)
+ {
+ console.log("comment: " + line);
+ line = "" + line
+ if (line.includes("-->"))
+ {
+ comment = false;
+ }
+ else
+ {
+ line += "";
+ }
+ }
+
+ line = line.replace(/\-\->/g, "-->");
+
if (line.startsWith("// "))
{
line = "" + line + "";
}
-
- result.push(line);
+ resulthtml += (line || " ") + "
";
return true;
});
- colored.innerHTML = result.join("
");
+ colored.innerHTML = resulthtml;
}
function datachanged()