From 1cb23c7108a6a17e6a04e86d6b113be727b1c1d3 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Wed, 15 Nov 2023 21:19:20 +0100 Subject: [PATCH] added: color inline code and links --- main.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 95a91e9..27611f1 100644 --- a/main.js +++ b/main.js @@ -2245,9 +2245,12 @@ function rawline2html(line, index, options) .filter(s => s.command.startsWith(snippetpart)) .map(s => s.command.substring(1)); - line += ""; - line += matching.join().substr(pos - slashpos - 1); - line += ""; + if (matching.length) + { + line += ""; + line += matching.join().substr(pos - slashpos - 1); + line += ""; + } } } } @@ -2266,6 +2269,13 @@ function rawline2html(line, index, options) line = line.replace(/(\s\+\w*)/g, "$1"); } } + + // inline code + line = line.replace(/`(.*)`/, "`$1`"); + + // links + line = line.replace(/(http[^\s]*)/, "$1"); + return line; }