fixed: italics and bold in a * list

This commit is contained in:
quenousimporte 2023-09-29 11:39:02 +02:00
parent 3e211831d0
commit 5fe950ce8c
1 changed files with 17 additions and 4 deletions

21
main.js
View File

@ -2099,6 +2099,23 @@ function applycolors()
line = "<b>" + line + "</b>"; line = "<b>" + line + "</b>";
} }
// bold and italics
var temp = line;
if (line.startsWith("* "))
{
temp = line.substring(2);
}
temp = temp.replace(/\*\*([^\*]*)\*\*/g, "<b>&#42;&#42;$1&#42;&#42;</b>");
temp = temp.replace(/\*([^\*]*)\*/g, "<em>&#42;$1&#42;</em>");
if (line.startsWith("* "))
{
line = "* " + temp;
}
else
{
line = temp;
}
// lists // lists
markerslist.forEach(marker => markerslist.forEach(marker =>
{ {
@ -2151,10 +2168,6 @@ function applycolors()
// internal links // internal links
line = line.replace(/(\[\[.*\]\])/g, "<u><span style='cursor:pointer'>$1</span></u>"); line = line.replace(/(\[\[.*\]\])/g, "<u><span style='cursor:pointer'>$1</span></u>");
// bold and italics
line = line.replace(/\*\*([^\*]*)\*\*/g, "<b>&#42;&#42;$1&#42;&#42;</b>");
line = line.replace(/\*([^\*]*)\*/g, "<em>&#42;$1&#42;</em>");
// comments // comments
line = line.replace(/&lt;\!/g, "<span style='color:lightgrey'>&lt;!"); line = line.replace(/&lt;\!/g, "<span style='color:lightgrey'>&lt;!");
line = line.replace(/\-\-&gt;/g, "--></span>"); line = line.replace(/\-\-&gt;/g, "--></span>");