[codeInspection.ui] Normalize code blocks in inspection descriptions

#IJPL-180212 Fixed

GitOrigin-RevId: b802f331e674234700fe04c9f0e5b4c87ecf4cca
This commit is contained in:
Louis Vignier
2025-03-06 07:26:55 +00:00
committed by intellij-monorepo-bot
parent 190ab5162c
commit befb6bb382
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.profile.codeInspection.ui
import com.intellij.lang.Language
@@ -67,7 +67,13 @@ fun JEditorPane.readHTML(text: @Nls String) {
*/
fun JEditorPane.readHTMLWithCodeHighlighting(text: String, language: String?) {
var lang = Language.findLanguageByID(language) ?: PlainTextLanguage.INSTANCE
val document = Jsoup.parse(text)
// IJPL-180212
@Suppress("HardCodedStringLiteral")
val normalizedText = Regex("</code>\\s*</pre>")
.replace(text, "</code></pre>")
val document = Jsoup.parse(normalizedText)
// IDEA-318323
if (text.contains("<body>\n<p>")) {
@@ -84,7 +90,6 @@ fun JEditorPane.readHTMLWithCodeHighlighting(text: String, language: String?) {
}
try {
@Suppress("HardCodedStringLiteral")
setText(document.html())
}
catch (e: IOException) {