Skip to content

Commit 60857e1

Browse files
committed
fix(plugins/code): fix indent remover to keep \n (close #917)
1 parent 9264b59 commit 60857e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/plugins/code/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default async function({login, q, imports, data, rest, account}, {enabled
6666
if (!snippet.patch.split("\n").shift().endsWith("@@"))
6767
snippet.patch = snippet.patch.replace(/^(?<coord>@@.*?@@).*/, "$<coord>")
6868
const indent = Math.min(...(snippet.patch.match(/^.\s+/mg) ?? [0]).map(line => line.length - 1)) || 0
69-
const content = imports.htmlescape(snippet.patch.replace(new RegExp(`^(.)\\s{0,${indent}}`, "mg"), "$1"))
69+
const content = imports.htmlescape(snippet.patch.replace(new RegExp(`^(.)[\\t ]{0,${indent}}`, "mg"), "$1"))
7070

7171
//Format patch
7272
snippet.patch = imports.htmlunescape(await imports.highlight(content, "diff"))

0 commit comments

Comments
 (0)