From 1c00c94b58940bc7087dfe569a9a1ee7120994d5 Mon Sep 17 00:00:00 2001 From: Dominik Seeger <dominik.seeger@gmx.net> Date: Sun, 3 Mar 2019 15:15:10 +0100 Subject: [PATCH] performance fix --- frontend/src/util/helpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/util/helpers.ts b/frontend/src/util/helpers.ts index e3a7536e..8b55485f 100644 --- a/frontend/src/util/helpers.ts +++ b/frontend/src/util/helpers.ts @@ -130,12 +130,12 @@ export function syntaxPostProcess (code: string): string { const spanSuffix = '</span>' code = code.replace(/(<span class="hljs-comment">)([\s\S]*?)(<\/span>)/gim, (match, p1, p2, p3) => { - const splitted = p2.split("") - console.log(splitted) + const splitted = p2.split(/\n/) for (let i = 0; i < splitted.length; i++) { splitted[i] = spanPrefix + splitted[i] + spanSuffix } - return p1 + splitted.join("") + p3 + + return splitted.join("\n") }) return code } -- GitLab