From 5aaa6648f024a11e36d6e5f0e2ebb955eeb9661d Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Fri, 27 Oct 2023 00:39:13 +0200 Subject: [PATCH] Merge pull request #8334 from Repiteo/space-to-tab-v3 Reimplement space-to-tab regex without lookbehind --- _static/js/custom.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_static/js/custom.js b/_static/js/custom.js index 726bb81c4..4b434839c 100644 --- a/_static/js/custom.js +++ b/_static/js/custom.js @@ -299,8 +299,12 @@ $(document).ready(() => { // Only change indentation for GDScript and C++. continue; } - let html = codeBlock.innerHTML; - html = html.replace(/(?<=^()?( {4})*)( {4})/gm, '\t'); + let html = codeBlock.innerHTML.replace(/^()?( {4})/gm, '\t'); + let html_old = ""; + while (html != html_old) { + html_old = html; + html = html.replace(/\t( {4})/gm, '\t\t') + } codeBlock.innerHTML = html; }