fix: improve <pre> tag regex handling when formatting HTML strings

This commit is contained in:
SiriusXT
2025-09-04 17:36:19 +08:00
parent 0ae25d2212
commit fa2188f087

View File

@@ -304,7 +304,7 @@ function formatHtml(html: string) {
let pre: { indent: string; tag: string }[] = [];
html = html
.replace(new RegExp("<pre>((.|\\t|\\n|\\r)+)?</pre>"), function (x) {
.replace(new RegExp("<pre>([\\s\\S]+?)?</pre>"), function (x) {
pre.push({ indent: "", tag: x });
return "<--TEMPPRE" + i++ + "/-->";
})