added: color inline code and links

This commit is contained in:
quenousimporte 2023-11-15 21:19:20 +01:00
parent 107a382b9c
commit 1cb23c7108
1 changed files with 13 additions and 3 deletions

10
main.js
View File

@ -2245,12 +2245,15 @@ function rawline2html(line, index, options)
.filter(s => s.command.startsWith(snippetpart)) .filter(s => s.command.startsWith(snippetpart))
.map(s => s.command.substring(1)); .map(s => s.command.substring(1));
if (matching.length)
{
line += "<span style='color:lightgrey'>"; line += "<span style='color:lightgrey'>";
line += matching.join().substr(pos - slashpos - 1); line += matching.join().substr(pos - slashpos - 1);
line += "</span>"; line += "</span>";
} }
} }
} }
}
// todo.txt // todo.txt
if (currentistodo()) if (currentistodo())
@ -2266,6 +2269,13 @@ function rawline2html(line, index, options)
line = line.replace(/(\s\+\w*)/g, "<span style='color:grey'>$1</span>"); line = line.replace(/(\s\+\w*)/g, "<span style='color:grey'>$1</span>");
} }
} }
// inline code
line = line.replace(/`(.*)`/, "<span class='color-code'>`$1`</span>");
// links
line = line.replace(/(http[^\s]*)/, "<u>$1</u>");
return line; return line;
} }