From 60857e1480e2217b9387508015be1b966c3e7da2 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Wed, 9 Mar 2022 19:48:54 -0500 Subject: [PATCH] fix(plugins/code): fix indent remover to keep `\n` (close #917) --- source/plugins/code/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/plugins/code/index.mjs b/source/plugins/code/index.mjs index 4edf57cb..211c2d93 100644 --- a/source/plugins/code/index.mjs +++ b/source/plugins/code/index.mjs @@ -66,7 +66,7 @@ export default async function({login, q, imports, data, rest, account}, {enabled if (!snippet.patch.split("\n").shift().endsWith("@@")) snippet.patch = snippet.patch.replace(/^(?@@.*?@@).*/, "$") const indent = Math.min(...(snippet.patch.match(/^.\s+/mg) ?? [0]).map(line => line.length - 1)) || 0 - const content = imports.htmlescape(snippet.patch.replace(new RegExp(`^(.)\\s{0,${indent}}`, "mg"), "$1")) + const content = imports.htmlescape(snippet.patch.replace(new RegExp(`^(.)[\\t ]{0,${indent}}`, "mg"), "$1")) //Format patch snippet.patch = imports.htmlunescape(await imports.highlight(content, "diff"))