🛠️ Fix issue with <p>

This commit is contained in:
Acclorite 2025-01-15 13:10:41 +02:00
parent 6f53811f68
commit 8966951303

View file

@ -35,9 +35,14 @@ class DocumentParser @Inject constructor(
body().apply { body().apply {
// Remove manual line breaks from all <p>, <a> // Remove manual line breaks from all <p>, <a>
select("p, a").forEach { element -> select("p").forEach { element ->
yield() yield()
element.html(element.html().replace(Regex("\\n+"), " ")) element.html(element.html().replace(Regex("\\n+"), " "))
element.append("\n")
}
select("a").forEach { element ->
yield()
element.html(element.html().replace(Regex("\\n+"), ""))
} }
// Remove <head>'s title // Remove <head>'s title