From ae392a2fddbdc6cc1b855493b85cd8ad2d21d574 Mon Sep 17 00:00:00 2001 From: Yaotian-Liu Date: Mon, 29 May 2023 23:23:43 +0800 Subject: [PATCH] refactor: Use template literals --- main.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index d9c1365..45aa718 100644 --- a/main.ts +++ b/main.ts @@ -32,11 +32,14 @@ export default class PseudocodePlugin extends Plugin { // find all $ enclosements in source, and add the preamble. // TODO: Might be able to optimize. const mathRegex = /\$(.*?)\$/g; - const withPreamble = source.replace(mathRegex, (match, group1) => { - return "$" + this.preamble + group1 + "$"; + const withPreamble = source.replace(mathRegex, (_, group1) => { + return `$${this.preamble}${group1}$`; }); - const preEl = blockDiv.createEl("pre", { cls: "code", text: withPreamble }); + const preEl = blockDiv.createEl("pre", { + cls: "code", + text: withPreamble, + }); try { pseudocode.renderElement(preEl, this.settings.jsSettings);