Skip to content

Commit 9c5cc14

Browse files
committed
Reimplement space-to-tab regex without lookbehind
1 parent c1d8358 commit 9c5cc14

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

_static/js/custom.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,12 @@ $(document).ready(() => {
299299
// Only change indentation for GDScript and C++.
300300
continue;
301301
}
302-
let html = codeBlock.innerHTML;
303-
html = html.replace(/(?<=^(<span class="w">)?( {4})*)( {4})/gm, '\t');
302+
let html = codeBlock.innerHTML.replace(/^(<span class="w">)?( {4})/gm, '\t');
303+
let html_old = "";
304+
while (html != html_old) {
305+
html_old = html;
306+
html = html.replace(/\t( {4})/gm, '\t\t')
307+
}
304308
codeBlock.innerHTML = html;
305309
}
306310

0 commit comments

Comments
 (0)