From 311249c5e00aacd759a4dcc77cc2ab6b367465e0 Mon Sep 17 00:00:00 2001 From: 50h100a Date: Fri, 28 Jul 2023 18:09:54 -0400 Subject: [PATCH] Tilde does nothing in our markdown, remove it. Match begin/end formatting symbol counts. --- public/scripts/power-user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index e893d64c7..02c4494d8 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -256,7 +256,7 @@ function fixMarkdown(text) { // i.e. "^example * text* * harder problem *\n" -> "^example *text* *harder problem*\n" // Find pairs of formatting characters and capture the text in between them - const format = /(\*|_|~){1,2}([\s\S]*?)\1{1,2}/gm; + const format = /([\*_]{1,2})([\s\S]*?)\1/gm; let matches = []; let match; while ((match = format.exec(text)) !== null) { @@ -267,7 +267,7 @@ function fixMarkdown(text) { let newText = text; for (let i = matches.length - 1; i >= 0; i--) { let matchText = matches[i][0]; - let replacementText = matchText.replace(/(\*|_|~)(\s+)|(\s+)(\*|_|~)/g, '$1$4'); + let replacementText = matchText.replace(/(\*|_)(\s+)|(\s+)(\*|_)/g, '$1$4'); newText = newText.slice(0, matches[i].index) + replacementText + newText.slice(matches[i].index + matchText.length); }